diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 00000000..201e7c7e --- /dev/null +++ b/.bazelrc @@ -0,0 +1,30 @@ +# +------------------------------------------------------------+ +# | Build Configurations | +# +------------------------------------------------------------+ +# Do not show warnings from external dependencies. +build --output_filter="^//" + +build --show_timestamps + +build --flag_alias=cuda_archs=@rules_cuda//cuda:archs + +# Work around the sandbox issue. +build --spawn_strategy=local + + +# Consider warning as error. +# inference is not included because tensorflow uses the same log macros with glog and it will +# cause re-definition warning. +build --per_file_copt="-\\.$@-Wall,-Wextra,-Werror" +build --per_file_copt="-\\.$,external/.*@-w" +build --per_file_copt="-\\.$,third_party/.*@-w" + +# If a command fails, print out the full command line. +build --verbose_failures + +# Enable C++17 +build --cxxopt="-std=c++17" +# Workaround as cpp toolchain: stop passing -std=c++0x per default · Issue #18181 · bazelbuild/bazel +build --host_cxxopt="-std=c++17" +# Enable colorful output of GCC +build --cxxopt="-fdiagnostics-color=always" diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 00000000..f4131375 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +8.4.1 \ No newline at end of file diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 00000000..da3ad918 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,61 @@ +name: cmake + +on: + pull_request: + branches: + - "mini20" + paths-ignore: + - ".clang-format" + - ".clangd" + - ".gitignore" + - "LICENSE" + - "README.md" + - "docs/**" + - ".github/workflows/xmake.yml" + - "**/xmake.lua" + - "**/*.bazel" + - "**/*.bzl" + - "**/*.bazelrc" + +jobs: + build_and_test: + strategy: + matrix: + os: [ubuntu-22.04] + + runs-on: ${{ matrix.os }} + + concurrency: + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-cmake-${{ matrix.os }} + cancel-in-progress: true + + steps: + - name: Maximize build space + if: matrix.os == 'ubuntu-22.04' + uses: AdityaGarg8/remove-unwanted-software@v4.1 + with: + remove-android: "true" + remove-haskell: "true" + remove-codeql: "true" + + - name: Setup cuda + uses: Jimver/cuda-toolkit@v0.2.28 + id: cuda-toolkit + with: + cuda: "12.8.1" + + - name: Setup ninja and Eigen3 on Ubuntu + if: matrix.os == 'ubuntu-22.04' + run: | + sudo apt update + sudo apt install ninja-build libeigen3-dev -y + + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Build MUDA + run: | + cmake --preset ci-release + cmake --build --preset ci-release --parallel 4 diff --git a/.gitignore b/.gitignore index a7004ca8..a28581a2 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,21 @@ vsxmake2022 # CMake Cache CMakeBuild/ + +# Bazel build +bazel-* +MODULE.bazel.lock + +# JetBrains IDEs +.idea/ + +.vs/ + +.cache + +compile_commands.json + +# //external is reserved by Bazel and needed for hedron_compile_commands +external/ + +presubmit.yml diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 00000000..2bad480b --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,74 @@ +load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") +load("@rules_cc//cc:defs.bzl", "cc_library") +load("@rules_license//rules:license.bzl", "license") + +package( + default_applicable_licenses = [":license"], + default_visibility = ["//visibility:public"], +) + +license( + name = "license", + package_name = "hugooole_muda", + package_url = "https://github.com/hugooole/muda", + license_text = "LICENSE", + license_kinds = ["@rules_license//licenses/spdx:Apache-2.0"], +) + +bool_flag( + name = "muda_check", + build_setting_default = True, +) + +config_setting( + name = "muda_check_on", + flag_values = {":muda_check": "True"}, +) + +bool_flag( + name = "muda_compute_graph", + build_setting_default = False, +) + +config_setting( + name = "muda_compute_graph_on", + flag_values = {":muda_compute_graph": "True"}, +) + +bool_flag( + name = "muda_nvtx3", + build_setting_default = False, +) + +config_setting( + name = "muda_nvtx3_on", + flag_values = {":muda_nvtx3": "True"}, +) + +cc_library( + name = "muda", + hdrs = glob( + [ + "src/**/*.h", + "src/**/*.hpp", + "src/**/*.inl", + "src/**/*.cuh", + ], + allow_empty = True, + ), + copts = [ + "--expt-relaxed-constexpr", + "--extended-lambda", + ], + defines = select({ + ":muda_check_on": ["MUDA_CHECK_ON"], + "//conditions:default": ["MUDA_CHECK_ON=0"], + }) + select({ + ":muda_compute_graph_on": ["MUDA_COMPUTE_GRAPH_ON"], + "//conditions:default": [], + }) + select({ + ":muda_nvtx3_on": ["MUDA_NVTX3_ON"], + "//conditions:default": [], + }), + includes = ["src"], +) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3de3c37..5f255052 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,85 +1,114 @@ # project cmake_minimum_required(VERSION 3.20) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - -# build targets: -option(MUDA_BUILD_EXAMPLE "build muda examples. if you want to see how to use muda, you could enable this option." ON) -option(MUDA_BUILD_TEST "build muda test. if you're the developer, you could enable this option." OFF) - -# short cut -option(MUDA_DEV "build muda example and unit test. if you're the developer, you could enable this option." OFF) -option(MUDA_FORCE_CHECK "turn on muda runtime check for all mode (Debug/RelWithDebInfo/Release)" OFF) -option(MUDA_WITH_CHECK "turn on muda runtime check when mode != Release" ON) -option(MUDA_WITH_COMPUTE_GRAPH "turn on muda compute graph" OFF) -option(MUDA_WITH_NVTX3 "turn on nividia tools extension library" OFF) - -if(MUDA_DEV) - set(MUDA_BUILD_EXAMPLE ON) - set(MUDA_PLAYGROUND ON) - set(MUDA_BUILD_TEST ON) -endif() + +# include options and install dirs +include(cmake/options.cmake) + +project(muda LANGUAGES CXX CUDA) +# must include after project() +include(GNUInstallDirs) # to remove warning if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) - set(CMAKE_CUDA_ARCHITECTURES native) + set(CMAKE_CUDA_ARCHITECTURES native) endif() -project(muda LANGUAGES CXX CUDA) +# ---------------------------------------------------------------------------- +# muda +# ---------------------------------------------------------------------------- find_package(CUDAToolkit REQUIRED) - enable_language(CUDA) -# muda add_library(muda INTERFACE) -target_compile_options(muda INTERFACE - $<$:--expt-relaxed-constexpr> - $<$:--extended-lambda> - $<$:-rdc=true> -) -# disable warning -target_compile_options(muda INTERFACE - $<$:-Xcudafe --display_error_number --diag-suppress 20012> -) -file(GLOB_RECURSE MUDA_HEADER_FILES "${PROJECT_SOURCE_DIR}/src/*.h" "${PROJECT_SOURCE_DIR}/src/*.inl" "${PROJECT_SOURCE_DIR}/src/*.cuh") -target_sources(muda PUBLIC ${MUDA_HEADER_FILES}) +# c++ standard >= 17 target_compile_features(muda INTERFACE cxx_std_17) + +# include directories +target_include_directories(muda INTERFACE + ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} + $ + $ +) + + +# link libraries target_link_libraries(muda INTERFACE CUDA::cudart) -target_include_directories(muda INTERFACE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) -target_include_directories(muda INTERFACE "${PROJECT_SOURCE_DIR}/src/") -source_group(TREE "${PROJECT_SOURCE_DIR}/src" PREFIX "Header Files" FILES ${MUDA_HEADER_FILES}) +# compile options +target_compile_options(muda INTERFACE + $<$:--expt-relaxed-constexpr> + $<$:--extended-lambda> + $<$:-rdc=true> + $<$:-Xcudafe --display_error_number> +) +# remove meaningless warnings +set(DIAG_SUPPRESSIONS "20012,20011,20014") +target_compile_options(muda INTERFACE + $<$:-diag-suppress=${DIAG_SUPPRESSIONS}> +) +if(WIN32) + # 4819: character cannot be represented in the current code page (936) + # 4068: unrecognized #pragma unroll + set(DISABLED_WARNINGS "/wd4819 /wd4068 /wd4996") + target_compile_options(muda INTERFACE + $<$:-Xcompiler=${DISABLED_WARNINGS}> + ) +endif() if(MUDA_FORCE_CHECK) - target_compile_definitions(muda INTERFACE "-DMUDA_CHECK_ON=1") + target_compile_definitions(muda INTERFACE "-DMUDA_CHECK_ON=1") else() - if(MUDA_WITH_CHECK) - target_compile_definitions(muda INTERFACE - $<$:MUDA_CHECK_ON=1> - $<$:MUDA_CHECK_ON=1>) - else() - target_compile_definitions(muda INTERFACE "-DMUDA_CHECK_ON=0") - endif() + if(MUDA_WITH_CHECK) + target_compile_definitions(muda INTERFACE + $<$:MUDA_CHECK_ON=1> + $<$:MUDA_CHECK_ON=1>) + else() + target_compile_definitions(muda INTERFACE "-DMUDA_CHECK_ON=0") + endif() endif() -if (MUDA_WITH_COMPUTE_GRAPH) - target_compile_definitions(muda INTERFACE "-DMUDA_COMPUTE_GRAPH_ON=1") + +if(MUDA_WITH_COMPUTE_GRAPH) + target_compile_definitions(muda INTERFACE "-DMUDA_COMPUTE_GRAPH_ON=1") else() - target_compile_definitions(muda INTERFACE "-DMUDA_COMPUTE_GRAPH_ON=0") + target_compile_definitions(muda INTERFACE "-DMUDA_COMPUTE_GRAPH_ON=0") endif() -if (MUDA_WITH_NVTX3) - target_compile_definitions(muda INTERFACE "-DMUDA_NVTX3_ON=1") + +if(MUDA_WITH_NVTX3) + target_compile_definitions(muda INTERFACE "-DMUDA_NVTX3_ON=1") else() - target_compile_definitions(muda INTERFACE "-DMUDA_NVTX3_ON=0") + target_compile_definitions(muda INTERFACE "-DMUDA_NVTX3_ON=0") endif() +# header files +file(GLOB_RECURSE MUDA_HEADER_FILES "${PROJECT_SOURCE_DIR}/src/*.h" "${PROJECT_SOURCE_DIR}/src/*.inl" "${PROJECT_SOURCE_DIR}/src/*.cuh") + +# installation +install(DIRECTORY "${PROJECT_SOURCE_DIR}/src/muda" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +install(TARGETS muda EXPORT mudaTargets) +install(EXPORT mudaTargets + FILE mudaTargets.cmake + NAMESPACE muda:: + DESTINATION share/muda +) +install(FILES + "${PROJECT_SOURCE_DIR}/cmake/muda-config.cmake" + DESTINATION share/muda +) + +source_group(TREE "${PROJECT_SOURCE_DIR}/src" PREFIX "Header Files" FILES ${MUDA_HEADER_FILES}) + +# ---------------------------------------------------------------------------- +# example and test +# ---------------------------------------------------------------------------- if(MUDA_BUILD_EXAMPLE) - add_subdirectory("example") + add_subdirectory("example") endif() if(MUDA_BUILD_TEST) - add_subdirectory("test") + enable_testing() + add_subdirectory("test") endif() \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..bc16b324 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,48 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 20, + "patch": 0 + }, + "configurePresets": [ + { + "name": "config-base", + "displayName": "base Configuration", + "hidden": true, + "description": "Default build using Ninja generator", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "MUDA_FORCE_CHECK": "ON", + "MUDA_WITH_CHECK": "ON", + "MUDA_WITH_COMPUTE_GRAPH": "ON", + "MUDA_WITH_NVTX3": "ON" + } + }, + { + "name": "ci-release", + "displayName": "CI-Release Configuration", + "inherits": ["config-base"], + "description": "Configuration for CI builds", + "cacheVariables": { + "MUDA_BUILD_TEST": "ON", + "MUDA_BUILD_EXAMPLE": "OFF", + "CMAKE_CUDA_ARCHITECTURES": "89", + "CMAKE_BUILD_TYPE": "Release" + } + } + ], + "buildPresets": [ + { + "name": "ci-release", + "configurePreset": "ci-release" + } + ], + "testPresets": [ + { + "name": "ci-release", + "configurePreset": "ci-release" + } + ] +} diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000..9a5b5602 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,42 @@ +"""muda""" + +module( + name = "hugooole_muda", + version = "1.0.0-beta", + compatibility_level = 1, +) + +bazel_dep(name = "rules_cc", version = "0.2.8") + +bazel_dep(name = "rules_license", version = "1.0.0") + +bazel_dep(name = "eigen", version = "3.4.1", dev_dependency = True) +bazel_dep(name = "bazel_skylib", version = "1.8.2") + +# rules_cuda is required for CUDA toolchain support +bazel_dep(name = "rules_cuda", version = "0.2.4") +git_override( + module_name = "rules_cuda", + remote = "https://github.com/bazel-contrib/rules_cuda.git", + commit = "1bf21ef1eee98042c0b2c5f39365ac39a4217c53", +) + + + +cuda = use_extension("@rules_cuda//cuda:extensions.bzl", "toolchain") +cuda.toolkit( + name = "cuda", + toolkit_path = "", +) +use_repo(cuda, "cuda") + +# Optional for debug: Hedron's Compile Commands Extractor for Bazel +# https://github.com/hedronvision/bazel-compile-commands-extractor +# bazel_dep(name = "hedron_compile_commands", dev_dependency = True) +# git_override( +# module_name = "hedron_compile_commands", +# remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git", +# commit = "abb61a688167623088f8768cc9264798df6a9d10", +# # Replace the commit hash (above) with the latest (https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main). +# # Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README). +# ) \ No newline at end of file diff --git a/cmake/muda-config.cmake b/cmake/muda-config.cmake new file mode 100644 index 00000000..bea1d7e8 --- /dev/null +++ b/cmake/muda-config.cmake @@ -0,0 +1,4 @@ +include(CMakeFindDependencyMacro) +find_dependency(CUDAToolkit REQUIRED) + +include("${CMAKE_CURRENT_LIST_DIR}/mudaTargets.cmake") \ No newline at end of file diff --git a/cmake/options.cmake b/cmake/options.cmake new file mode 100644 index 00000000..34528bf6 --- /dev/null +++ b/cmake/options.cmake @@ -0,0 +1,18 @@ +option(MUDA_PACKAGE "build muda as a package" OFF) +option(MUDA_FORCE_CHECK "turn on muda runtime check for all mode (Debug/RelWithDebInfo/Release)" OFF) +option(MUDA_WITH_CHECK "turn on muda runtime check when mode != Release" ON) +option(MUDA_WITH_COMPUTE_GRAPH "turn on muda compute graph" OFF) +option(MUDA_WITH_NVTX3 "turn on nividia tools extension library" OFF) + +# build targets: +option(MUDA_BUILD_EXAMPLE "build muda examples. if you want to see how to use muda, you could enable this option." ON) +option(MUDA_BUILD_TEST "build muda test. if you're the developer, you could enable this option." OFF) + +# short cut +option(MUDA_DEV "build muda example and unit test. if you're the developer, you could enable this option." OFF) + +if(MUDA_DEV) + set(MUDA_BUILD_EXAMPLE ON) + set(MUDA_PLAYGROUND ON) + set(MUDA_BUILD_TEST ON) +endif() \ No newline at end of file diff --git a/example/BUILD.bazel b/example/BUILD.bazel new file mode 100644 index 00000000..4b6f6c6a --- /dev/null +++ b/example/BUILD.bazel @@ -0,0 +1,23 @@ +load("@rules_cuda//cuda:defs.bzl", "cuda_binary") + +cuda_binary( + name = "examples", + srcs = glob([ + "**/*.cu", + "**/*.cpp", + ]), + hdrs = [ + "example_common.h", + ], + copts = [ + "-std=c++20", + ], + includes = ["."], + rdc = True, + visibility = ["//:__pkg__"], + deps = [ + "//:muda", + "//third_party:catch2", + "@eigen", + ], +) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 91d6bba5..9f21716d 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -6,23 +6,22 @@ else() message(FATAL_ERROR "Eigen3 not found") endif() - - -file(GLOB_RECURSE MUDA_EXAMPLE_SOURCE_FILES +file(GLOB_RECURSE SOURCE_FILES "${PROJECT_SOURCE_DIR}/example/*.cu" "${PROJECT_SOURCE_DIR}/example/*.cpp" "${PROJECT_SOURCE_DIR}/example/*.h") -add_executable(muda_example ${MUDA_EXAMPLE_SOURCE_FILES}) +add_executable(muda_example) +target_sources(muda_example PRIVATE ${SOURCE_FILES} ${MUDA_HEADER_FILES}) target_compile_features(muda_example PRIVATE cxx_std_20) set_target_properties(muda_example PROPERTIES CUDA_SEPARABLE_COMPILATION ON) # target_link_libraries(muda_example PRIVATE fmt::fmt-header-only) target_include_directories(muda_example PRIVATE "${PROJECT_SOURCE_DIR}/example" - "${PROJECT_SOURCE_DIR}/external") + "${PROJECT_SOURCE_DIR}/third_party") target_link_libraries(muda_example PRIVATE muda Eigen3::Eigen) -source_group(TREE "${PROJECT_SOURCE_DIR}/example" PREFIX "example" FILES ${MUDA_EXAMPLE_SOURCE_FILES}) +source_group(TREE "${PROJECT_SOURCE_DIR}/example" PREFIX "example" FILES ${SOURCE_FILES}) source_group(TREE "${PROJECT_SOURCE_DIR}/src" PREFIX "src" FILES ${MUDA_HEADER_FILES}) # set cuda sm75 set_property(TARGET muda_example PROPERTY CUDA_ARCHITECTURES 75) \ No newline at end of file diff --git a/example/profile/kernel_name.cu b/example/profile/kernel_name.cu index 24a33009..2ea25863 100644 --- a/example/profile/kernel_name.cu +++ b/example/profile/kernel_name.cu @@ -2,13 +2,13 @@ #include #include #include -#include // iota +#include // iota using namespace muda; void kernel_name() { example_desc("use and to help debugging and profiling."); - HostVector h_vec(100); + HostVector h_vec(100); DeviceVector vec(100); DeviceVar v(1); std::iota(h_vec.begin(), h_vec.end(), 0); @@ -27,8 +27,8 @@ void kernel_name() [s = vec.viewer(), v = v.viewer()] __device__(int i) mutable { __shared__ int b[64]; - s(i) = v; b[threadIdx.x] = v; + s(i) = v; }) .wait(); } diff --git a/example/warp/warp.cu b/example/warp/warp.cu index c8d4050e..06462d6a 100644 --- a/example/warp/warp.cu +++ b/example/warp/warp.cu @@ -23,9 +23,9 @@ For the sake of simplicity, we only launch one warp (even only 4 active thread). [] __device__() { // get lane id using cooperative group - auto block = cg::this_thread_block(); + auto block = cg::this_thread_block(); auto this_warp = cg::tiled_partition<4>(block); - int lane_id = this_warp.thread_rank(); + int lane_id = this_warp.thread_rank(); printf("[%d] lane_id: %d\n", lane_id, lane_id); diff --git a/mkdocs-no-api.yaml b/mkdocs-with-api.yaml similarity index 69% rename from mkdocs-no-api.yaml rename to mkdocs-with-api.yaml index c12d0769..719ec29a 100644 --- a/mkdocs-no-api.yaml +++ b/mkdocs-with-api.yaml @@ -54,6 +54,18 @@ plugins: - search - literate-nav: nav_file: nav.md + - mkdoxy: + projects: + muda: # name of project must be alphanumeric + numbers (without spaces) + src-dirs: src/muda # path to source code (support multiple paths separated by space) => INPUT + full-doc: True # if you want to generate full documentation + doxy-cfg: # standard doxygen configuration (key: value) + FILE_PATTERNS: "*.h*" # specify file patterns to filter out + RECURSIVE: True # recursive search in source directories + GENERATE_LATEX: False # generate latex output + HAVE_DOT: True + CLASS_DIAGRAMS: True + CLASS_GRAPH: True extra_css: - stylesheets/doxide.css diff --git a/mkdocs.yaml b/mkdocs.yaml index 719ec29a..c12d0769 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -54,18 +54,6 @@ plugins: - search - literate-nav: nav_file: nav.md - - mkdoxy: - projects: - muda: # name of project must be alphanumeric + numbers (without spaces) - src-dirs: src/muda # path to source code (support multiple paths separated by space) => INPUT - full-doc: True # if you want to generate full documentation - doxy-cfg: # standard doxygen configuration (key: value) - FILE_PATTERNS: "*.h*" # specify file patterns to filter out - RECURSIVE: True # recursive search in source directories - GENERATE_LATEX: False # generate latex output - HAVE_DOT: True - CLASS_DIAGRAMS: True - CLASS_GRAPH: True extra_css: - stylesheets/doxide.css diff --git a/scripts/build_docs.py b/scripts/build_docs.py index 3fc9ae55..673843d3 100644 --- a/scripts/build_docs.py +++ b/scripts/build_docs.py @@ -11,7 +11,7 @@ args = parser.parse_args() muda_doc_dir = args.output print(f'output_dir={muda_doc_default_dir}') - config_file = muda_project_dir / 'mkdocs.yaml' + config_file = muda_project_dir / 'mkdocs-with-api.yaml' print(f'config_file={config_file}') Value = sp.call(['mkdocs', 'build', '-f', config_file, '-d', muda_doc_dir]) if Value == 0: diff --git a/scripts/mk_view.py b/scripts/mk_view.py deleted file mode 100644 index 97606dee..00000000 --- a/scripts/mk_view.py +++ /dev/null @@ -1,71 +0,0 @@ -view_template='''#include - -namespace muda -{ -template -class $VIEW_NAME$ViewBase : public ViewBase -{ - public: - static_assert(!std::is_const_v, "Ty must be non-const"); - using ConstView = $VIEW_NAME$ViewBase; - using NonConstView = $VIEW_NAME$ViewBase; - using ThisView = $VIEW_NAME$ViewBase; - - protected: - // data - auto_const_t* m_values = nullptr; - public: - $VIEW_NAME$ViewBase() = default; - $VIEW_NAME$ViewBase(auto_const_t* values) - : m_values(values) - { - } - - // explicit conversion to non-const - ConstView as_const() const - { - return ConstView{m_values}; - } - - // implicit conversion to const - operator ConstView() const - { - return as_const(); - } - - // non-const access - auto_const_t* values() { return m_values; } - - // const access - auto values() const { return m_values; } -}; - -template -using $VIEW_NAME$View = $VIEW_NAME$ViewBase; -template -using C$VIEW_NAME$View = $VIEW_NAME$ViewBase; -} // namespace muda - -namespace muda -{ -template -struct read_only_viewer<$VIEW_NAME$View> -{ - using type = C$VIEW_NAME$View; -}; - -template -struct read_write_viewer<$VIEW_NAME$View> -{ - using type = $VIEW_NAME$View; -}; -} // namespace muda -''' - -if __name__ == '__main__': - import argparse - parser = argparse.ArgumentParser(description='Generate view and viewer') - parser.add_argument('name', type=str, help='name of the view') - args = parser.parse_args() - - print(view_template.replace('$VIEW_NAME$', args.name)) \ No newline at end of file diff --git a/src/muda/buffer/details/buffer_2d_view.inl b/src/muda/buffer/details/buffer_2d_view.inl index 60158325..ac06d127 100644 --- a/src/muda/buffer/details/buffer_2d_view.inl +++ b/src/muda/buffer/details/buffer_2d_view.inl @@ -42,14 +42,14 @@ MUDA_GENERIC Buffer2DViewT::Buffer2DViewT(auto_const_t* data, } template -MUDA_GENERIC auto Buffer2DViewT::as_const() const MUDA_NOEXCEPT->ConstView +MUDA_GENERIC auto Buffer2DViewT::as_const() const MUDA_NOEXCEPT -> ConstView { return ConstView{*this}; } template -MUDA_GENERIC auto Buffer2DViewT::data(size_t x, - size_t y) const MUDA_NOEXCEPT->auto_const_t* +MUDA_GENERIC auto Buffer2DViewT::data(size_t x, size_t y) const MUDA_NOEXCEPT + -> auto_const_t* { x += m_offset.offset_in_height(); y += m_offset.offset_in_width(); @@ -60,8 +60,8 @@ MUDA_GENERIC auto Buffer2DViewT::data(size_t x, } template -MUDA_GENERIC auto Buffer2DViewT::data(size_t flatten_i) const - MUDA_NOEXCEPT->auto_const_t* +MUDA_GENERIC auto Buffer2DViewT::data(size_t flatten_i) const MUDA_NOEXCEPT + -> auto_const_t* { auto x = flatten_i / m_extent.width(); auto y = flatten_i % m_extent.width(); @@ -69,15 +69,16 @@ MUDA_GENERIC auto Buffer2DViewT::data(size_t flatten_i) const } template -MUDA_GENERIC auto Buffer2DViewT::origin_data() const MUDA_NOEXCEPT->auto_const_t* +MUDA_GENERIC auto Buffer2DViewT::origin_data() const MUDA_NOEXCEPT + -> auto_const_t* { return m_data; } template -MUDA_GENERIC auto Buffer2DViewT::subview( - Offset2D offset, Extent2D extent) const MUDA_NOEXCEPT->ThisView +MUDA_GENERIC auto Buffer2DViewT::subview(Offset2D offset, Extent2D extent) const MUDA_NOEXCEPT + -> ThisView { #ifndef __CUDA_ARCH__ if(ComputeGraphBuilder::is_topo_building()) @@ -97,7 +98,7 @@ MUDA_GENERIC auto Buffer2DViewT::subview( } template -MUDA_GENERIC auto Buffer2DViewT::viewer() const MUDA_NOEXCEPT->ThisViewer +MUDA_GENERIC auto Buffer2DViewT::viewer() const MUDA_NOEXCEPT -> ThisViewer { return ThisViewer{m_data, make_int2((int)m_offset.offset_in_height(), @@ -109,37 +110,38 @@ MUDA_GENERIC auto Buffer2DViewT::viewer() const MUDA_NOEXCEPT->ThisV template MUDA_GENERIC cudaPitchedPtr Buffer2DViewT::cuda_pitched_ptr() const MUDA_NOEXCEPT { - return make_cudaPitchedPtr(remove_const(m_data), - remove_const(m_pitch_bytes), - m_origin_width * sizeof(T), - m_origin_height); + // don't use make_cudaPitchedPtr (__host__ only function) + return cudaPitchedPtr{.ptr = remove_const(m_data), + .pitch = remove_const(m_pitch_bytes), + .xsize = m_origin_width * sizeof(T), + .ysize = m_origin_height}; } template -MUDA_GENERIC auto Buffer2DViewT::extent() const MUDA_NOEXCEPT->Extent2D +MUDA_GENERIC auto Buffer2DViewT::extent() const MUDA_NOEXCEPT -> Extent2D { return m_extent; } template -MUDA_GENERIC auto Buffer2DViewT::pitch_bytes() const MUDA_NOEXCEPT->size_t +MUDA_GENERIC auto Buffer2DViewT::pitch_bytes() const MUDA_NOEXCEPT -> size_t { return m_pitch_bytes; } template -MUDA_GENERIC auto Buffer2DViewT::offset() const MUDA_NOEXCEPT->Offset2D +MUDA_GENERIC auto Buffer2DViewT::offset() const MUDA_NOEXCEPT -> Offset2D { return m_offset; } template -MUDA_GENERIC auto Buffer2DViewT::total_size() const MUDA_NOEXCEPT->size_t +MUDA_GENERIC auto Buffer2DViewT::total_size() const MUDA_NOEXCEPT -> size_t { return m_extent.width() * m_extent.height(); } template -MUDA_GENERIC auto Buffer2DViewT::cviewer() const MUDA_NOEXCEPT->CViewer +MUDA_GENERIC auto Buffer2DViewT::cviewer() const MUDA_NOEXCEPT -> CViewer { return viewer(); } @@ -153,14 +155,14 @@ MUDA_HOST void Buffer2DViewT::copy_to(T* host) const template MUDA_HOST void Buffer2DViewT::fill(const T& val) MUDA_REQUIRES(!IsConst) { - BufferLaunch().template fill(*this, val).wait(); + BufferLaunch().template fill(*this, val); } template MUDA_HOST void Buffer2DViewT::copy_from(const Buffer2DViewT& other) MUDA_REQUIRES(!IsConst) { - BufferLaunch().template copy(*this, other).wait(); + BufferLaunch().template copy(*this, other); } template diff --git a/src/muda/buffer/details/buffer_3d_view.inl b/src/muda/buffer/details/buffer_3d_view.inl index 34bc9306..32931666 100644 --- a/src/muda/buffer/details/buffer_3d_view.inl +++ b/src/muda/buffer/details/buffer_3d_view.inl @@ -45,14 +45,14 @@ MUDA_GENERIC Buffer3DViewT::Buffer3DViewT(T* data, } template -MUDA_GENERIC auto Buffer3DViewT::as_const() const MUDA_NOEXCEPT->ConstView +MUDA_GENERIC auto Buffer3DViewT::as_const() const MUDA_NOEXCEPT -> ConstView { return ConstView{*this}; } template -MUDA_GENERIC auto Buffer3DViewT::data(size_t x, size_t y, size_t z) const - MUDA_NOEXCEPT->auto_const_t* +MUDA_GENERIC auto Buffer3DViewT::data(size_t x, size_t y, size_t z) const MUDA_NOEXCEPT + -> auto_const_t* { x += m_offset.offset_in_depth(); y += m_offset.offset_in_height(); @@ -64,8 +64,8 @@ MUDA_GENERIC auto Buffer3DViewT::data(size_t x, size_t y, size_t z) } template -MUDA_GENERIC auto Buffer3DViewT::data(size_t flatten_i) const - MUDA_NOEXCEPT->auto_const_t* +MUDA_GENERIC auto Buffer3DViewT::data(size_t flatten_i) const MUDA_NOEXCEPT + -> auto_const_t* { auto area = m_extent.width() * m_extent.height(); auto x = flatten_i / area; @@ -77,44 +77,45 @@ MUDA_GENERIC auto Buffer3DViewT::data(size_t flatten_i) const } template -MUDA_GENERIC auto Buffer3DViewT::origin_data() const MUDA_NOEXCEPT->auto_const_t* +MUDA_GENERIC auto Buffer3DViewT::origin_data() const MUDA_NOEXCEPT + -> auto_const_t* { return m_data; } template -MUDA_GENERIC auto Buffer3DViewT::extent() const MUDA_NOEXCEPT->Extent3D +MUDA_GENERIC auto Buffer3DViewT::extent() const MUDA_NOEXCEPT -> Extent3D { return m_extent; } template -MUDA_GENERIC auto Buffer3DViewT::offset() const MUDA_NOEXCEPT->Offset3D +MUDA_GENERIC auto Buffer3DViewT::offset() const MUDA_NOEXCEPT -> Offset3D { return m_offset; } template -MUDA_GENERIC auto Buffer3DViewT::pitch_bytes() const MUDA_NOEXCEPT->size_t +MUDA_GENERIC auto Buffer3DViewT::pitch_bytes() const MUDA_NOEXCEPT -> size_t { return m_pitch_bytes; } template -MUDA_GENERIC auto Buffer3DViewT::pitch_bytes_area() const - MUDA_NOEXCEPT->size_t +MUDA_GENERIC auto Buffer3DViewT::pitch_bytes_area() const MUDA_NOEXCEPT -> size_t { return m_pitch_bytes_area; } template -MUDA_GENERIC auto Buffer3DViewT::cuda_pitched_ptr() const - MUDA_NOEXCEPT->cudaPitchedPtr +MUDA_GENERIC auto Buffer3DViewT::cuda_pitched_ptr() const MUDA_NOEXCEPT + -> cudaPitchedPtr { - return make_cudaPitchedPtr(remove_const(m_data), - remove_const(m_pitch_bytes), - m_origin_width * sizeof(T), - m_origin_height); + // don't use make_cudaPitchedPtr (__host__ only function) + return cudaPitchedPtr{.ptr = remove_const(m_data), + .pitch = remove_const(m_pitch_bytes), + .xsize = m_origin_width * sizeof(T), + .ysize = m_origin_height}; } template @@ -124,8 +125,8 @@ MUDA_GENERIC size_t Buffer3DViewT::total_size() const MUDA_NOEXCEPT } template -MUDA_GENERIC auto Buffer3DViewT::subview( - Offset3D offset, Extent3D extent) const MUDA_NOEXCEPT->ThisView +MUDA_GENERIC auto Buffer3DViewT::subview(Offset3D offset, Extent3D extent) const MUDA_NOEXCEPT + -> ThisView { #ifndef __CUDA_ARCH__ if(ComputeGraphBuilder::is_topo_building()) @@ -147,7 +148,7 @@ MUDA_GENERIC auto Buffer3DViewT::subview( } template -MUDA_GENERIC auto Buffer3DViewT::viewer() const MUDA_NOEXCEPT->ThisViewer +MUDA_GENERIC auto Buffer3DViewT::viewer() const MUDA_NOEXCEPT -> ThisViewer { return ThisViewer{m_data, make_int3(m_offset.offset_in_depth(), @@ -159,7 +160,7 @@ MUDA_GENERIC auto Buffer3DViewT::viewer() const MUDA_NOEXCEPT->ThisV } template -MUDA_GENERIC auto Buffer3DViewT::cviewer() const MUDA_NOEXCEPT->CViewer +MUDA_GENERIC auto Buffer3DViewT::cviewer() const MUDA_NOEXCEPT -> CViewer { return viewer(); } @@ -168,7 +169,7 @@ template MUDA_HOST void Buffer3DViewT::fill(const T& v) const MUDA_REQUIRES(!IsConst) { static_assert(!IsConst, "This must be non-const buffer."); - BufferLaunch().template fill(*this, v).wait(); + BufferLaunch().template fill(*this, v); } template @@ -176,7 +177,7 @@ MUDA_HOST void Buffer3DViewT::copy_from(const Buffer3DViewT MUDA_REQUIRES(!IsConst) { static_assert(!IsConst, "This must be non-const buffer."); - BufferLaunch().template copy(*this, other).wait(); + BufferLaunch().template copy(*this, other); } template diff --git a/src/muda/buffer/details/buffer_view.inl b/src/muda/buffer/details/buffer_view.inl index 9b250bb8..57b5cb0a 100644 --- a/src/muda/buffer/details/buffer_view.inl +++ b/src/muda/buffer/details/buffer_view.inl @@ -31,41 +31,45 @@ MUDA_GENERIC BufferViewT::BufferViewT(const BufferViewT -MUDA_GENERIC auto BufferViewT::as_const() const MUDA_NOEXCEPT->ConstView +MUDA_GENERIC auto BufferViewT::as_const() const MUDA_NOEXCEPT -> ConstView { return ConstView{*this}; } template -MUDA_GENERIC auto BufferViewT::data() const MUDA_NOEXCEPT->auto_const_t* +MUDA_GENERIC auto BufferViewT::data() const MUDA_NOEXCEPT + -> auto_const_t* { return m_data + m_offset; } template -MUDA_GENERIC auto BufferViewT::data(size_t i) const MUDA_NOEXCEPT->auto_const_t* +MUDA_GENERIC auto BufferViewT::data(size_t i) const MUDA_NOEXCEPT + -> auto_const_t* { i += m_offset; return m_data + i; } template -MUDA_GENERIC auto BufferViewT::origin_data() const MUDA_NOEXCEPT->auto_const_t* +MUDA_GENERIC auto BufferViewT::origin_data() const MUDA_NOEXCEPT + -> auto_const_t* { return m_data; } template -MUDA_GENERIC auto BufferViewT::operator[](size_t i) const - MUDA_NOEXCEPT->auto_const_t& +MUDA_GENERIC auto BufferViewT::operator[](size_t i) const MUDA_NOEXCEPT + -> auto_const_t& { return *data(i); } template -MUDA_GENERIC auto BufferViewT::subview(size_t offset, size_t size) const - MUDA_NOEXCEPT->ThisView +MUDA_GENERIC auto BufferViewT::subview(size_t offset, size_t size) const MUDA_NOEXCEPT + -> ThisView { #ifndef __CUDA_ARCH__ if(ComputeGraphBuilder::is_topo_building()) @@ -81,13 +85,13 @@ MUDA_GENERIC auto BufferViewT::subview(size_t offset, size_t size) c } template -MUDA_GENERIC auto BufferViewT::viewer() const MUDA_NOEXCEPT->ThisViewer +MUDA_GENERIC auto BufferViewT::viewer() const MUDA_NOEXCEPT -> ThisViewer { return ThisViewer{data(), static_cast(m_size)}; } template -MUDA_GENERIC auto BufferViewT::cviewer() const MUDA_NOEXCEPT->CViewer +MUDA_GENERIC auto BufferViewT::cviewer() const MUDA_NOEXCEPT -> CViewer { return CViewer{data(), static_cast(m_size)}; } @@ -97,9 +101,7 @@ MUDA_HOST void BufferViewT::fill(const T& v) const MUDA_REQUIRES(!Is { static_assert(!IsConst, "This must be non-const"); - BufferLaunch() - .template fill(*this, v) // - .wait(); + BufferLaunch().template fill(*this, v); } template @@ -108,9 +110,7 @@ MUDA_HOST void BufferViewT::copy_from(const BufferViewT& ot { static_assert(!IsConst, "This must be non-const"); - BufferLaunch() - .template copy(*this, other) // - .wait(); + BufferLaunch().template copy(*this, other); } template @@ -133,19 +133,20 @@ MUDA_HOST void BufferViewT::copy_to(T* host) const } template -MUDA_GENERIC auto BufferViewT::operator+(int i) const MUDA_NOEXCEPT->ThisView +MUDA_GENERIC auto BufferViewT::operator+(int i) const MUDA_NOEXCEPT -> ThisView { return ThisView{m_data, m_offset + i, m_size - i}; } template -MUDA_GENERIC auto BufferViewT::operator*() const MUDA_NOEXCEPT->reference +MUDA_GENERIC auto BufferViewT::operator*() const MUDA_NOEXCEPT -> reference { return *data(0); } template -MUDA_GENERIC auto BufferViewT::operator[](int i) const MUDA_NOEXCEPT->auto_const_t& +MUDA_GENERIC auto BufferViewT::operator[](int i) const MUDA_NOEXCEPT + -> auto_const_t& { return *data(i); } diff --git a/src/muda/buffer/details/device_buffer.inl b/src/muda/buffer/details/device_buffer.inl index f57886ac..34b8256e 100644 --- a/src/muda/buffer/details/device_buffer.inl +++ b/src/muda/buffer/details/device_buffer.inl @@ -6,9 +6,7 @@ namespace muda template DeviceBuffer::DeviceBuffer(size_t n) { - BufferLaunch() - .alloc(*this, n) // - .wait(); + BufferLaunch().alloc(*this, n); } template @@ -24,8 +22,7 @@ DeviceBuffer::DeviceBuffer(const DeviceBuffer& other) { BufferLaunch() .alloc(*this, other.size()) // - .copy(view(), other.view()) // - .wait(); + .copy(view(), other.view()); } template @@ -47,8 +44,7 @@ DeviceBuffer& DeviceBuffer::operator=(const DeviceBuffer& other) BufferLaunch() .resize(*this, other.size()) // - .copy(view(), other.view()) // - .wait(); + .copy(view(), other.view()); return *this; } @@ -61,9 +57,7 @@ DeviceBuffer& DeviceBuffer::operator=(DeviceBuffer&& other) if(m_data) { - BufferLaunch() - .free(*this) // - .wait(); + BufferLaunch().free(*this); } m_data = other.m_data; @@ -82,8 +76,7 @@ DeviceBuffer::DeviceBuffer(CBufferView other) { BufferLaunch() .alloc(*this, other.size()) // - .copy(view(), other) // - .wait(); + .copy(view(), other); } template @@ -100,8 +93,7 @@ DeviceBuffer& DeviceBuffer::operator=(CBufferView other) { BufferLaunch() .resize(*this, other.size()) // - .copy(view(), other) // - .wait(); + .copy(view(), other); return *this; } @@ -134,41 +126,31 @@ void DeviceBuffer::copy_from(const std::vector& host) template void DeviceBuffer::resize(size_t new_size) { - BufferLaunch() - .resize(*this, new_size) // - .wait(); + BufferLaunch().resize(*this, new_size); } template void DeviceBuffer::resize(size_t new_size, const value_type& value) { - BufferLaunch() - .resize(*this, new_size, value) // - .wait(); + BufferLaunch().resize(*this, new_size, value); } template void DeviceBuffer::reserve(size_t new_capacity) { - BufferLaunch() - .reserve(*this, new_capacity) // - .wait(); + BufferLaunch().reserve(*this, new_capacity); } template void DeviceBuffer::clear() { - BufferLaunch() - .clear(*this) // - .wait(); + BufferLaunch().clear(*this); } template void DeviceBuffer::shrink_to_fit() { - BufferLaunch() - .shrink_to_fit(*this) // - .wait(); + BufferLaunch().shrink_to_fit(*this); } template @@ -218,9 +200,7 @@ DeviceBuffer::~DeviceBuffer() { if(m_data) { - BufferLaunch() - .free(*this) // - .wait(); + BufferLaunch().free(*this); } } } // namespace muda \ No newline at end of file diff --git a/src/muda/buffer/details/device_buffer_2d.inl b/src/muda/buffer/details/device_buffer_2d.inl index 12cad8de..fdce8d18 100644 --- a/src/muda/buffer/details/device_buffer_2d.inl +++ b/src/muda/buffer/details/device_buffer_2d.inl @@ -5,9 +5,7 @@ namespace muda template DeviceBuffer2D::DeviceBuffer2D(const Extent2D& n) { - BufferLaunch() - .resize(*this, n) // - .wait(); + BufferLaunch().resize(*this, n); } template @@ -24,8 +22,7 @@ DeviceBuffer2D::DeviceBuffer2D(const DeviceBuffer2D& other) { BufferLaunch() .resize(*this, other.extent()) // - .copy(view(), other.view()) // - .wait(); + .copy(view(), other.view()); } template @@ -49,8 +46,7 @@ DeviceBuffer2D& DeviceBuffer2D::operator=(const DeviceBuffer2D& other) BufferLaunch() .resize(*this, other.extent()) // - .copy(view(), other.view()) // - .wait(); + .copy(view(), other.view()); return *this; } @@ -62,7 +58,7 @@ DeviceBuffer2D& DeviceBuffer2D::operator=(DeviceBuffer2D&& other) return *this; if(m_data) - BufferLaunch().free(*this).wait(); + BufferLaunch().free(*this); m_data = other.m_data; m_pitch_bytes = other.m_pitch_bytes; @@ -82,8 +78,7 @@ DeviceBuffer2D::DeviceBuffer2D(CBuffer2DView other) { BufferLaunch() .alloc(*this, other.extent()) // - .copy(view(), other) // - .wait(); + .copy(view(), other); } template @@ -91,8 +86,7 @@ DeviceBuffer2D& DeviceBuffer2D::operator=(CBuffer2DView other) { BufferLaunch() .resize(*this, other.extent()) // - .copy(view(), other) // - .wait(); + .copy(view(), other); return *this; } @@ -122,49 +116,43 @@ void DeviceBuffer2D::copy_from(const std::vector& host) template void DeviceBuffer2D::resize(Extent2D new_extent) { - BufferLaunch() - .resize(*this, new_extent) // - .wait(); + BufferLaunch().resize(*this, new_extent); } template void DeviceBuffer2D::resize(Extent2D new_extent, const T& value) { - BufferLaunch() - .resize(*this, new_extent, value) // - .wait(); + BufferLaunch().resize(*this, new_extent, value); } template void DeviceBuffer2D::reserve(Extent2D new_capacity) { - BufferLaunch() - .reserve(*this, new_capacity) // - .wait(); + BufferLaunch().reserve(*this, new_capacity); } template void DeviceBuffer2D::clear() { - BufferLaunch().clear(*this).wait(); + BufferLaunch().clear(*this); } template void DeviceBuffer2D::shrink_to_fit() { - BufferLaunch().shrink_to_fit(*this).wait(); + BufferLaunch().shrink_to_fit(*this); } template void DeviceBuffer2D::fill(const T& v) { - BufferLaunch().fill(view(), v).wait(); + BufferLaunch().fill(view(), v); } template DeviceBuffer2D::~DeviceBuffer2D() { if(m_data) - BufferLaunch().free(*this).wait(); + BufferLaunch().free(*this); } } // namespace muda \ No newline at end of file diff --git a/src/muda/buffer/details/device_buffer_3d.inl b/src/muda/buffer/details/device_buffer_3d.inl index 11763684..3dd26602 100644 --- a/src/muda/buffer/details/device_buffer_3d.inl +++ b/src/muda/buffer/details/device_buffer_3d.inl @@ -5,9 +5,7 @@ namespace muda template DeviceBuffer3D::DeviceBuffer3D(const Extent3D& n) { - BufferLaunch() - .resize(*this, n) // - .wait(); + BufferLaunch().resize(*this, n); } template @@ -25,8 +23,7 @@ DeviceBuffer3D::DeviceBuffer3D(const DeviceBuffer3D& other) { BufferLaunch() .resize(*this, other.extent()) // - .copy(view(), other.view()) // - .wait(); + .copy(view(), other.view()); } template @@ -52,8 +49,7 @@ DeviceBuffer3D& DeviceBuffer3D::operator=(const DeviceBuffer3D& other) BufferLaunch() .resize(*this, other.extent()) // - .copy(view(), other.view()) // - .wait(); + .copy(view(), other.view()); return *this; } @@ -87,8 +83,7 @@ DeviceBuffer3D::DeviceBuffer3D(CBuffer3DView other) { BufferLaunch() .alloc(*this, other.extent()) // - .copy(view(), other) // - .wait(); + .copy(view(), other); } template @@ -96,8 +91,7 @@ DeviceBuffer3D& DeviceBuffer3D::operator=(CBuffer3DView other) { BufferLaunch() .resize(*this, other.extent()) // - .copy(view(), other) // - .wait(); + .copy(view(), other); return *this; } @@ -125,49 +119,43 @@ void DeviceBuffer3D::copy_from(const std::vector& host) template void DeviceBuffer3D::resize(Extent3D new_extent) { - BufferLaunch() - .resize(*this, new_extent) // - .wait(); + BufferLaunch().resize(*this, new_extent); } template void DeviceBuffer3D::resize(Extent3D new_extent, const T& value) { - BufferLaunch() - .resize(*this, new_extent, value) // - .wait(); + BufferLaunch().resize(*this, new_extent, value); } template void DeviceBuffer3D::reserve(Extent3D new_capacity) { - BufferLaunch() - .reserve(*this, new_capacity) // - .wait(); + BufferLaunch().reserve(*this, new_capacity); } template void DeviceBuffer3D::clear() { - BufferLaunch().clear(*this).wait(); + BufferLaunch().clear(*this); } template void DeviceBuffer3D::shrink_to_fit() { - BufferLaunch().shrink_to_fit(*this).wait(); + BufferLaunch().shrink_to_fit(*this); } template void DeviceBuffer3D::fill(const T& v) { - BufferLaunch().fill(view(), v).wait(); + BufferLaunch().fill(view(), v); } template DeviceBuffer3D::~DeviceBuffer3D() { if(m_data) - BufferLaunch().free(*this).wait(); + BufferLaunch().free(*this); } } // namespace muda \ No newline at end of file diff --git a/src/muda/container/var.h b/src/muda/container/var.h index 08ad57a6..43d078d3 100644 --- a/src/muda/container/var.h +++ b/src/muda/container/var.h @@ -1,88 +1,2 @@ #pragma once -//#include -//#include -//#include -// -//#include -//#include -//#include -//#include -//#include -//#include -// -//namespace muda -//{ -//namespace details -//{ -// template -// class VarBase -// { -// public: -// //using T = int; -// //using Allocator = thrust::device_allocator; -// using pointer = typename Allocator::pointer; -// using const_pointer = typename Allocator::const_pointer; -// -// VarBase() MUDA_NOEXCEPT : m_data(Allocator().allocate(1)) {} -// -// VarBase(const T& value) MUDA_NOEXCEPT : m_data(Allocator().allocate(1)) -// { -// this->operator=(value); -// } -// -// ~VarBase() MUDA_NOEXCEPT { Allocator().deallocate(m_data, 1); } -// -// pointer data() { return m_data; } -// const_pointer data() const { return m_data; } -// -// // copy value from host to device -// VarBase& operator=(const T& rhs) -// { -// thrust::fill_n(data(), 1, rhs); -// return *this; -// } -// -// // copy value from device to host -// operator T() -// { -// T t; -// thrust::copy_n(data(), 1, &t); -// return t; -// } -// -// private: -// pointer m_data; -// }; -//} // namespace details -// -//template -//class DeviceVar : public details::VarBase> -//{ -// public: -// using Base = details::VarBase>; -// using Base::Base; -// using Base::operator=; -// -// const T* data() const { return thrust::raw_pointer_cast(Base::data()); } -// T* data() { return thrust::raw_pointer_cast(Base::data()); } -// -// DeviceVar& operator=(DeviceVar other) -// { -// view().copy_from(other.view()); -// return *this; -// } -// -// DeviceVar& operator=(VarView other) -// { -// view().copy_from(other); -// return *this; -// } -// -// auto viewer() { return Dense(this->data()); } -// auto cviewer() const { return CDense(this->data()); } -// auto view() const { return VarView{m_data}; } -// operator VarView() { return view(); } -//}; -//} // namespace muda - #include \ No newline at end of file diff --git a/src/muda/ext/eigen/svd/svd_impl.h b/src/muda/ext/eigen/svd/svd_impl.h index 908a37c6..fe4712c7 100644 --- a/src/muda/ext/eigen/svd/svd_impl.h +++ b/src/muda/ext/eigen/svd/svd_impl.h @@ -44,13 +44,13 @@ __device__ __forceinline__ void svd3x3(float a11, float& v33 // output V ) { - constexpr auto gone = 1065353216; - constexpr auto gsine_pi_over_eight = 1053028117; - constexpr auto gcosine_pi_over_eight = 1064076127; - constexpr float gone_half = 0.5; - constexpr float gsmall_number = 1.e-12; - constexpr float gtiny_number = 1.e-20; - constexpr float gfour_gamma_squared = 5.8284273147583007813; + constexpr auto gone = 1065353216; + constexpr auto gsine_pi_over_eight = 1053028117; + constexpr auto gcosine_pi_over_eight = 1064076127; + // constexpr float gone_half = 0.5; + constexpr float gsmall_number = 1.e-12; + constexpr float gtiny_number = 1.e-20; + constexpr float gfour_gamma_squared = 5.8284273147583007813; un Sa11, Sa21, Sa31, Sa12, Sa22, Sa32, Sa13, Sa23, Sa33; un Su11, Su21, Su31, Su12, Su22, Su32, Su13, Su23, Su33; diff --git a/src/muda/ext/field/details/field_entry_core.inl b/src/muda/ext/field/details/field_entry_core.inl index e7b0a845..67ef8192 100644 --- a/src/muda/ext/field/details/field_entry_core.inl +++ b/src/muda/ext/field/details/field_entry_core.inl @@ -47,10 +47,11 @@ MUDA_INLINE MUDA_GENERIC std::byte* FieldEntryCore::elem_addr(int i) const } else { - static_assert("invalid layout"); + static_assert(always_false_v>, "invalid layout"); } } MUDA_KERNEL_ERROR_WITH_LOCATION("invalid layout: %d", static_cast(layout())); + return nullptr; } @@ -85,7 +86,7 @@ MUDA_INLINE MUDA_GENERIC std::byte* FieldEntryCore::elem_addr(int i, int j) cons } else { - static_assert("invalid layout"); + static_assert(always_false_v>, "invalid layout"); } } MUDA_KERNEL_ERROR_WITH_LOCATION("invalid layout: %d", static_cast(layout())); @@ -125,7 +126,7 @@ MUDA_INLINE MUDA_GENERIC std::byte* FieldEntryCore::elem_addr(int i, int j, int } else { - static_assert("invalid layout"); + static_assert(always_false_v>, "invalid layout"); } } MUDA_KERNEL_ERROR_WITH_LOCATION("invalid layout: %d", static_cast(layout())); diff --git a/src/muda/ext/field/details/field_entry_launch.inl b/src/muda/ext/field/details/field_entry_launch.inl index 094c1d8c..05184fa0 100644 --- a/src/muda/ext/field/details/field_entry_launch.inl +++ b/src/muda/ext/field/details/field_entry_launch.inl @@ -40,7 +40,7 @@ MUDA_HOST FieldEntryLaunch& FieldEntryLaunch::copy( } else { - static_assert("Invalid"); + static_assert(always_false_v, "Invalid"); } }); return *this; @@ -83,7 +83,7 @@ MUDA_HOST FieldEntryLaunch& FieldEntryLaunch::fill( } else { - static_assert("Invalid"); + static_assert(always_false_v, "Invalid"); } }); @@ -131,7 +131,7 @@ MUDA_HOST FieldEntryLaunch& FieldEntryLaunch::copy( } else { - static_assert("Invalid"); + static_assert(always_false_v, "Invalid"); } }); @@ -178,7 +178,7 @@ MUDA_HOST FieldEntryLaunch& FieldEntryLaunch::copy( } else { - static_assert("Invalid"); + static_assert(always_false_v, "Invalid"); } }); diff --git a/src/muda/ext/field/field_entry_view.h b/src/muda/ext/field/field_entry_view.h index 67ed8090..82353a54 100644 --- a/src/muda/ext/field/field_entry_view.h +++ b/src/muda/ext/field/field_entry_view.h @@ -235,7 +235,7 @@ class FieldEntryViewT : public FieldEntryViewCore } else { - static_assert("invalid M, N"); + static_assert(always_false_v, "invalid M, N"); } } }; diff --git a/src/muda/ext/field/field_entry_viewer.h b/src/muda/ext/field/field_entry_viewer.h index 44bf46bb..6a284935 100644 --- a/src/muda/ext/field/field_entry_viewer.h +++ b/src/muda/ext/field/field_entry_viewer.h @@ -217,7 +217,7 @@ class FieldEntryViewerT : public FieldEntryViewerCore } else { - static_assert("invalid M, N"); + static_assert(always_false_v, "invalid M, N"); } } }; diff --git a/src/muda/ext/field/sub_field.h b/src/muda/ext/field/sub_field.h index 81d03de7..a0ea4537 100644 --- a/src/muda/ext/field/sub_field.h +++ b/src/muda/ext/field/sub_field.h @@ -77,7 +77,6 @@ class SubField private: friend class Field; - friend class SubField; template friend class FieldBuilder; friend class FieldEntryBase; diff --git a/src/muda/ext/field/sub_field/details/soa_sub_field.inl b/src/muda/ext/field/sub_field/details/soa_sub_field.inl index ab7cabbe..3315c57a 100644 --- a/src/muda/ext/field/sub_field/details/soa_sub_field.inl +++ b/src/muda/ext/field/sub_field/details/soa_sub_field.inl @@ -65,19 +65,19 @@ MUDA_INLINE void SubFieldImpl::build_impl() MUDA_INLINE size_t SubFieldImpl::require_total_buffer_byte_size(size_t num_elements) { - auto base = m_build_options.max_alignment; - auto old_count_of_base = (m_num_elements + base - 1) / base; + auto base = m_build_options.max_alignment; + // auto old_count_of_base = (m_num_elements + base - 1) / base; auto new_count_of_base = (num_elements + base - 1) / base; - auto rounded_new_count = base * new_count_of_base; - auto total_bytes = m_base_struct_stride * new_count_of_base; + // auto rounded_new_count = base * new_count_of_base; + auto total_bytes = m_base_struct_stride * new_count_of_base; return total_bytes; } MUDA_INLINE void SubFieldImpl::calculate_new_cores( std::byte* byte_buffer, size_t total_bytes, size_t element_count, span new_cores) { - auto base = m_build_options.max_alignment; - auto old_count_of_base = (m_num_elements + base - 1) / base; + auto base = m_build_options.max_alignment; + // auto old_count_of_base = (m_num_elements + base - 1) / base; auto new_count_of_base = (element_count + base - 1) / base; auto rounded_new_count = base * new_count_of_base; diff --git a/src/muda/ext/geo/distance.h b/src/muda/ext/geo/distance.h deleted file mode 100644 index 2ebb4dbe..00000000 --- a/src/muda/ext/geo/distance.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once -/*****************************************************************//** - * \file distance.h - * \brief distance calculation for point/edge/triangle - * - * \author MuGdxy - * \date February 2024 - * \details - * - * All files in directory `./distance/` is referenced from the following repository: - * - * https://github.com/ipc-sim/Codim-IPC/tree/main/Library/Math/Distance - * - * - To make it more readable, logically consistent and GPU compatible, the original code is modified. - * - * - Thanks to the original author for the great work. - * - * - The original code is licensed under the Apache License, Version 2.0. - *********************************************************************/ - -#include -#include diff --git a/src/muda/ext/geo/distance/ccd.h b/src/muda/ext/geo/distance/ccd.h deleted file mode 100644 index c1826dec..00000000 --- a/src/muda/ext/geo/distance/ccd.h +++ /dev/null @@ -1,135 +0,0 @@ -#pragma once -#include -#include -#include -#include - -//ref: https://github.com/ipc-sim/Codim-IPC/tree/main/Library/Math/Distance -namespace muda::distance -{ -template -MUDA_GENERIC bool point_edge_cd_broadphase(const Eigen::Matrix& x0, - const Eigen::Matrix& x1, - const Eigen::Matrix& x2, - T dist); - -template -MUDA_GENERIC bool point_edge_ccd_broadphase(const Eigen::Matrix& p, - const Eigen::Matrix& e0, - const Eigen::Matrix& e1, - const Eigen::Matrix& dp, - const Eigen::Matrix& de0, - const Eigen::Matrix& de1, - T dist); - -template -MUDA_GENERIC bool point_triangle_cd_broadphase(const Eigen::Matrix& p, - const Eigen::Matrix& t0, - const Eigen::Matrix& t1, - const Eigen::Matrix& t2, - T dist); -template -MUDA_GENERIC bool edge_edge_cd_broadphase(const Eigen::Matrix& ea0, - const Eigen::Matrix& ea1, - const Eigen::Matrix& eb0, - const Eigen::Matrix& eb1, - T dist); - -template -MUDA_GENERIC bool point_triangle_ccd_broadphase(const Eigen::Matrix& p, - const Eigen::Matrix& t0, - const Eigen::Matrix& t1, - const Eigen::Matrix& t2, - const Eigen::Matrix& dp, - const Eigen::Matrix& dt0, - const Eigen::Matrix& dt1, - const Eigen::Matrix& dt2, - T dist); - -template -MUDA_GENERIC bool edge_edge_ccd_broadphase(const Eigen::Matrix& ea0, - const Eigen::Matrix& ea1, - const Eigen::Matrix& eb0, - const Eigen::Matrix& eb1, - const Eigen::Matrix& dea0, - const Eigen::Matrix& dea1, - const Eigen::Matrix& deb0, - const Eigen::Matrix& deb1, - T dist); - -template -MUDA_GENERIC bool point_edge_ccd_broadphase(const Eigen::Matrix& p, - const Eigen::Matrix& e0, - const Eigen::Matrix& e1, - const Eigen::Matrix& dp, - const Eigen::Matrix& de0, - const Eigen::Matrix& de1, - T dist); -template -MUDA_GENERIC bool point_point_ccd_broadphase(const Eigen::Matrix& p0, - const Eigen::Matrix& p1, - const Eigen::Matrix& dp0, - const Eigen::Matrix& dp1, - T dist); - -template -MUDA_GENERIC bool point_triangle_ccd(Eigen::Matrix p, - Eigen::Matrix t0, - Eigen::Matrix t1, - Eigen::Matrix t2, - Eigen::Matrix dp, - Eigen::Matrix dt0, - Eigen::Matrix dt1, - Eigen::Matrix dt2, - T eta, - T thickness, - int max_iter, - T& toc); - -template -MUDA_GENERIC bool edge_edge_ccd(Eigen::Matrix ea0, - Eigen::Matrix ea1, - Eigen::Matrix eb0, - Eigen::Matrix eb1, - Eigen::Matrix dea0, - Eigen::Matrix dea1, - Eigen::Matrix deb0, - Eigen::Matrix deb1, - T eta, - T thickness, - int max_iter, - T& toc); - -template -MUDA_GENERIC bool point_edge_ccd(const Eigen::Matrix& x0, - const Eigen::Matrix& x1, - const Eigen::Matrix& x2, - const Eigen::Matrix& d0, - const Eigen::Matrix& d1, - const Eigen::Matrix& d2, - T eta, - T& toc); - -template -MUDA_GENERIC bool point_edge_ccd(Eigen::Matrix p, - Eigen::Matrix e0, - Eigen::Matrix e1, - Eigen::Matrix dp, - Eigen::Matrix de0, - Eigen::Matrix de1, - T eta, - T thickness, - int max_iter, - T& toc); -template -MUDA_GENERIC bool point_point_ccd(Eigen::Matrix p0, - Eigen::Matrix p1, - Eigen::Matrix dp0, - Eigen::Matrix dp1, - T eta, - T thickness, - int max_iter, - T& toc); -} // namespace muda - -#include "details/ccd.inl" diff --git a/src/muda/ext/geo/distance/details/ccd.inl b/src/muda/ext/geo/distance/details/ccd.inl deleted file mode 100644 index c158eac3..00000000 --- a/src/muda/ext/geo/distance/details/ccd.inl +++ /dev/null @@ -1,584 +0,0 @@ -//ref: https://github.com/ipc-sim/Codim-IPC/tree/main/Library/Math/Distance -#include -#include -namespace muda::distance -{ -template -MUDA_GENERIC bool point_edge_cd_broadphase(const Eigen::Matrix& x0, - const Eigen::Matrix& x1, - const Eigen::Matrix& x2, - T dist) -{ - const Eigen::Array max_e = x1.array().max(x2.array()); - const Eigen::Array min_e = x1.array().min(x2.array()); - if((x0.array() - max_e > dist).any() || (min_e - x0.array() > dist).any()) - { - return false; - } - else - { - return true; - } -} - -template -MUDA_GENERIC bool point_edge_ccd_broadphase(const Eigen::Matrix& p, - const Eigen::Matrix& e0, - const Eigen::Matrix& e1, - const Eigen::Matrix& dp, - const Eigen::Matrix& de0, - const Eigen::Matrix& de1, - T dist) -{ - const Eigen::Array max_p = p.array().max((p + dp).array()); - const Eigen::Array min_p = p.array().min((p + dp).array()); - const Eigen::Array max_e = - e0.array().max(e1.array()).max((e0 + de0).array()).max((e1 + de1).array()); - const Eigen::Array min_e = - e0.array().min(e1.array()).min((e0 + de0).array()).min((e1 + de1).array()); - if((min_p - max_e > dist).any() || (min_e - max_p > dist).any()) - { - return false; - } - else - { - return true; - } -} - -template -MUDA_GENERIC bool point_triangle_cd_broadphase(const Eigen::Matrix& p, - const Eigen::Matrix& t0, - const Eigen::Matrix& t1, - const Eigen::Matrix& t2, - T dist) -{ - const Eigen::Array max_tri = t0.array().max(t1.array()).max(t2.array()); - const Eigen::Array min_tri = t0.array().min(t1.array()).min(t2.array()); - if((p.array() - max_tri > dist).any() || (min_tri - p.array() > dist).any()) - { - return false; - } - else - { - return true; - } -} - -template -MUDA_GENERIC bool edge_edge_cd_broadphase(const Eigen::Matrix& ea0, - const Eigen::Matrix& ea1, - const Eigen::Matrix& eb0, - const Eigen::Matrix& eb1, - T dist) -{ - const Eigen::Array max_a = ea0.array().max(ea1.array()); - const Eigen::Array min_a = ea0.array().min(ea1.array()); - const Eigen::Array max_b = eb0.array().max(eb1.array()); - const Eigen::Array min_b = eb0.array().min(eb1.array()); - if((min_a - max_b > dist).any() || (min_b - max_a > dist).any()) - { - return false; - } - else - { - return true; - } -} - -template -MUDA_GENERIC bool point_triangle_ccd_broadphase(const Eigen::Matrix& p, - const Eigen::Matrix& t0, - const Eigen::Matrix& t1, - const Eigen::Matrix& t2, - const Eigen::Matrix& dp, - const Eigen::Matrix& dt0, - const Eigen::Matrix& dt1, - const Eigen::Matrix& dt2, - T dist) -{ - const Eigen::Array max_p = p.array().max((p + dp).array()); - const Eigen::Array min_p = p.array().min((p + dp).array()); - const Eigen::Array max_tri = t0.array() - .max(t1.array()) - .max(t2.array()) - .max((t0 + dt0).array()) - .max((t1 + dt1).array()) - .max((t2 + dt2).array()); - const Eigen::Array min_tri = t0.array() - .min(t1.array()) - .min(t2.array()) - .min((t0 + dt0).array()) - .min((t1 + dt1).array()) - .min((t2 + dt2).array()); - if((min_p - max_tri > dist).any() || (min_tri - max_p > dist).any()) - { - return false; - } - else - { - return true; - } -} - -template -MUDA_GENERIC bool edge_edge_ccd_broadphase(const Eigen::Matrix& ea0, - const Eigen::Matrix& ea1, - const Eigen::Matrix& eb0, - const Eigen::Matrix& eb1, - const Eigen::Matrix& dea0, - const Eigen::Matrix& dea1, - const Eigen::Matrix& deb0, - const Eigen::Matrix& deb1, - T dist) -{ - const Eigen::Array max_a = - ea0.array().max(ea1.array()).max((ea0 + dea0).array()).max((ea1 + dea1).array()); - const Eigen::Array min_a = - ea0.array().min(ea1.array()).min((ea0 + dea0).array()).min((ea1 + dea1).array()); - const Eigen::Array max_b = - eb0.array().max(eb1.array()).max((eb0 + deb0).array()).max((eb1 + deb1).array()); - const Eigen::Array min_b = - eb0.array().min(eb1.array()).min((eb0 + deb0).array()).min((eb1 + deb1).array()); - if((min_a - max_b > dist).any() || (min_b - max_a > dist).any()) - { - return false; - } - else - { - return true; - } -} - -template -MUDA_GENERIC bool point_edge_ccd_broadphase(const Eigen::Matrix& p, - const Eigen::Matrix& e0, - const Eigen::Matrix& e1, - const Eigen::Matrix& dp, - const Eigen::Matrix& de0, - const Eigen::Matrix& de1, - T dist) -{ - const Eigen::Array max_p = p.array().max((p + dp).array()); - const Eigen::Array min_p = p.array().min((p + dp).array()); - const Eigen::Array max_e = - e0.array().max(e1.array()).max((e0 + de0).array()).max((e1 + de1).array()); - const Eigen::Array min_e = - e0.array().min(e1.array()).min((e0 + de0).array()).min((e1 + de1).array()); - if((min_p - max_e > dist).any() || (min_e - max_p > dist).any()) - { - return false; - } - else - { - return true; - } -} - -template -MUDA_GENERIC bool point_point_ccd_broadphase(const Eigen::Matrix& p0, - const Eigen::Matrix& p1, - const Eigen::Matrix& dp0, - const Eigen::Matrix& dp1, - T dist) -{ - const Eigen::Array max_p0 = p0.array().max((p0 + dp0).array()); - const Eigen::Array min_p0 = p0.array().min((p0 + dp0).array()); - const Eigen::Array max_p1 = p1.array().max((p1 + dp1).array()); - const Eigen::Array min_p1 = p1.array().min((p1 + dp1).array()); - if((min_p0 - max_p1 > dist).any() || (min_p1 - max_p0 > dist).any()) - { - return false; - } - else - { - return true; - } -} - -template -MUDA_GENERIC bool point_triangle_ccd(Eigen::Matrix p, - Eigen::Matrix t0, - Eigen::Matrix t1, - Eigen::Matrix t2, - Eigen::Matrix dp, - Eigen::Matrix dt0, - Eigen::Matrix dt1, - Eigen::Matrix dt2, - T eta, - T thickness, - int max_iter, - T& toc) -{ - Eigen::Matrix mov = (dt0 + dt1 + dt2 + dp) / 4; - dt0 -= mov; - dt1 -= mov; - dt2 -= mov; - dp -= mov; - Eigen::Array3 dispMag2Vec{dt0.squaredNorm(), dt1.squaredNorm(), dt2.squaredNorm()}; - T maxDispMag = dp.norm() + sqrt(dispMag2Vec.maxCoeff()); - - if(maxDispMag <= T(0)) - { - return false; - } - - T dist2_cur; - point_triangle_distance_unclassified(p, t0, t1, t2, dist2_cur); - T dist_cur = sqrt(dist2_cur); - T gap = eta * (dist2_cur - thickness * thickness) / (dist_cur + thickness); - T toc_prev = toc; - toc = 0; - while(true) - { - if(max_iter >= 0) - { - if(--max_iter < 0) - return true; - } - - T tocLowerBound = (1 - eta) * (dist2_cur - thickness * thickness) - / ((dist_cur + thickness) * maxDispMag); - - p += tocLowerBound * dp; - t0 += tocLowerBound * dt0; - t1 += tocLowerBound * dt1; - t2 += tocLowerBound * dt2; - point_triangle_distance_unclassified(p, t0, t1, t2, dist2_cur); - dist_cur = sqrt(dist2_cur); - if(toc && ((dist2_cur - thickness * thickness) / (dist_cur + thickness) < gap)) - { - break; - } - - toc += tocLowerBound; - if(toc > toc_prev) - { - return false; - } - } - - return true; -} - -template -MUDA_GENERIC bool edge_edge_ccd(Eigen::Matrix ea0, - Eigen::Matrix ea1, - Eigen::Matrix eb0, - Eigen::Matrix eb1, - Eigen::Matrix dea0, - Eigen::Matrix dea1, - Eigen::Matrix deb0, - Eigen::Matrix deb1, - T eta, - T thickness, - int max_iter, - T& toc) -{ - Eigen::Matrix mov = (dea0 + dea1 + deb0 + deb1) / 4; - dea0 -= mov; - dea1 -= mov; - deb0 -= mov; - deb1 -= mov; - T maxDispMag = sqrt(std::max(dea0.squaredNorm(), dea1.squaredNorm())) - + sqrt(std::max(deb0.squaredNorm(), deb1.squaredNorm())); - if(maxDispMag == 0) - { - return false; - } - - T dist2_cur; - edge_edge_distance_unclassified(ea0, ea1, eb0, eb1, dist2_cur); - T dFunc = dist2_cur - thickness * thickness; - if(dFunc <= 0) - { - // since we ensured other place that all dist smaller than dHat are positive, - // this must be some far away nearly parallel edges - Eigen::Array4 dists{(ea0 - eb0).squaredNorm(), - (ea0 - eb1).squaredNorm(), - (ea1 - eb0).squaredNorm(), - (ea1 - eb1).squaredNorm()}; - dist2_cur = dists.minCoeff(); - dFunc = dist2_cur - thickness * thickness; - } - T dist_cur = sqrt(dist2_cur); - T gap = eta * dFunc / (dist_cur + thickness); - T toc_prev = toc; - toc = 0; - while(true) - { - if(max_iter >= 0) - { - if(--max_iter < 0) - return true; - } - - T tocLowerBound = (1 - eta) * dFunc / ((dist_cur + thickness) * maxDispMag); - - ea0 += tocLowerBound * dea0; - ea1 += tocLowerBound * dea1; - eb0 += tocLowerBound * deb0; - eb1 += tocLowerBound * deb1; - edge_edge_distance_unclassified(ea0, ea1, eb0, eb1, dist2_cur); - dFunc = dist2_cur - thickness * thickness; - if(dFunc <= 0) - { - // since we ensured other place that all dist smaller than dHat are positive, - // this must be some far away nearly parallel edges - Eigen::Array4 dists{(ea0 - eb0).squaredNorm(), - (ea0 - eb1).squaredNorm(), - (ea1 - eb0).squaredNorm(), - (ea1 - eb1).squaredNorm()}; - dist2_cur = dists.minCoeff(); - dFunc = dist2_cur - thickness * thickness; - } - dist_cur = sqrt(dist2_cur); - if(toc && (dFunc / (dist_cur + thickness) < gap)) - { - break; - } - - toc += tocLowerBound; - if(toc > toc_prev) - { - return false; - } - } - - return true; -} - -template -MUDA_GENERIC bool point_edge_ccd(const Eigen::Matrix& x0, - const Eigen::Matrix& x1, - const Eigen::Matrix& x2, - const Eigen::Matrix& d0, - const Eigen::Matrix& d1, - const Eigen::Matrix& d2, - T eta, - T& toc) -{ - T a = d0[0] * (d2[1] - d1[1]) + d0[1] * (d1[0] - d2[0]) + d2[0] * d1[1] - - d2[1] * d1[0]; - T b = x0[0] * (d2[1] - d1[1]) + d0[0] * (x2[1] - x1[1]) - + d0[1] * (x1[0] - x2[0]) + x0[1] * (d1[0] - d2[0]) + d1[1] * x2[0] - + d2[0] * x1[1] - d1[0] * x2[1] - d2[1] * x1[0]; - T c = x0[0] * (x2[1] - x1[1]) + x0[1] * (x1[0] - x2[0]) + x2[0] * x1[1] - - x2[1] * x1[0]; - - T roots[2]; - int rootAmt = 0; - if(a == 0) - { - if(b == 0) - { - // parallel motion, only need to handle colinear case - if(c == 0) - { - // colinear PP CCD - if((x0 - x1).dot(d0 - d1) < 0) - { - roots[rootAmt] = - sqrt((x0 - x1).squaredNorm() / (d0 - d1).squaredNorm()); - if(roots[rootAmt] > 0 && roots[rootAmt] <= 1) - { - ++rootAmt; - } - } - if((x0 - x2).dot(d0 - d2) < 0) - { - roots[rootAmt] = - sqrt((x0 - x2).squaredNorm() / (d0 - d2).squaredNorm()); - if(roots[rootAmt] > 0 && roots[rootAmt] <= 1) - { - ++rootAmt; - } - } - - if(rootAmt == 2) - { - toc = std::min(roots[0], roots[1]) * (1 - eta); - return true; - } - else if(rootAmt == 1) - { - toc = roots[0] * (1 - eta); - return true; - } - else - { - return false; - } - } - } - else - { - rootAmt = 1; - roots[0] = -c / b; - } - } - else - { - T delta = b * b - 4 * a * c; - if(delta == 0) - { - rootAmt = 1; - roots[0] = -b / (2 * a); - } - else if(delta > 0) - { - rootAmt = 2; - // accurate expression differs in b's sign - if(b > 0) - { - roots[0] = (-b - sqrt(delta)) / (2 * a); - roots[1] = 2 * c / (-b - sqrt(delta)); - } - else - { - roots[0] = 2 * c / (-b + sqrt(delta)); - roots[1] = (-b + sqrt(delta)) / (2 * a); - } - - if(roots[0] > roots[1]) - { - thrust::swap(roots[0], roots[1]); - } - } - } - - for(int i = 0; i < rootAmt; ++i) - { - if(roots[i] > 0 && roots[i] <= 1) - { - // check overlap - T ratio; - if(point_edge_distance_type(Eigen::Matrix(x0 + roots[i] * d0), - Eigen::Matrix(x1 + roots[i] * d1), - Eigen::Matrix(x2 + roots[i] * d2), - ratio) - == PointEdgeDistanceType::PE) - { - toc = roots[i] * (1 - eta); //TODO: distance eta - return true; - } - } - } - - return false; -} - -template -MUDA_GENERIC bool point_edge_ccd(Eigen::Matrix p, - Eigen::Matrix e0, - Eigen::Matrix e1, - Eigen::Matrix dp, - Eigen::Matrix de0, - Eigen::Matrix de1, - T eta, - T thickness, - int max_iter, - T& toc) -{ - Eigen::Matrix mov = (dp + de0 + de1) / 3; - de0 -= mov; - de1 -= mov; - dp -= mov; - T maxDispMag = dp.norm() + sqrt(std::max(de0.squaredNorm(), de1.squaredNorm())); - if(maxDispMag == 0) - { - return false; - } - - T dist2_cur; - point_edge_distance_unclassified(p, e0, e1, dist2_cur); - T dist_cur = sqrt(dist2_cur); - T gap = eta * (dist2_cur - thickness * thickness) / (dist_cur + thickness); - T toc_prev = toc; - toc = 0; - while(true) - { - if(max_iter >= 0) - { - if(--max_iter < 0) - return true; - } - - T tocLowerBound = (1 - eta) * (dist2_cur - thickness * thickness) - / ((dist_cur + thickness) * maxDispMag); - - p += tocLowerBound * dp; - e0 += tocLowerBound * de0; - e1 += tocLowerBound * de1; - point_edge_distance_unclassified(p, e0, e1, dist2_cur); - dist_cur = sqrt(dist2_cur); - if(toc && (dist2_cur - thickness * thickness) / (dist_cur + thickness) < gap) - { - break; - } - - toc += tocLowerBound; - if(toc > toc_prev) - { - return false; - } - } - - return true; -} - -template -MUDA_GENERIC bool point_point_ccd(Eigen::Matrix p0, - Eigen::Matrix p1, - Eigen::Matrix dp0, - Eigen::Matrix dp1, - T eta, - T thickness, - int max_iter, - T& toc) -{ - Eigen::Matrix mov = (dp0 + dp1) / 2; - dp1 -= mov; - dp0 -= mov; - T maxDispMag = dp0.norm() + dp1.norm(); - if(maxDispMag == 0) - { - return false; - } - - T dist2_cur; - point_point_distance(p0, p1, dist2_cur); - T dist_cur = sqrt(dist2_cur); - T gap = eta * (dist2_cur - thickness * thickness) / (dist_cur + thickness); - T toc_prev = toc; - toc = 0; - while(true) - { - if(max_iter >= 0) - { - if(--max_iter < 0) - return true; - } - - T tocLowerBound = (1 - eta) * (dist2_cur - thickness * thickness) - / ((dist_cur + thickness) * maxDispMag); - - p0 += tocLowerBound * dp0; - p1 += tocLowerBound * dp1; - point_point_distance(p0, p1, dist2_cur); - dist_cur = sqrt(dist2_cur); - if(toc && (dist2_cur - thickness * thickness) / (dist_cur + thickness) < gap) - { - break; - } - - toc += tocLowerBound; - if(toc > toc_prev) - { - return false; - } - } - - return true; -} -} // namespace muda::distance \ No newline at end of file diff --git a/src/muda/ext/geo/distance/details/distance_type.inl b/src/muda/ext/geo/distance/details/distance_type.inl deleted file mode 100644 index 38871f93..00000000 --- a/src/muda/ext/geo/distance/details/distance_type.inl +++ /dev/null @@ -1,226 +0,0 @@ -namespace muda::distance -{ -template -MUDA_GENERIC PointPointDistanceType point_point_distance_type( - const Eigen::Vector& p0, const Eigen::Vector& p1) -{ - //return 0 - return PointPointDistanceType::PP; -} - -template -MUDA_GENERIC PointEdgeDistanceType -point_edge_distance_type(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1, - T& ratio) -{ - const Eigen::Vector e = e1 - e0; - ratio = e.dot(p - e0) / e.squaredNorm(); - if(ratio <= 0) - { - // return 0; - return PointEdgeDistanceType::PP_PE0; // PP (p-e0) - } - else if(ratio >= 1) - { - // return 1; - return PointEdgeDistanceType::PP_PE1; // PP (p-e1) - } - else - { - // return 2; - return PointEdgeDistanceType::PE; // PE - } -} - -template -MUDA_GENERIC PointEdgeDistanceType -point_edge_distance_type(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1) -{ - T ratio; - return point_edge_distance_type(p, e0, e1, ratio); -} - -template -MUDA_GENERIC PointTriangleDistanceType -point_triangle_distance_type(const Eigen::Vector& p, - const Eigen::Vector& t0, - const Eigen::Vector& t1, - const Eigen::Vector& t2) -{ - Eigen::Matrix basis; - basis.row(0) = (t1 - t0).transpose(); - basis.row(1) = (t2 - t0).transpose(); - - const Eigen::Vector nVec = basis.row(0).cross(basis.row(1)); - - Eigen::Matrix param; - - basis.row(1) = basis.row(0).cross(nVec); - param.col(0) = (basis * basis.transpose()).inverse() * (basis * (p - t0)); - if(param(0, 0) > 0.0 && param(0, 0) < 1.0 && param(1, 0) >= 0.0) - { - // return 3; - return PointTriangleDistanceType::PE_PT0T1; // PE t0t1 - } - else - { - basis.row(0) = (t2 - t1).transpose(); - - basis.row(1) = basis.row(0).cross(nVec); - - param.col(1) = (basis * basis.transpose()).inverse() * (basis * (p - t1)); - - if(param(0, 1) > 0.0 && param(0, 1) < 1.0 && param(1, 1) >= 0.0) - { - // return 4; - return PointTriangleDistanceType::PE_PT1T2; // PE t1t2 - } - else - { - basis.row(0) = (t0 - t2).transpose(); - - basis.row(1) = basis.row(0).cross(nVec); - param.col(2) = (basis * basis.transpose()).inverse() * (basis * (p - t2)); - if(param(0, 2) > 0.0 && param(0, 2) < 1.0 && param(1, 2) >= 0.0) - { - // return 5 - return PointTriangleDistanceType::PE_PT2T0; // PE t2t0 - } - else - { - if(param(0, 0) <= 0.0 && param(0, 2) >= 1.0) - { - // return 0; - return PointTriangleDistanceType::PP_PT0; // PP t0 - } - else if(param(0, 1) <= 0.0 && param(0, 0) >= 1.0) - { - // return 1; - return PointTriangleDistanceType::PP_PT1; // PP t1 - } - else if(param(0, 2) <= 0.0 && param(0, 1) >= 1.0) - { - // return 2; - return PointTriangleDistanceType::PP_PT2; // PP t2 - } - else - { - // return 6; - return PointTriangleDistanceType::PT; // PT - } - } - } - } -} - -// a more robust implementation of http://geomalgorithms.com/a07-_distance.html -template -MUDA_GENERIC EdgeEdgeDistanceType edge_edge_distance_type(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1) -{ - Eigen::Vector u = ea1 - ea0; - Eigen::Vector v = eb1 - eb0; - Eigen::Vector w = ea0 - eb0; - T a = u.squaredNorm(); // always >= 0 - T b = u.dot(v); - T c = v.squaredNorm(); // always >= 0 - T d = u.dot(w); - T e = v.dot(w); - T D = a * c - b * b; // always >= 0 - T tD = D; // tc = tN / tD, default tD = D >= 0 - T sN, tN; - - EdgeEdgeDistanceType defaultCase = EdgeEdgeDistanceType::EE; // 8 - - // compute the line parameters of the two closest points - sN = (b * e - c * d); - if(sN <= 0.0) - { // sc < 0 => the s=0 edge is visible - tN = e; - tD = c; - // defaultCase = 2; - defaultCase = EdgeEdgeDistanceType::PE_Ea0Eb0Eb1; - } - else if(sN >= D) - { // sc > 1 => the s=1 edge is visible - tN = e + b; - tD = c; - // defaultCase = 5; - defaultCase = EdgeEdgeDistanceType::PE_Ea1Eb0Eb1; - } - else - { - tN = (a * e - b * d); - if(tN > 0.0 && tN < tD - && (u.cross(v).dot(w) == 0.0 || u.cross(v).squaredNorm() < 1.0e-20 * a * c)) - { - // if (tN > 0.0 && tN < tD && (u.cross(v).dot(w) == 0.0 || u.cross(v).squaredNorm() == 0.0)) { - // std::cout << u.cross(v).squaredNorm() / (a * c) << ": " << sN << " " << D << ", " << tN << " " << tD << std::endl; - // avoid coplanar or nearly parallel EE - if(sN < D / 2) - { - tN = e; - tD = c; - // defaultCase = 2; - defaultCase = EdgeEdgeDistanceType::PE_Ea0Eb0Eb1; - } - else - { - tN = e + b; - tD = c; - // defaultCase = 5; - defaultCase = EdgeEdgeDistanceType::PE_Ea1Eb0Eb1; - } - } - // else defaultCase stays as 8 - } - - if(tN <= 0.0) - { // tc < 0 => the t=0 edge is visible - // recompute sc for this edge - if(-d <= 0.0) - { - // return 0; - return EdgeEdgeDistanceType::PP_Ea0Eb0; - } - else if(-d >= a) - { - // return 3; - return EdgeEdgeDistanceType::PP_Ea1Eb0; - } - else - { - // return 6; - return EdgeEdgeDistanceType::PE_Eb0Ea0Ea1; - } - } - else if(tN >= tD) - { // tc > 1 => the t=1 edge is visible - // recompute sc for this edge - if((-d + b) <= 0.0) - { - // return 1; - return EdgeEdgeDistanceType::PP_Ea0Eb1; - } - else if((-d + b) >= a) - { - // return 4; - return EdgeEdgeDistanceType::PP_Ea1Eb1; - } - else - { - // return 7; - return EdgeEdgeDistanceType::PE_Eb1Ea0Ea1; - } - } - - return defaultCase; -} - -} // namespace muda::distance \ No newline at end of file diff --git a/src/muda/ext/geo/distance/details/distance_unclassified.inl b/src/muda/ext/geo/distance/details/distance_unclassified.inl deleted file mode 100644 index 8db868d7..00000000 --- a/src/muda/ext/geo/distance/details/distance_unclassified.inl +++ /dev/null @@ -1,150 +0,0 @@ -namespace muda::distance -{ -template -MUDA_GENERIC void point_point_distance_unclassified(const Eigen::Vector& p0, - const Eigen::Vector& p1, - T& dist2) -{ - return point_point_distance(p0, p1, dist2); -} - -template -MUDA_GENERIC void point_triangle_distance_unclassified(const Eigen::Vector& p, - const Eigen::Vector& t0, - const Eigen::Vector& t1, - const Eigen::Vector& t2, - T& dist2) -{ - switch(point_triangle_distance_type(p, t0, t1, t2)) - { - case PointTriangleDistanceType::PP_PT0: { - point_point_distance(p, t0, dist2); - break; - } - - case PointTriangleDistanceType::PP_PT1: { - point_point_distance(p, t1, dist2); - break; - } - - case PointTriangleDistanceType::PP_PT2: { - point_point_distance(p, t2, dist2); - break; - } - - case PointTriangleDistanceType::PE_PT0T1: { - point_edge_distance(p, t0, t1, dist2); - break; - } - - case PointTriangleDistanceType::PE_PT1T2: { - point_edge_distance(p, t1, t2, dist2); - break; - } - - case PointTriangleDistanceType::PE_PT2T0: { - point_edge_distance(p, t2, t0, dist2); - break; - } - - case PointTriangleDistanceType::PT: { - point_triangle_distance(p, t0, t1, t2, dist2); - break; - } - - default: - MUDA_KERNEL_ERROR_WITH_LOCATION("invalid type"); - break; - } -} - -template -MUDA_GENERIC void edge_edge_distance_unclassified(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - T& dist2) -{ - switch(edge_edge_distance_type(ea0, ea1, eb0, eb1)) - { - case EdgeEdgeDistanceType::PP_Ea0Eb0: { - point_point_distance(ea0, eb0, dist2); - break; - } - - case EdgeEdgeDistanceType::PP_Ea0Eb1: { - point_point_distance(ea0, eb1, dist2); - break; - } - - case EdgeEdgeDistanceType::PE_Ea0Eb0Eb1: { - point_edge_distance(ea0, eb0, eb1, dist2); - break; - } - - case EdgeEdgeDistanceType::PP_Ea1Eb0: { - point_point_distance(ea1, eb0, dist2); - break; - } - - case EdgeEdgeDistanceType::PP_Ea1Eb1: { - point_point_distance(ea1, eb1, dist2); - break; - } - - case EdgeEdgeDistanceType::PE_Ea1Eb0Eb1: { - point_edge_distance(ea1, eb0, eb1, dist2); - break; - } - - case EdgeEdgeDistanceType::PE_Eb0Ea0Ea1: { - point_edge_distance(eb0, ea0, ea1, dist2); - break; - } - - case EdgeEdgeDistanceType::PE_Eb1Ea0Ea1: { - point_edge_distance(eb1, ea0, ea1, dist2); - break; - } - - case EdgeEdgeDistanceType::EE: { - edge_edge_distance(ea0, ea1, eb0, eb1, dist2); - break; - } - - default: - MUDA_KERNEL_ERROR_WITH_LOCATION("invalid type"); - break; - } -} - -// http://geomalgorithms.com/a02-_lines.html -template -MUDA_GENERIC void point_edge_distance_unclassified(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1, - T& dist2) -{ - switch(point_edge_distance_type(p, e0, e1)) - { - case PointEdgeDistanceType::PP_PE0: { - point_point_distance(p, e0, dist2); - break; - } - - case PointEdgeDistanceType::PP_PE1: { - point_point_distance(p, e1, dist2); - break; - } - - case PointEdgeDistanceType::PE: { - point_edge_distance(p, e0, e1, dist2); - break; - } - default: - MUDA_KERNEL_ERROR_WITH_LOCATION("invalid type"); - break; - } -} - -} // namespace muda::distance \ No newline at end of file diff --git a/src/muda/ext/geo/distance/details/edge_edge.inl b/src/muda/ext/geo/distance/details/edge_edge.inl deleted file mode 100644 index 1bd987c9..00000000 --- a/src/muda/ext/geo/distance/details/edge_edge.inl +++ /dev/null @@ -1,761 +0,0 @@ -namespace muda::distance::details -{ -template -MUDA_GENERIC void g_EE( - T v01, T v02, T v03, T v11, T v12, T v13, T v21, T v22, T v23, T v31, T v32, T v33, T g[12]) -{ - T t11; - T t12; - T t13; - T t14; - T t15; - T t16; - T t17; - T t18; - T t19; - T t32; - T t33; - T t34; - T t35; - T t36; - T t37; - T t44; - T t45; - T t46; - T t75; - T t77; - T t76; - T t78; - T t79; - T t80; - T t81; - T t83; - - /* G_EE */ - /* G = G_EE(V01,V02,V03,V11,V12,V13,V21,V22,V23,V31,V32,V33) */ - /* This function was generated by the Symbolic Math Toolbox version 8.3. */ - /* 14-Jun-2019 13:58:25 */ - t11 = -v11 + v01; - t12 = -v12 + v02; - t13 = -v13 + v03; - t14 = -v21 + v01; - t15 = -v22 + v02; - t16 = -v23 + v03; - t17 = -v31 + v21; - t18 = -v32 + v22; - t19 = -v33 + v23; - t32 = t14 * t18; - t33 = t15 * t17; - t34 = t14 * t19; - t35 = t16 * t17; - t36 = t15 * t19; - t37 = t16 * t18; - t44 = t11 * t18 + -(t12 * t17); - t45 = t11 * t19 + -(t13 * t17); - t46 = t12 * t19 + -(t13 * t18); - t75 = 1.0 / ((t44 * t44 + t45 * t45) + t46 * t46); - t77 = (t16 * t44 + t14 * t46) + -(t15 * t45); - t76 = t75 * t75; - t78 = t77 * t77; - t79 = (t12 * t44 * 2.0 + t13 * t45 * 2.0) * t76 * t78; - t80 = (t11 * t45 * 2.0 + t12 * t46 * 2.0) * t76 * t78; - t81 = (t18 * t44 * 2.0 + t19 * t45 * 2.0) * t76 * t78; - t18 = (t17 * t45 * 2.0 + t18 * t46 * 2.0) * t76 * t78; - t83 = (t11 * t44 * 2.0 + -(t13 * t46 * 2.0)) * t76 * t78; - t19 = (t17 * t44 * 2.0 + -(t19 * t46 * 2.0)) * t76 * t78; - t76 = t75 * t77; - g[0] = -t81 + t76 * ((-t36 + t37) + t46) * 2.0; - g[1] = t19 - t76 * ((-t34 + t35) + t45) * 2.0; - g[2] = t18 + t76 * ((-t32 + t33) + t44) * 2.0; - g[3] = t81 + t76 * (t36 - t37) * 2.0; - g[4] = -t19 - t76 * (t34 - t35) * 2.0; - g[5] = -t18 + t76 * (t32 - t33) * 2.0; - t17 = t12 * t16 + -(t13 * t15); - g[6] = t79 - t76 * (t17 + t46) * 2.0; - t18 = t11 * t16 + -(t13 * t14); - g[7] = -t83 + t76 * (t18 + t45) * 2.0; - t19 = t11 * t15 + -(t12 * t14); - g[8] = -t80 - t76 * (t19 + t44) * 2.0; - g[9] = -t79 + t76 * t17 * 2.0; - g[10] = t83 - t76 * t18 * 2.0; - g[11] = t80 + t76 * t19 * 2.0; -} - -template -MUDA_GENERIC void H_EE( - T v01, T v02, T v03, T v11, T v12, T v13, T v21, T v22, T v23, T v31, T v32, T v33, T H[144]) -{ - T t11; - T t12; - T t13; - T t14; - T t15; - T t16; - T t26; - T t27; - T t28; - T t47; - T t48; - T t49; - T t50; - T t51; - T t52; - T t53; - T t54; - T t55; - T t56; - T t57; - T t58; - T t59; - T t65; - T t73; - T t35; - T t36; - T t37; - T t38; - T t39; - T t40; - T t98; - T t99; - T t100; - T t101; - T t103; - T t105; - T t107; - T t108; - T t109; - T t137; - T t138; - T t139; - T t140; - T t141; - T t142; - T t143; - T t144; - T t145; - T t146; - T t147; - T t148; - T t156; - T t159; - T t157; - T t262; - T t263; - T t264; - T t265; - T t266; - T t267; - T t268; - T t269; - T t270; - T t271; - T t272; - T t273; - T t274; - T t275; - T t276; - T t277; - T t278; - T t279; - T t298; - T t299; - T t300; - T t301; - T t302; - T t303; - T t310; - T t311; - T t312; - T t313; - T t314; - T t315; - T t322; - T t323; - T t325; - T t326; - T t327; - T t328; - T t329; - T t330; - T t335; - T t337; - T t339; - T t340; - T t341; - T t342; - T t343; - T t345; - T t348; - T t353; - T t356; - T t358; - T t359; - T t360; - T t362; - T t367; - T t368; - T t369; - T t371; - T t374; - T t377; - T t382; - T t386; - T t387; - T t398; - T t399; - T t403; - T t408; - T t423; - T t424; - T t427; - T t428; - T t431; - T t432; - T t433; - T t434; - T t437; - T t438; - T t441; - T t442; - T t446; - T t451; - T t455; - T t456; - T t467; - T t468; - T t472; - T t477; - T t491; - T t492; - T t495; - T t497; - T t499; - T t500; - T t503; - T t504; - T t506; - T t508; - T t550; - T t568; - T t519_tmp; - T b_t519_tmp; - T t519; - T t520_tmp; - T b_t520_tmp; - T t520; - T t521_tmp; - T b_t521_tmp; - T t521; - T t522_tmp; - T b_t522_tmp; - T t522; - T t523_tmp; - T b_t523_tmp; - T t523; - T t524_tmp; - T b_t524_tmp; - T t524; - T t525; - T t526; - T t527; - T t528; - T t529; - T t530; - T t531; - T t532; - T t533; - T t534; - T t535; - T t536; - T t537; - T t538; - T t539; - T t540; - T t542; - T t543; - T t544; - - /* H_EE */ - /* H = H_EE(V01,V02,V03,V11,V12,V13,V21,V22,V23,V31,V32,V33) */ - /* This function was generated by the Symbolic Math Toolbox version 8.3. */ - /* 14-Jun-2019 13:58:38 */ - t11 = -v11 + v01; - t12 = -v12 + v02; - t13 = -v13 + v03; - t14 = -v21 + v01; - t15 = -v22 + v02; - t16 = -v23 + v03; - t26 = -v31 + v21; - t27 = -v32 + v22; - t28 = -v33 + v23; - t47 = t11 * t27; - t48 = t12 * t26; - t49 = t11 * t28; - t50 = t13 * t26; - t51 = t12 * t28; - t52 = t13 * t27; - t53 = t14 * t27; - t54 = t15 * t26; - t55 = t14 * t28; - t56 = t16 * t26; - t57 = t15 * t28; - t58 = t16 * t27; - t59 = t11 * t26 * 2.0; - t65 = t12 * t27 * 2.0; - t73 = t13 * t28 * 2.0; - t35 = t11 * t11 * 2.0; - t36 = t12 * t12 * 2.0; - t37 = t13 * t13 * 2.0; - t38 = t26 * t26 * 2.0; - t39 = t27 * t27 * 2.0; - t40 = t28 * t28 * 2.0; - t98 = t11 * t15 + -(t12 * t14); - t99 = t11 * t16 + -(t13 * t14); - t100 = t12 * t16 + -(t13 * t15); - t101 = t47 + -t48; - t103 = t49 + -t50; - t105 = t51 + -t52; - t107 = t53 + -t54; - t108 = t55 + -t56; - t109 = t57 + -t58; - t137 = t98 + t101; - t138 = t99 + t103; - t139 = t100 + t105; - t140 = (t54 + -t53) + t101; - t141 = (t56 + -t55) + t103; - t142 = (t58 + -t57) + t105; - t143 = t12 * t101 * 2.0 + t13 * t103 * 2.0; - t144 = t11 * t103 * 2.0 + t12 * t105 * 2.0; - t145 = t27 * t101 * 2.0 + t28 * t103 * 2.0; - t146 = t26 * t103 * 2.0 + t27 * t105 * 2.0; - t147 = t11 * t101 * 2.0 + -(t13 * t105 * 2.0); - t148 = t26 * t101 * 2.0 + -(t28 * t105 * 2.0); - t156 = 1.0 / ((t101 * t101 + t103 * t103) + t105 * t105); - t159 = (t16 * t101 + t14 * t105) + -(t15 * t103); - t157 = t156 * t156; - t57 = pow(t156, 3.0); - t58 = t159 * t159; - t262 = t11 * t156 * t159 * 2.0; - t263 = t12 * t156 * t159 * 2.0; - t264 = t13 * t156 * t159 * 2.0; - t265 = t14 * t156 * t159 * 2.0; - t266 = t15 * t156 * t159 * 2.0; - t267 = t16 * t156 * t159 * 2.0; - t268 = (-v31 + v01) * t156 * t159 * 2.0; - t269 = (-v21 + v11) * t156 * t159 * 2.0; - t270 = (-v32 + v02) * t156 * t159 * 2.0; - t271 = (-v22 + v12) * t156 * t159 * 2.0; - t272 = (-v33 + v03) * t156 * t159 * 2.0; - t273 = (-v23 + v13) * t156 * t159 * 2.0; - t274 = (-v31 + v11) * t156 * t159 * 2.0; - t275 = (-v32 + v12) * t156 * t159 * 2.0; - t276 = (-v33 + v13) * t156 * t159 * 2.0; - t277 = t26 * t156 * t159 * 2.0; - t278 = t27 * t156 * t159 * 2.0; - t279 = t28 * t156 * t159 * 2.0; - t298 = t11 * t12 * t157 * t58 * 2.0; - t299 = t11 * t13 * t157 * t58 * 2.0; - t300 = t12 * t13 * t157 * t58 * 2.0; - t301 = t26 * t27 * t157 * t58 * 2.0; - t302 = t26 * t28 * t157 * t58 * 2.0; - t303 = t27 * t28 * t157 * t58 * 2.0; - t310 = (t35 + t36) * t157 * t58; - t311 = (t35 + t37) * t157 * t58; - t312 = (t36 + t37) * t157 * t58; - t313 = (t38 + t39) * t157 * t58; - t314 = (t38 + t40) * t157 * t58; - t315 = (t39 + t40) * t157 * t58; - t322 = (t59 + t65) * t157 * t58; - t323 = (t59 + t73) * t157 * t58; - t59 = (t65 + t73) * t157 * t58; - t325 = (t47 * 2.0 + -(t48 * 4.0)) * t157 * t58; - t53 = -t157 * t58; - t56 = t48 * 2.0 - t47 * 4.0; - t326 = t53 * t56; - t327 = (t49 * 2.0 + -(t50 * 4.0)) * t157 * t58; - t55 = t50 * 2.0 - t49 * 4.0; - t328 = t53 * t55; - t329 = (t51 * 2.0 + -(t52 * 4.0)) * t157 * t58; - t54 = t52 * 2.0 - t51 * 4.0; - t330 = t53 * t54; - t53 = t157 * t58; - t335 = t53 * t56; - t337 = t53 * t55; - t339 = t53 * t54; - t340 = t143 * t143 * t57 * t58 * 2.0; - t341 = t144 * t144 * t57 * t58 * 2.0; - t342 = t145 * t145 * t57 * t58 * 2.0; - t343 = t146 * t146 * t57 * t58 * 2.0; - t345 = t147 * t147 * t57 * t58 * 2.0; - t348 = t148 * t148 * t57 * t58 * 2.0; - t36 = t98 * t143 * t157 * t159 * 2.0; - t353 = t99 * t143 * t157 * t159 * 2.0; - t356 = t99 * t144 * t157 * t159 * 2.0; - t65 = t100 * t144 * t157 * t159 * 2.0; - t358 = t107 * t143 * t157 * t159 * 2.0; - t359 = t98 * t145 * t157 * t159 * 2.0; - t360 = t108 * t143 * t157 * t159 * 2.0; - t54 = t107 * t144 * t157 * t159 * 2.0; - t362 = t99 * t145 * t157 * t159 * 2.0; - t53 = t98 * t146 * t157 * t159 * 2.0; - t56 = t109 * t143 * t157 * t159 * 2.0; - t27 = t108 * t144 * t157 * t159 * 2.0; - t55 = t100 * t145 * t157 * t159 * 2.0; - t367 = t99 * t146 * t157 * t159 * 2.0; - t368 = t109 * t144 * t157 * t159 * 2.0; - t369 = t100 * t146 * t157 * t159 * 2.0; - t38 = t107 * t145 * t157 * t159 * 2.0; - t371 = t108 * t145 * t157 * t159 * 2.0; - t374 = t108 * t146 * t157 * t159 * 2.0; - t28 = t109 * t146 * t157 * t159 * 2.0; - t377 = t98 * t147 * t157 * t159 * 2.0; - t382 = t100 * t147 * t157 * t159 * 2.0; - t386 = t107 * t147 * t157 * t159 * 2.0; - t387 = t98 * t148 * t157 * t159 * 2.0; - t103 = t108 * t147 * t157 * t159 * 2.0; - t101 = t99 * t148 * t157 * t159 * 2.0; - t398 = t109 * t147 * t157 * t159 * 2.0; - t399 = t100 * t148 * t157 * t159 * 2.0; - t403 = t107 * t148 * t157 * t159 * 2.0; - t408 = t109 * t148 * t157 * t159 * 2.0; - t73 = t137 * t143 * t157 * t159 * 2.0; - t423 = t138 * t143 * t157 * t159 * 2.0; - t424 = t138 * t144 * t157 * t159 * 2.0; - t37 = t139 * t144 * t157 * t159 * 2.0; - t427 = t140 * t143 * t157 * t159 * 2.0; - t428 = t137 * t145 * t157 * t159 * 2.0; - t16 = t140 * t144 * t157 * t159 * 2.0; - t11 = t137 * t146 * t157 * t159 * 2.0; - t431 = t141 * t143 * t157 * t159 * 2.0; - t432 = t138 * t145 * t157 * t159 * 2.0; - t433 = t141 * t144 * t157 * t159 * 2.0; - t434 = t138 * t146 * t157 * t159 * 2.0; - t105 = t142 * t143 * t157 * t159 * 2.0; - t14 = t139 * t145 * t157 * t159 * 2.0; - t437 = t142 * t144 * t157 * t159 * 2.0; - t438 = t139 * t146 * t157 * t159 * 2.0; - t35 = t140 * t145 * t157 * t159 * 2.0; - t441 = t141 * t145 * t157 * t159 * 2.0; - t442 = t141 * t146 * t157 * t159 * 2.0; - t39 = t142 * t146 * t157 * t159 * 2.0; - t446 = t137 * t147 * t157 * t159 * 2.0; - t451 = t139 * t147 * t157 * t159 * 2.0; - t455 = t140 * t147 * t157 * t159 * 2.0; - t456 = t137 * t148 * t157 * t159 * 2.0; - t13 = t141 * t147 * t157 * t159 * 2.0; - t26 = t138 * t148 * t157 * t159 * 2.0; - t467 = t142 * t147 * t157 * t159 * 2.0; - t468 = t139 * t148 * t157 * t159 * 2.0; - t472 = t140 * t148 * t157 * t159 * 2.0; - t477 = t142 * t148 * t157 * t159 * 2.0; - t47 = t143 * t144 * t57 * t58 * 2.0; - t15 = t143 * t145 * t57 * t58 * 2.0; - t491 = t143 * t146 * t57 * t58 * 2.0; - t492 = t144 * t145 * t57 * t58 * 2.0; - t12 = t144 * t146 * t57 * t58 * 2.0; - t40 = t145 * t146 * t57 * t58 * 2.0; - t495 = t143 * t147 * t57 * t58 * 2.0; - t497 = t144 * t147 * t57 * t58 * 2.0; - t499 = t143 * t148 * t57 * t58 * 2.0; - t500 = t145 * t147 * t57 * t58 * 2.0; - t503 = t146 * t147 * t57 * t58 * 2.0; - t504 = t144 * t148 * t57 * t58 * 2.0; - t506 = t145 * t148 * t57 * t58 * 2.0; - t508 = t146 * t148 * t57 * t58 * 2.0; - t57 = t147 * t148 * t57 * t58 * 2.0; - t550 = ((((t98 * t109 * t156 * 2.0 + -t266) + t337) + t359) + t368) + t492; - t568 = ((((t108 * t137 * t156 * 2.0 + -t268) + t330) + t27) + t456) + t504; - t519_tmp = t139 * t143 * t157 * t159; - b_t519_tmp = t100 * t143 * t157 * t159; - t519 = (((-(t100 * t139 * t156 * 2.0) + t312) + -t340) + b_t519_tmp * 2.0) - + t519_tmp * 2.0; - t520_tmp = t140 * t146 * t157 * t159; - b_t520_tmp = t107 * t146 * t157 * t159; - t520 = (((t107 * t140 * t156 * 2.0 + t313) + -t343) + b_t520_tmp * 2.0) - + -(t520_tmp * 2.0); - t521_tmp = t142 * t145 * t157 * t159; - b_t521_tmp = t109 * t145 * t157 * t159; - t521 = (((t109 * t142 * t156 * 2.0 + t315) + -t342) + -(b_t521_tmp * 2.0)) - + t521_tmp * 2.0; - t522_tmp = t137 * t144 * t157 * t159; - b_t522_tmp = t98 * t144 * t157 * t159; - t522 = (((-(t98 * t137 * t156 * 2.0) + t310) + -t341) + -(b_t522_tmp * 2.0)) - + -(t522_tmp * 2.0); - t523_tmp = t138 * t147 * t157 * t159; - b_t523_tmp = t99 * t147 * t157 * t159; - t523 = (((-(t99 * t138 * t156 * 2.0) + t311) + -t345) + b_t523_tmp * 2.0) + t523_tmp * 2.0; - t524_tmp = t141 * t148 * t157 * t159; - b_t524_tmp = t108 * t148 * t157 * t159; - t524 = (((t108 * t141 * t156 * 2.0 + t314) + -t348) + -(b_t524_tmp * 2.0)) - + t524_tmp * 2.0; - t525 = (((t98 * t100 * t156 * 2.0 + t299) + t65) + -t36) + -t47; - t526 = (((t107 * t109 * t156 * 2.0 + t302) + t38) + -t28) + -t40; - t527 = (((-(t98 * t99 * t156 * 2.0) + t300) + t377) + -t356) + t497; - t528 = (((-(t99 * t100 * t156 * 2.0) + t298) + t353) + t382) + -t495; - t529 = (((-(t107 * t108 * t156 * 2.0) + t303) + t374) + -t403) + t508; - t530 = (((-(t108 * t109 * t156 * 2.0) + t301) + -t371) + -t408) + -t506; - t531 = (((t98 * t107 * t156 * 2.0 + t322) + t54) + -t53) + -t12; - t532 = (((t100 * t109 * t156 * 2.0 + t59) + t55) + -t56) + -t15; - t533 = (((t99 * t108 * t156 * 2.0 + t323) + t101) + -t103) + -t57; - t534 = (((t98 * t140 * t156 * 2.0 + -t322) + t53) + t16) + t12; - t535 = (((-(t107 * t137 * t156 * 2.0) + -t322) + -t54) + t11) + t12; - t536 = (((t100 * t142 * t156 * 2.0 + -t59) + -t55) + -t105) + t15; - t537 = (((-(t109 * t139 * t156 * 2.0) + -t59) + t56) + -t14) + t15; - t538 = (((t99 * t141 * t156 * 2.0 + -t323) + -t101) + -t13) + t57; - t539 = (((-(t108 * t138 * t156 * 2.0) + -t323) + t103) + -t26) + t57; - t540 = (((t137 * t139 * t156 * 2.0 + t299) + t37) + -t73) + -t47; - t148 = (((t140 * t142 * t156 * 2.0 + t302) + t39) + -t35) + -t40; - t542 = (((-(t137 * t138 * t156 * 2.0) + t300) + t446) + -t424) + t497; - t543 = (((-(t138 * t139 * t156 * 2.0) + t298) + t423) + t451) + -t495; - t544 = (((-(t140 * t141 * t156 * 2.0) + t303) + t472) + -t442) + t508; - t53 = (((-(t141 * t142 * t156 * 2.0) + t301) + t441) + t477) + -t506; - t157 = (((-(t139 * t142 * t156 * 2.0) + t59) + t105) + t14) + -t15; - t159 = (((-(t137 * t140 * t156 * 2.0) + t322) + -t16) + -t11) + -t12; - t147 = (((-(t138 * t141 * t156 * 2.0) + t323) + t13) + t26) + -t57; - t146 = ((((t100 * t107 * t156 * 2.0 + t266) + t327) + -t358) + -t369) + t491; - t145 = ((((-(t99 * t107 * t156 * 2.0) + -t265) + t329) + t367) + t386) + -t503; - t144 = ((((-(t100 * t108 * t156 * 2.0) + -t267) + t325) + t360) + -t399) + t499; - t143 = ((((-(t99 * t109 * t156 * 2.0) + t267) + t335) + -t362) + t398) + t500; - t52 = ((((-(t98 * t108 * t156 * 2.0) + t265) + t339) + -t27) + -t387) + -t504; - t51 = ((((t109 * t140 * t156 * 2.0 + -t278) + -t302) + t28) + t35) + t40; - t50 = ((((-(t98 * t139 * t156 * 2.0) + t263) + -t299) + t36) + -t37) + t47; - t49 = ((((t107 * t142 * t156 * 2.0 + t278) + -t302) + -t38) + -t39) + t40; - t48 = ((((-(t100 * t137 * t156 * 2.0) + -t263) + -t299) + -t65) + t73) + t47; - t47 = ((((t99 * t137 * t156 * 2.0 + t262) + -t300) + t356) + -t446) + -t497; - t73 = ((((t100 * t138 * t156 * 2.0 + t264) + -t298) + -t382) + -t423) + t495; - t65 = ((((-(t109 * t141 * t156 * 2.0) + t279) + -t301) + t408) + -t441) + t506; - t59 = ((((t98 * t138 * t156 * 2.0 + -t262) + -t300) + -t377) + t424) + -t497; - t40 = ((((t99 * t139 * t156 * 2.0 + -t264) + -t298) + -t353) + -t451) + t495; - t39 = ((((-(t107 * t141 * t156 * 2.0) + -t277) + -t303) + t403) + t442) + -t508; - t38 = ((((-(t108 * t142 * t156 * 2.0) + -t279) + -t301) + t371) + -t477) + t506; - t37 = ((((-(t108 * t140 * t156 * 2.0) + t277) + -t303) + -t374) + -t472) + -t508; - t36 = ((((t98 * t142 * t156 * 2.0 + t271) + t328) + -t359) + t437) + -t492; - t35 = ((((-(t109 * t137 * t156 * 2.0) + t270) + t328) + -t368) + -t428) + -t492; - t28 = ((((t100 * t140 * t156 * 2.0 + -t271) + -t327) + t369) + -t427) + -t491; - t27 = ((((-(t98 * t141 * t156 * 2.0) + -t269) + t330) + t387) + -t433) + t504; - t26 = ((((t109 * t138 * t156 * 2.0 + -t272) + t326) + -t398) + t432) + -t500; - t13 = ((((-(t107 * t139 * t156 * 2.0) + -t270) + -t327) + t358) + t438) + -t491; - t12 = ((((-(t99 * t142 * t156 * 2.0) + -t273) + t326) + t362) + t467) + -t500; - t11 = ((((-(t99 * t140 * t156 * 2.0) + t269) + -t329) + -t367) + t455) + t503; - t16 = ((((t107 * t138 * t156 * 2.0 + t268) + -t329) + -t386) + -t434) + t503; - t15 = ((((-(t100 * t141 * t156 * 2.0) + t273) + -t325) + t399) + t431) + -t499; - t14 = ((((t108 * t139 * t156 * 2.0 + t272) + -t325) + -t360) + t468) + -t499; - t105 = ((((-(t139 * t140 * t156 * 2.0) + t275) + t327) + t427) + -t438) + t491; - t103 = ((((t138 * t140 * t156 * 2.0 + -t274) + t329) + t434) + -t455) + -t503; - t101 = ((((-(t137 * t142 * t156 * 2.0) + -t275) + t337) + t428) + -t437) + t492; - t58 = ((((t139 * t141 * t156 * 2.0 + -t276) + t325) + -t431) + -t468) + t499; - t57 = ((((t137 * t141 * t156 * 2.0 + t274) + t339) + t433) + -t456) + -t504; - t56 = ((((t138 * t142 * t156 * 2.0 + t276) + t335) + -t432) + -t467) + t500; - t55 = -t315 + t342; - H[0] = (t55 + t142 * t142 * t156 * 2.0) - t521_tmp * 4.0; - H[1] = t53; - H[2] = t148; - H[3] = t521; - H[4] = t38; - H[5] = t49; - H[6] = t157; - H[7] = t56; - H[8] = t101; - H[9] = t536; - H[10] = t12; - H[11] = t36; - H[12] = t53; - t54 = -t314 + t348; - H[13] = (t54 + t141 * t141 * t156 * 2.0) - t524_tmp * 4.0; - H[14] = t544; - H[15] = t65; - H[16] = t524; - H[17] = t39; - H[18] = t58; - H[19] = t147; - H[20] = t57; - H[21] = t15; - H[22] = t538; - H[23] = t27; - H[24] = t148; - H[25] = t544; - t53 = -t313 + t343; - H[26] = (t53 + t140 * t140 * t156 * 2.0) + t520_tmp * 4.0; - H[27] = t51; - H[28] = t37; - H[29] = t520; - H[30] = t105; - H[31] = t103; - H[32] = t159; - H[33] = t28; - H[34] = t11; - H[35] = t534; - H[36] = t521; - H[37] = t65; - H[38] = t51; - H[39] = (t55 + t109 * t109 * t156 * 2.0) + b_t521_tmp * 4.0; - H[40] = t530; - H[41] = t526; - H[42] = t537; - H[43] = t26; - H[44] = t35; - H[45] = t532; - H[46] = t143; - H[47] = t550; - H[48] = t38; - H[49] = t524; - H[50] = t37; - H[51] = t530; - H[52] = (t54 + t108 * t108 * t156 * 2.0) + b_t524_tmp * 4.0; - H[53] = t529; - H[54] = t14; - H[55] = t539; - H[56] = t568; - H[57] = t144; - H[58] = t533; - H[59] = t52; - H[60] = t49; - H[61] = t39; - H[62] = t520; - H[63] = t526; - H[64] = t529; - H[65] = (t53 + t107 * t107 * t156 * 2.0) - b_t520_tmp * 4.0; - H[66] = t13; - H[67] = t16; - H[68] = t535; - H[69] = t146; - H[70] = t145; - H[71] = t531; - H[72] = t157; - H[73] = t58; - H[74] = t105; - H[75] = t537; - H[76] = t14; - H[77] = t13; - t55 = -t312 + t340; - H[78] = (t55 + t139 * t139 * t156 * 2.0) - t519_tmp * 4.0; - H[79] = t543; - H[80] = t540; - H[81] = t519; - H[82] = t40; - H[83] = t50; - H[84] = t56; - H[85] = t147; - H[86] = t103; - H[87] = t26; - H[88] = t539; - H[89] = t16; - H[90] = t543; - t54 = -t311 + t345; - H[91] = (t54 + t138 * t138 * t156 * 2.0) - t523_tmp * 4.0; - H[92] = t542; - H[93] = t73; - H[94] = t523; - H[95] = t59; - H[96] = t101; - H[97] = t57; - H[98] = t159; - H[99] = t35; - H[100] = t568; - H[101] = t535; - H[102] = t540; - H[103] = t542; - t53 = -t310 + t341; - H[104] = (t53 + t137 * t137 * t156 * 2.0) + t522_tmp * 4.0; - H[105] = t48; - H[106] = t47; - H[107] = t522; - H[108] = t536; - H[109] = t15; - H[110] = t28; - H[111] = t532; - H[112] = t144; - H[113] = t146; - H[114] = t519; - H[115] = t73; - H[116] = t48; - H[117] = (t55 + t100 * t100 * t156 * 2.0) - b_t519_tmp * 4.0; - H[118] = t528; - H[119] = t525; - H[120] = t12; - H[121] = t538; - H[122] = t11; - H[123] = t143; - H[124] = t533; - H[125] = t145; - H[126] = t40; - H[127] = t523; - H[128] = t47; - H[129] = t528; - H[130] = (t54 + t99 * t99 * t156 * 2.0) - b_t523_tmp * 4.0; - H[131] = t527; - H[132] = t36; - H[133] = t27; - H[134] = t534; - H[135] = t550; - H[136] = t52; - H[137] = t531; - H[138] = t50; - H[139] = t59; - H[140] = t522; - H[141] = t525; - H[142] = t527; - H[143] = (t53 + t98 * t98 * t156 * 2.0) + b_t522_tmp * 4.0; -} -} // namespace muda::distance::details - - -namespace muda::distance -{ -template -MUDA_GENERIC void edge_edge_distance(const Eigen::Matrix& ea0, - const Eigen::Matrix& ea1, - const Eigen::Matrix& eb0, - const Eigen::Matrix& eb1, - T& dist2) -{ - Eigen::Matrix b = Eigen::Matrix(ea1 - ea0).cross(eb1 - eb0); - T aTb = Eigen::Matrix(eb0 - ea0).dot(b); - dist2 = aTb * aTb / b.squaredNorm(); -} - -template -MUDA_GENERIC void edge_edge_distance_gradient(const Eigen::Matrix& ea0, - const Eigen::Matrix& ea1, - const Eigen::Matrix& eb0, - const Eigen::Matrix& eb1, - Eigen::Matrix& grad) -{ - details::g_EE(ea0[0], - ea0[1], - ea0[2], - ea1[0], - ea1[1], - ea1[2], - eb0[0], - eb0[1], - eb0[2], - eb1[0], - eb1[1], - eb1[2], - grad.data()); -} - -template -MUDA_GENERIC void edge_edge_distance_hessian(const Eigen::Matrix& ea0, - const Eigen::Matrix& ea1, - const Eigen::Matrix& eb0, - const Eigen::Matrix& eb1, - Eigen::Matrix& Hessian) -{ - details::H_EE(ea0[0], - ea0[1], - ea0[2], - ea1[0], - ea1[1], - ea1[2], - eb0[0], - eb0[1], - eb0[2], - eb1[0], - eb1[1], - eb1[2], - Hessian.data()); -} - -} // namespace muda::distance \ No newline at end of file diff --git a/src/muda/ext/geo/distance/details/edge_edge_mollified.inl b/src/muda/ext/geo/distance/details/edge_edge_mollified.inl deleted file mode 100644 index 1230588c..00000000 --- a/src/muda/ext/geo/distance/details/edge_edge_mollified.inl +++ /dev/null @@ -1,496 +0,0 @@ -namespace muda::distance::details -{ -template -MUDA_GENERIC void g_EECN2( - T v01, T v02, T v03, T v11, T v12, T v13, T v21, T v22, T v23, T v31, T v32, T v33, T g[12]) -{ - T t8; - T t9; - T t10; - T t11; - T t12; - T t13; - T t23; - T t24; - T t25; - T t26; - T t27; - T t28; - T t29; - T t30; - T t31; - T t32; - T t33; - - /* COMPUTEEECROSSSQNORMGRADIENT */ - /* G = COMPUTEEECROSSSQNORMGRADIENT(V01,V02,V03,V11,V12,V13,V21,V22,V23,V31,V32,V33) */ - /* This function was generated by the Symbolic Math Toolbox version 8.3. */ - /* 01-Nov-2019 16:54:23 */ - t8 = -v11 + v01; - t9 = -v12 + v02; - t10 = -v13 + v03; - t11 = -v31 + v21; - t12 = -v32 + v22; - t13 = -v33 + v23; - t23 = t8 * t12 + -(t9 * t11); - t24 = t8 * t13 + -(t10 * t11); - t25 = t9 * t13 + -(t10 * t12); - t26 = t8 * t23 * 2.0; - t27 = t9 * t23 * 2.0; - t28 = t8 * t24 * 2.0; - t29 = t10 * t24 * 2.0; - t30 = t9 * t25 * 2.0; - t31 = t10 * t25 * 2.0; - t32 = t11 * t23 * 2.0; - t33 = t12 * t23 * 2.0; - t23 = t11 * t24 * 2.0; - t10 = t13 * t24 * 2.0; - t9 = t12 * t25 * 2.0; - t8 = t13 * t25 * 2.0; - g[0] = t33 + t10; - g[1] = -t32 + t8; - g[2] = -t23 - t9; - g[3] = -t33 - t10; - g[4] = t32 - t8; - g[5] = t23 + t9; - g[6] = -t27 - t29; - g[7] = t26 - t31; - g[8] = t28 + t30; - g[9] = t27 + t29; - g[10] = -t26 + t31; - g[11] = -t28 - t30; -} -template -MUDA_GENERIC void H_EECN2( - T v01, T v02, T v03, T v11, T v12, T v13, T v21, T v22, T v23, T v31, T v32, T v33, T H[144]) -{ - T t8; - T t9; - T t10; - T t11; - T t12; - T t13; - T t32; - T t33; - T t34; - T t35; - T t48; - T t36; - T t49; - T t37; - T t38; - T t39; - T t40; - T t41; - T t42; - T t43; - T t44; - T t45; - T t46; - T t47; - T t50; - T t51; - T t52; - T t20; - T t23; - T t24; - T t25; - T t86; - T t87; - T t88; - T t74; - T t75; - T t76; - T t77; - T t78; - T t79; - T t89; - T t90; - T t91; - T t92; - T t93; - T t94; - T t95; - - /* COMPUTEEECROSSSQNORMHESSIAN */ - /* H = COMPUTEEECROSSSQNORMHESSIAN(V01,V02,V03,V11,V12,V13,V21,V22,V23,V31,V32,V33) */ - /* This function was generated by the Symbolic Math Toolbox version 8.3. */ - /* 01-Nov-2019 16:54:23 */ - t8 = -v11 + v01; - t9 = -v12 + v02; - t10 = -v13 + v03; - t11 = -v31 + v21; - t12 = -v32 + v22; - t13 = -v33 + v23; - t32 = t8 * t9 * 2.0; - t33 = t8 * t10 * 2.0; - t34 = t9 * t10 * 2.0; - t35 = t8 * t11 * 2.0; - t48 = t8 * t12; - t36 = t48 * 2.0; - t49 = t9 * t11; - t37 = t49 * 2.0; - t38 = t48 * 4.0; - t48 = t8 * t13; - t39 = t48 * 2.0; - t40 = t49 * 4.0; - t41 = t9 * t12 * 2.0; - t49 = t10 * t11; - t42 = t49 * 2.0; - t43 = t48 * 4.0; - t48 = t9 * t13; - t44 = t48 * 2.0; - t45 = t49 * 4.0; - t49 = t10 * t12; - t46 = t49 * 2.0; - t47 = t48 * 4.0; - t48 = t49 * 4.0; - t49 = t10 * t13 * 2.0; - t50 = t11 * t12 * 2.0; - t51 = t11 * t13 * 2.0; - t52 = t12 * t13 * 2.0; - t20 = t8 * t8 * 2.0; - t9 = t9 * t9 * 2.0; - t8 = t10 * t10 * 2.0; - t23 = t11 * t11 * 2.0; - t24 = t12 * t12 * 2.0; - t25 = t13 * t13 * 2.0; - t86 = t35 + t41; - t87 = t35 + t49; - t88 = t41 + t49; - t74 = t20 + t9; - t75 = t20 + t8; - t76 = t9 + t8; - t77 = t23 + t24; - t78 = t23 + t25; - t79 = t24 + t25; - t89 = t40 + -t36; - t90 = t36 + -t40; - t91 = t37 + -t38; - t92 = t38 + -t37; - t93 = t45 + -t39; - t94 = t39 + -t45; - t95 = t42 + -t43; - t37 = t43 + -t42; - t39 = t48 + -t44; - t45 = t44 + -t48; - t38 = t46 + -t47; - t40 = t47 + -t46; - t36 = -t35 + -t41; - t13 = -t35 + -t49; - t11 = -t41 + -t49; - t12 = -t20 + -t9; - t10 = -t20 + -t8; - t8 = -t9 + -t8; - t9 = -t23 + -t24; - t49 = -t23 + -t25; - t48 = -t24 + -t25; - H[0] = t79; - H[1] = -t50; - H[2] = -t51; - H[3] = t48; - H[4] = t50; - H[5] = t51; - H[6] = t11; - H[7] = t92; - H[8] = t37; - H[9] = t88; - H[10] = t91; - H[11] = t95; - H[12] = -t50; - H[13] = t78; - H[14] = -t52; - H[15] = t50; - H[16] = t49; - H[17] = t52; - H[18] = t89; - H[19] = t13; - H[20] = t40; - H[21] = t90; - H[22] = t87; - H[23] = t38; - H[24] = -t51; - H[25] = -t52; - H[26] = t77; - H[27] = t51; - H[28] = t52; - H[29] = t9; - H[30] = t93; - H[31] = t39; - H[32] = t36; - H[33] = t94; - H[34] = t45; - H[35] = t86; - H[36] = t48; - H[37] = t50; - H[38] = t51; - H[39] = t79; - H[40] = -t50; - H[41] = -t51; - H[42] = t88; - H[43] = t91; - H[44] = t95; - H[45] = t11; - H[46] = t92; - H[47] = t37; - H[48] = t50; - H[49] = t49; - H[50] = t52; - H[51] = -t50; - H[52] = t78; - H[53] = -t52; - H[54] = t90; - H[55] = t87; - H[56] = t38; - H[57] = t89; - H[58] = t13; - H[59] = t40; - H[60] = t51; - H[61] = t52; - H[62] = t9; - H[63] = -t51; - H[64] = -t52; - H[65] = t77; - H[66] = t94; - H[67] = t45; - H[68] = t86; - H[69] = t93; - H[70] = t39; - H[71] = t36; - H[72] = t11; - H[73] = t89; - H[74] = t93; - H[75] = t88; - H[76] = t90; - H[77] = t94; - H[78] = t76; - H[79] = -t32; - H[80] = -t33; - H[81] = t8; - H[82] = t32; - H[83] = t33; - H[84] = t92; - H[85] = t13; - H[86] = t39; - H[87] = t91; - H[88] = t87; - H[89] = t45; - H[90] = -t32; - H[91] = t75; - H[92] = -t34; - H[93] = t32; - H[94] = t10; - H[95] = t34; - H[96] = t37; - H[97] = t40; - H[98] = t36; - H[99] = t95; - H[100] = t38; - H[101] = t86; - H[102] = -t33; - H[103] = -t34; - H[104] = t74; - H[105] = t33; - H[106] = t34; - H[107] = t12; - H[108] = t88; - H[109] = t90; - H[110] = t94; - H[111] = t11; - H[112] = t89; - H[113] = t93; - H[114] = t8; - H[115] = t32; - H[116] = t33; - H[117] = t76; - H[118] = -t32; - H[119] = -t33; - H[120] = t91; - H[121] = t87; - H[122] = t45; - H[123] = t92; - H[124] = t13; - H[125] = t39; - H[126] = t32; - H[127] = t10; - H[128] = t34; - H[129] = -t32; - H[130] = t75; - H[131] = -t34; - H[132] = t95; - H[133] = t38; - H[134] = t86; - H[135] = t37; - H[136] = t40; - H[137] = t36; - H[138] = t33; - H[139] = t34; - H[140] = t12; - H[141] = -t33; - H[142] = -t34; - H[143] = t74; -} -template -MUDA_GENERIC void EEM(T input, T eps_x, T& e) -{ - T input_div_eps_x = input / eps_x; - e = (-input_div_eps_x + 2.0) * input_div_eps_x; -} - -template -MUDA_GENERIC void g_EEM(T input, T eps_x, T& g) -{ - T one_div_eps_x = 1.0 / eps_x; - g = 2.0 * one_div_eps_x * (-one_div_eps_x * input + 1.0); -} - -template -MUDA_GENERIC void H_EEM(T input, T eps_x, T& H) -{ - H = -2.0 / (eps_x * eps_x); -} -} // namespace muda::distance::details - -namespace muda::distance -{ -template -MUDA_GENERIC void edge_edge_cross_norm2(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - T& result) -{ - result = (ea1 - ea0).cross(eb1 - eb0).squaredNorm(); -} - - -template -MUDA_GENERIC void edge_edge_cross_norm2_gradient(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - Eigen::Vector& grad) -{ - details::g_EECN2(ea0[0], - ea0[1], - ea0[2], - ea1[0], - ea1[1], - ea1[2], - eb0[0], - eb0[1], - eb0[2], - eb1[0], - eb1[1], - eb1[2], - grad.data()); -} - - -template -MUDA_GENERIC void edge_edge_cross_norm2_hessian(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - Eigen::Matrix& Hessian) -{ - details::H_EECN2(ea0[0], - ea0[1], - ea0[2], - ea1[0], - ea1[1], - ea1[2], - eb0[0], - eb0[1], - eb0[2], - eb1[0], - eb1[1], - eb1[2], - Hessian.data()); -} - - -template -MUDA_GENERIC void edge_edge_mollifier(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - T eps_x, - T& e) -{ - T EECrossSqNorm; - edge_edge_cross_norm2(ea0, ea1, eb0, eb1, EECrossSqNorm); - if(EECrossSqNorm < eps_x) - { - details::EEM(EECrossSqNorm, eps_x, e); - } - else - { - e = 1.0; - } -} - -template -MUDA_GENERIC void edge_edge_mollifier_gradient(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - T eps_x, - Eigen::Vector& g) -{ - T EECrossSqNorm; - edge_edge_cross_norm2(ea0, ea1, eb0, eb1, EECrossSqNorm); - if(EECrossSqNorm < eps_x) - { - T q_g; - details::g_EEM(EECrossSqNorm, eps_x, q_g); - edge_edge_cross_norm2_gradient(ea0, ea1, eb0, eb1, g); - g *= q_g; - } - else - { - g.setZero(); - } -} - -template -MUDA_GENERIC void edge_edge_mollifier_hessian(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - T eps_x, - Eigen::Matrix& H) -{ - T EECrossSqNorm; - edge_edge_cross_norm2(ea0, ea1, eb0, eb1, EECrossSqNorm); - if(EECrossSqNorm < eps_x) - { - T q_g, q_H; - details::g_EEM(EECrossSqNorm, eps_x, q_g); - details::H_EEM(EECrossSqNorm, eps_x, q_H); - - Eigen::Matrix g; - edge_edge_cross_norm2_gradient(ea0, ea1, eb0, eb1, g); - - edge_edge_cross_norm2_hessian(ea0, ea1, eb0, eb1, H); - H *= q_g; - H += (q_H * g) * g.transpose(); - } - else - { - H.setZero(); - } -} - -template -MUDA_GENERIC void edge_edge_mollifier_threshold(const Eigen::Vector& ea0_rest, - const Eigen::Vector& ea1_rest, - const Eigen::Vector& eb0_rest, - const Eigen::Vector& eb1_rest, - T& eps_x) -{ - eps_x = 1.0e-3 * (ea0_rest - ea1_rest).squaredNorm() - * (eb0_rest - eb1_rest).squaredNorm(); -} - -} // namespace muda::distance \ No newline at end of file diff --git a/src/muda/ext/geo/distance/details/point_edge.inl b/src/muda/ext/geo/distance/details/point_edge.inl deleted file mode 100644 index e73e7995..00000000 --- a/src/muda/ext/geo/distance/details/point_edge.inl +++ /dev/null @@ -1,600 +0,0 @@ -#include - -namespace muda::distance -{ -template -MUDA_GENERIC void point_edge_distance(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1, - T& dist2) -{ - if constexpr(dim == 2) - { - const Eigen::Matrix e = e1 - e0; - T numerator = (e[1] * p[0] - e[0] * p[1] + e1[0] * e0[1] - e1[1] * e0[0]); - dist2 = numerator * numerator / e.squaredNorm(); - } - else - { - dist2 = (e0 - p).cross(e1 - p).squaredNorm() / (e1 - e0).squaredNorm(); - } -} - -namespace details -{ - template - MUDA_GENERIC void g_PE2D(T v01, T v02, T v11, T v12, T v21, T v22, T g[6]) - { - T t13; - T t14; - T t23; - T t25; - T t24; - T t26; - T t27; - - /* G_PE2D */ - /* G = G_PE2D(V01,V02,V11,V12,V21,V22) */ - /* This function was generated by the Symbolic Math Toolbox version 8.3. */ - /* 16-Mar-2020 15:56:29 */ - t13 = -v21 + v11; - t14 = -v22 + v12; - t23 = 1.0 / (t13 * t13 + t14 * t14); - t25 = ((v11 * v22 + -(v12 * v21)) + t14 * v01) + -(t13 * v02); - t24 = t23 * t23; - t26 = t25 * t25; - t27 = (v11 * 2.0 + -(v21 * 2.0)) * t24 * t26; - t26 *= (v12 * 2.0 + -(v22 * 2.0)) * t24; - g[0] = t14 * t23 * t25 * 2.0; - g[1] = t13 * t23 * t25 * -2.0; - t24 = t23 * t25; - g[2] = -t27 - t24 * (-v22 + v02) * 2.0; - g[3] = -t26 + t24 * (-v21 + v01) * 2.0; - g[4] = t27 + t24 * (v02 - v12) * 2.0; - g[5] = t26 - t24 * (v01 - v11) * 2.0; - } - - template - MUDA_GENERIC void g_PE3D(T v01, T v02, T v03, T v11, T v12, T v13, T v21, T v22, T v23, T g[9]) - { - T t17; - T t18; - T t19; - T t20; - T t21; - T t22; - T t23; - T t24; - T t25; - T t42; - T t44; - T t45; - T t46; - T t43; - T t50; - T t51; - T t52; - - /* G_PE */ - /* G = G_PE(V01,V02,V03,V11,V12,V13,V21,V22,V23) */ - /* This function was generated by the Symbolic Math Toolbox version 8.3. */ - /* 10-Jun-2019 18:02:37 */ - t17 = -v11 + v01; - t18 = -v12 + v02; - t19 = -v13 + v03; - t20 = -v21 + v01; - t21 = -v22 + v02; - t22 = -v23 + v03; - t23 = -v21 + v11; - t24 = -v22 + v12; - t25 = -v23 + v13; - t42 = 1.0 / ((t23 * t23 + t24 * t24) + t25 * t25); - t44 = t17 * t21 + -(t18 * t20); - t45 = t17 * t22 + -(t19 * t20); - t46 = t18 * t22 + -(t19 * t21); - t43 = t42 * t42; - t50 = (t44 * t44 + t45 * t45) + t46 * t46; - t51 = (v11 * 2.0 + -(v21 * 2.0)) * t43 * t50; - t52 = (v12 * 2.0 + -(v22 * 2.0)) * t43 * t50; - t43 = (v13 * 2.0 + -(v23 * 2.0)) * t43 * t50; - g[0] = t42 * (t24 * t44 * 2.0 + t25 * t45 * 2.0); - g[1] = -t42 * (t23 * t44 * 2.0 - t25 * t46 * 2.0); - g[2] = -t42 * (t23 * t45 * 2.0 + t24 * t46 * 2.0); - g[3] = -t51 - t42 * (t21 * t44 * 2.0 + t22 * t45 * 2.0); - g[4] = -t52 + t42 * (t20 * t44 * 2.0 - t22 * t46 * 2.0); - g[5] = -t43 + t42 * (t20 * t45 * 2.0 + t21 * t46 * 2.0); - g[6] = t51 + t42 * (t18 * t44 * 2.0 + t19 * t45 * 2.0); - g[7] = t52 - t42 * (t17 * t44 * 2.0 - t19 * t46 * 2.0); - g[8] = t43 - t42 * (t17 * t45 * 2.0 + t18 * t46 * 2.0); - } - - template - MUDA_GENERIC void H_PE2D(T v01, T v02, T v11, T v12, T v21, T v22, T H[36]) - { - T t15; - T t16; - T t17; - T t18; - T t19; - T t20; - T t21; - T t22; - T t23; - T t24; - T t31; - T t34; - T t32; - T t33; - T t35; - T t60; - T t59; - T t62; - T t64; - T t65; - T t68; - T t71; - T t72; - T t75; - T t76; - T t77; - T t78; - T t79; - T t90; - T t92; - T t94; - T t96; - T t99; - T t93; - T t97; - T t98; - T t100; - T t102_tmp; - - /* H_PE2D */ - /* H = H_PE2D(V01,V02,V11,V12,V21,V22) */ - /* This function was generated by the Symbolic Math Toolbox version 8.3. */ - /* 16-Mar-2020 15:56:29 */ - t15 = -v11 + v01; - t16 = -v12 + v02; - t17 = -v21 + v01; - t18 = -v22 + v02; - t19 = -v21 + v11; - t20 = -v22 + v12; - t21 = v11 * 2.0 + -(v21 * 2.0); - t22 = v12 * 2.0 + -(v22 * 2.0); - t23 = t19 * t19; - t24 = t20 * t20; - t31 = 1.0 / (t23 + t24); - t34 = ((v11 * v22 + -(v12 * v21)) + t20 * v01) + -(t19 * v02); - t32 = t31 * t31; - t33 = pow(t31, 3.0); - t35 = t34 * t34; - t60 = t31 * t34 * 2.0; - t59 = -(t19 * t20 * t31 * 2.0); - t62 = t32 * t35 * 2.0; - t64 = t21 * t21 * t33 * t35 * 2.0; - t65 = t22 * t22 * t33 * t35 * 2.0; - t68 = t15 * t21 * t32 * t34 * 2.0; - t71 = t16 * t22 * t32 * t34 * 2.0; - t72 = t17 * t21 * t32 * t34 * 2.0; - t75 = t18 * t22 * t32 * t34 * 2.0; - t76 = t19 * t21 * t32 * t34 * 2.0; - t77 = t20 * t21 * t32 * t34 * 2.0; - t78 = t19 * t22 * t32 * t34 * 2.0; - t79 = t20 * t22 * t32 * t34 * 2.0; - t90 = t21 * t22 * t33 * t35 * 2.0; - t92 = t16 * t20 * t31 * 2.0 + t77; - t94 = -(t17 * t19 * t31 * 2.0) + t78; - t96 = (t18 * t19 * t31 * 2.0 + -t60) + t76; - t99 = (-(t15 * t20 * t31 * 2.0) + -t60) + t79; - t93 = t15 * t19 * t31 * 2.0 + -t78; - t35 = -(t18 * t20 * t31 * 2.0) + -t77; - t97 = (t17 * t20 * t31 * 2.0 + t60) + -t79; - t98 = (-(t16 * t19 * t31 * 2.0) + t60) + -t76; - t100 = ((-(t15 * t16 * t31 * 2.0) + t71) + -t68) + t90; - t19 = ((-(t17 * t18 * t31 * 2.0) + t75) + -t72) + t90; - t102_tmp = t17 * t22 * t32 * t34; - t76 = t15 * t22 * t32 * t34; - t22 = (((-(t15 * t17 * t31 * 2.0) + t62) + -t65) + t76 * 2.0) + t102_tmp * 2.0; - t33 = t18 * t21 * t32 * t34; - t20 = t16 * t21 * t32 * t34; - t79 = (((-(t16 * t18 * t31 * 2.0) + t62) + -t64) + -(t20 * 2.0)) + -(t33 * 2.0); - t77 = (((t15 * t18 * t31 * 2.0 + t60) + t68) + -t75) + -t90; - t78 = (((t16 * t17 * t31 * 2.0 + -t60) + t72) + -t71) + -t90; - H[0] = t24 * t31 * 2.0; - H[1] = t59; - H[2] = t35; - H[3] = t97; - H[4] = t92; - H[5] = t99; - H[6] = t59; - H[7] = t23 * t31 * 2.0; - H[8] = t96; - H[9] = t94; - H[10] = t98; - H[11] = t93; - H[12] = t35; - H[13] = t96; - t35 = -t62 + t64; - H[14] = (t35 + t18 * t18 * t31 * 2.0) + t33 * 4.0; - H[15] = t19; - H[16] = t79; - H[17] = t77; - H[18] = t97; - H[19] = t94; - H[20] = t19; - t33 = -t62 + t65; - H[21] = (t33 + t17 * t17 * t31 * 2.0) - t102_tmp * 4.0; - H[22] = t78; - H[23] = t22; - H[24] = t92; - H[25] = t98; - H[26] = t79; - H[27] = t78; - H[28] = (t35 + t16 * t16 * t31 * 2.0) + t20 * 4.0; - H[29] = t100; - H[30] = t99; - H[31] = t93; - H[32] = t77; - H[33] = t22; - H[34] = t100; - H[35] = (t33 + t15 * t15 * t31 * 2.0) - t76 * 4.0; - } - - template - MUDA_GENERIC void H_PE3D(T v01, T v02, T v03, T v11, T v12, T v13, T v21, T v22, T v23, T H[81]) - { - T t17; - T t18; - T t19; - T t20; - T t21; - T t22; - T t23; - T t24; - T t25; - T t26; - T t27; - T t28; - T t35; - T t36; - T t37; - T t50; - T t51; - T t52; - T t53; - T t54; - T t55; - T t56; - T t62; - T t70; - T t71; - T t75; - T t79; - T t80; - T t84; - T t88; - T t38; - T t39; - T t40; - T t41; - T t42; - T t43; - T t44; - T t46; - T t48; - T t57; - T t58; - T t60; - T t63; - T t65; - T t67; - T t102; - T t103; - T t104; - T t162; - T t163; - T t164; - T t213; - T t214; - T t215; - T t216; - T t217; - T t218; - T t225; - T t226; - T t227; - T t229; - T t230; - T t311; - T t231; - T t232; - T t233; - T t234; - T t235; - T t236; - T t237; - T t238; - T t239; - T t240; - T t245; - T t279; - T t281; - T t282; - T t283; - T t287; - T t289; - T t247; - T t248; - T t249; - T t250; - T t251; - T t252; - T t253; - T t293; - T t295; - T t299; - T t300; - T t303; - T t304; - T t294; - T t297; - T t301; - T t302; - - /* H_PE */ - /* H = H_PE(V01,V02,V03,V11,V12,V13,V21,V22,V23) */ - /* This function was generated by the Symbolic Math Toolbox version 8.3. */ - /* 10-Jun-2019 18:02:39 */ - t17 = -v11 + v01; - t18 = -v12 + v02; - t19 = -v13 + v03; - t20 = -v21 + v01; - t21 = -v22 + v02; - t22 = -v23 + v03; - t23 = -v21 + v11; - t24 = -v22 + v12; - t25 = -v23 + v13; - t26 = v11 * 2.0 + -(v21 * 2.0); - t27 = v12 * 2.0 + -(v22 * 2.0); - t28 = v13 * 2.0 + -(v23 * 2.0); - t35 = t23 * t23; - t36 = t24 * t24; - t37 = t25 * t25; - t50 = t17 * t21; - t51 = t18 * t20; - t52 = t17 * t22; - t53 = t19 * t20; - t54 = t18 * t22; - t55 = t19 * t21; - t56 = t17 * t20 * 2.0; - t62 = t18 * t21 * 2.0; - t70 = t19 * t22 * 2.0; - t71 = t17 * t23 * 2.0; - t75 = t18 * t24 * 2.0; - t79 = t19 * t25 * 2.0; - t80 = t20 * t23 * 2.0; - t84 = t21 * t24 * 2.0; - t88 = t22 * t25 * 2.0; - t38 = t17 * t17 * 2.0; - t39 = t18 * t18 * 2.0; - t40 = t19 * t19 * 2.0; - t41 = t20 * t20 * 2.0; - t42 = t21 * t21 * 2.0; - t43 = t22 * t22 * 2.0; - t44 = t35 * 2.0; - t46 = t36 * 2.0; - t48 = t37 * 2.0; - t57 = t50 * 2.0; - t58 = t51 * 2.0; - t60 = t52 * 2.0; - t63 = t53 * 2.0; - t65 = t54 * 2.0; - t67 = t55 * 2.0; - t102 = 1.0 / ((t35 + t36) + t37); - t36 = t50 + -t51; - t35 = t52 + -t53; - t37 = t54 + -t55; - t103 = t102 * t102; - t104 = pow(t102, 3.0); - t162 = -(t23 * t24 * t102 * 2.0); - t163 = -(t23 * t25 * t102 * 2.0); - t164 = -(t24 * t25 * t102 * 2.0); - t213 = t18 * t36 * 2.0 + t19 * t35 * 2.0; - t214 = t17 * t35 * 2.0 + t18 * t37 * 2.0; - t215 = t21 * t36 * 2.0 + t22 * t35 * 2.0; - t216 = t20 * t35 * 2.0 + t21 * t37 * 2.0; - t217 = t24 * t36 * 2.0 + t25 * t35 * 2.0; - t218 = t23 * t35 * 2.0 + t24 * t37 * 2.0; - t35 = (t36 * t36 + t35 * t35) + t37 * t37; - t225 = t17 * t36 * 2.0 + -(t19 * t37 * 2.0); - t226 = t20 * t36 * 2.0 + -(t22 * t37 * 2.0); - t227 = t23 * t36 * 2.0 + -(t25 * t37 * 2.0); - t36 = t26 * t103; - t229 = t36 * t213; - t37 = t27 * t103; - t230 = t37 * t213; - t311 = t28 * t103; - t231 = t311 * t213; - t232 = t36 * t214; - t233 = t37 * t214; - t234 = t311 * t214; - t235 = t36 * t215; - t236 = t37 * t215; - t237 = t311 * t215; - t238 = t36 * t216; - t239 = t37 * t216; - t240 = t311 * t216; - t214 = t36 * t217; - t215 = t37 * t217; - t216 = t311 * t217; - t217 = t36 * t218; - t245 = t37 * t218; - t213 = t311 * t218; - t279 = t103 * t35 * 2.0; - t281 = t26 * t26 * t104 * t35 * 2.0; - t282 = t27 * t27 * t104 * t35 * 2.0; - t283 = t28 * t28 * t104 * t35 * 2.0; - t287 = t26 * t27 * t104 * t35 * 2.0; - t218 = t26 * t28 * t104 * t35 * 2.0; - t289 = t27 * t28 * t104 * t35 * 2.0; - t247 = t36 * t225; - t248 = t37 * t225; - t249 = t311 * t225; - t250 = t36 * t226; - t251 = t37 * t226; - t252 = t311 * t226; - t253 = t36 * t227; - t35 = t37 * t227; - t36 = t311 * t227; - t293 = t102 * (t75 + t79) + t214; - t295 = -(t102 * (t80 + t84)) + t213; - t299 = t102 * ((t63 + t22 * t23 * 2.0) + -t60) + t217; - t300 = t102 * ((t67 + t22 * t24 * 2.0) + -t65) + t245; - t303 = -(t102 * ((t57 + t17 * t24 * 2.0) + -t58)) + t215; - t304 = -(t102 * ((t60 + t17 * t25 * 2.0) + -t63)) + t216; - t294 = t102 * (t71 + t75) + -t213; - t297 = -(t102 * (t80 + t88)) + t35; - t88 = -(t102 * (t84 + t88)) + -t214; - t301 = t102 * ((t58 + t21 * t23 * 2.0) + -t57) + t253; - t302 = t102 * ((t65 + t21 * t25 * 2.0) + -t67) + t36; - t84 = t102 * ((t57 + t20 * t24 * 2.0) + -t58) + -t215; - t80 = t102 * ((t60 + t20 * t25 * 2.0) + -t63) + -t216; - t75 = -(t102 * ((t63 + t19 * t23 * 2.0) + -t60)) + -t217; - t227 = -(t102 * ((t67 + t19 * t24 * 2.0) + -t65)) + -t245; - t311 = ((-(t17 * t19 * t102 * 2.0) + t231) + -t232) + t218; - t245 = ((-(t20 * t22 * t102 * 2.0) + t237) + -t238) + t218; - t226 = ((-t102 * (t67 - t54 * 4.0) + t233) + t252) + -t289; - t28 = ((-t102 * (t63 - t52 * 4.0) + t232) + -t237) + -t218; - t27 = ((-t102 * (t58 - t50 * 4.0) + t247) + -t236) + -t287; - t225 = ((-(t102 * (t65 + -(t55 * 4.0))) + t239) + t249) + -t289; - t26 = ((-(t102 * (t60 + -(t53 * 4.0))) + t238) + -t231) + -t218; - t103 = ((-(t102 * (t57 + -(t51 * 4.0))) + t250) + -t230) + -t287; - t104 = (((-(t102 * (t56 + t62)) + t234) + t240) + t279) + -t283; - t218 = (((-(t102 * (t56 + t70)) + t248) + t251) + t279) + -t282; - t217 = (((-(t102 * (t62 + t70)) + -t229) + -t235) + t279) + -t281; - t216 = t102 * (t71 + t79) + -t35; - t215 = -(t102 * ((t58 + t18 * t23 * 2.0) + -t57)) + -t253; - t214 = -(t102 * ((t65 + t18 * t25 * 2.0) + -t67)) + -t36; - t213 = ((-(t17 * t18 * t102 * 2.0) + t230) + -t247) + t287; - t37 = ((-(t20 * t21 * t102 * 2.0) + t236) + -t250) + t287; - t36 = ((-(t18 * t19 * t102 * 2.0) + -t233) + -t249) + t289; - t35 = ((-(t21 * t22 * t102 * 2.0) + -t239) + -t252) + t289; - H[0] = t102 * (t46 + t48); - H[1] = t162; - H[2] = t163; - H[3] = t88; - H[4] = t84; - H[5] = t80; - H[6] = t293; - H[7] = t303; - H[8] = t304; - H[9] = t162; - H[10] = t102 * (t44 + t48); - H[11] = t164; - H[12] = t301; - H[13] = t297; - H[14] = t302; - H[15] = t215; - H[16] = t216; - H[17] = t214; - H[18] = t163; - H[19] = t164; - H[20] = t102 * (t44 + t46); - H[21] = t299; - H[22] = t300; - H[23] = t295; - H[24] = t75; - H[25] = t227; - H[26] = t294; - H[27] = t88; - H[28] = t301; - H[29] = t299; - H[30] = ((t235 * 2.0 + -t279) + t281) + t102 * (t42 + t43); - H[31] = t37; - H[32] = t245; - H[33] = t217; - H[34] = t27; - H[35] = t28; - H[36] = t84; - H[37] = t297; - H[38] = t300; - H[39] = t37; - H[40] = ((t251 * -2.0 + -t279) + t282) + t102 * (t41 + t43); - H[41] = t35; - H[42] = t103; - H[43] = t218; - H[44] = t226; - H[45] = t80; - H[46] = t302; - H[47] = t295; - H[48] = t245; - H[49] = t35; - H[50] = ((t240 * -2.0 + -t279) + t283) + t102 * (t41 + t42); - H[51] = t26; - H[52] = t225; - H[53] = t104; - H[54] = t293; - H[55] = t215; - H[56] = t75; - H[57] = t217; - H[58] = t103; - H[59] = t26; - H[60] = ((t229 * 2.0 + -t279) + t281) + t102 * (t39 + t40); - H[61] = t213; - H[62] = t311; - H[63] = t303; - H[64] = t216; - H[65] = t227; - H[66] = t27; - H[67] = t218; - H[68] = t225; - H[69] = t213; - H[70] = ((t248 * -2.0 + -t279) + t282) + t102 * (t38 + t40); - H[71] = t36; - H[72] = t304; - H[73] = t214; - H[74] = t294; - H[75] = t28; - H[76] = t226; - H[77] = t104; - H[78] = t311; - H[79] = t36; - H[80] = ((t234 * -2.0 + -t279) + t283) + t102 * (t38 + t39); - } -} // namespace details - - -template -MUDA_GENERIC void point_edge_distance_gradient(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1, - Eigen::Vector& grad) -{ - if constexpr(dim == 2) - { - details::g_PE2D(p[0], p[1], e0[0], e0[1], e1[0], e1[1], grad.data()); - } - else - { - details::g_PE3D(p[0], p[1], p[2], e0[0], e0[1], e0[2], e1[0], e1[1], e1[2], grad.data()); - } -} - -template -MUDA_GENERIC void point_edge_distance_hessian(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1, - Eigen::Matrix& Hessian) -{ - if constexpr(dim == 2) - { - details::H_PE2D(p[0], p[1], e0[0], e0[1], e1[0], e1[1], Hessian.data()); - } - else - { - details::H_PE3D( - p[0], p[1], p[2], e0[0], e0[1], e0[2], e1[0], e1[1], e1[2], Hessian.data()); - } -} -} // namespace muda::distance \ No newline at end of file diff --git a/src/muda/ext/geo/distance/details/point_point.inl b/src/muda/ext/geo/distance/details/point_point.inl deleted file mode 100644 index 439649d2..00000000 --- a/src/muda/ext/geo/distance/details/point_point.inl +++ /dev/null @@ -1,38 +0,0 @@ -namespace muda::distance -{ -template -MUDA_GENERIC void point_point_distance(const Eigen::Vector& a, - const Eigen::Vector& b, - T& dist2) -{ - dist2 = (a - b).squaredNorm(); -} - -template -MUDA_GENERIC void point_point_distance_gradient(const Eigen::Vector& a, - const Eigen::Vector& b, - Eigen::Vector& grad) -{ - grad.template segment(0) = 2.0 * (a - b); - grad.template segment(dim) = -grad.template segment(0); -} - -template -MUDA_GENERIC void point_point_distance_hessian(const Eigen::Vector& a, - const Eigen::Vector& b, - Eigen::Matrix& Hessian) -{ - Hessian.setZero(); - Hessian.diagonal().setConstant(2.0); - if constexpr(dim == 2) - { - Hessian(0, 2) = Hessian(1, 3) = Hessian(2, 0) = Hessian(3, 1) = -2.0; - } - else - { - Hessian(0, 3) = Hessian(1, 4) = Hessian(2, 5) = Hessian(3, 0) = - Hessian(4, 1) = Hessian(5, 2) = -2.0; - } -} - -} // namespace muda::distance \ No newline at end of file diff --git a/src/muda/ext/geo/distance/details/point_triangle.inl b/src/muda/ext/geo/distance/details/point_triangle.inl deleted file mode 100644 index 9b6cc307..00000000 --- a/src/muda/ext/geo/distance/details/point_triangle.inl +++ /dev/null @@ -1,703 +0,0 @@ -#include - -namespace muda::distance -{ -namespace details -{ - template - MUDA_GENERIC void g_PT( - T v01, T v02, T v03, T v11, T v12, T v13, T v21, T v22, T v23, T v31, T v32, T v33, T g[12]) - { - T t11; - T t12; - T t13; - T t14; - T t15; - T t16; - T t17; - T t18; - T t19; - T t20; - T t21; - T t22; - T t32; - T t33; - T t34; - T t43; - T t45; - T t44; - T t46; - - /* G_PT */ - /* G = G_PT(V01,V02,V03,V11,V12,V13,V21,V22,V23,V31,V32,V33) */ - /* This function was generated by the Symbolic Math Toolbox version 8.3. */ - /* 10-Jun-2019 17:42:16 */ - t11 = -v11 + v01; - t12 = -v12 + v02; - t13 = -v13 + v03; - t14 = -v21 + v11; - t15 = -v22 + v12; - t16 = -v23 + v13; - t17 = -v31 + v11; - t18 = -v32 + v12; - t19 = -v33 + v13; - t20 = -v31 + v21; - t21 = -v32 + v22; - t22 = -v33 + v23; - t32 = t14 * t18 + -(t15 * t17); - t33 = t14 * t19 + -(t16 * t17); - t34 = t15 * t19 + -(t16 * t18); - t43 = 1.0 / ((t32 * t32 + t33 * t33) + t34 * t34); - t45 = (t13 * t32 + t11 * t34) + -(t12 * t33); - t44 = t43 * t43; - t46 = t45 * t45; - g[0] = t34 * t43 * t45 * 2.0; - g[1] = t33 * t43 * t45 * -2.0; - g[2] = t32 * t43 * t45 * 2.0; - t45 *= t43; - g[3] = -t44 * t46 * (t21 * t32 * 2.0 + t22 * t33 * 2.0) - - t45 * ((t34 + t12 * t22) - t13 * t21) * 2.0; - t43 = t44 * t46; - g[4] = t43 * (t20 * t32 * 2.0 - t22 * t34 * 2.0) - + t45 * ((t33 + t11 * t22) - t13 * t20) * 2.0; - g[5] = t43 * (t20 * t33 * 2.0 + t21 * t34 * 2.0) - - t45 * ((t32 + t11 * t21) - t12 * t20) * 2.0; - g[6] = t45 * (t12 * t19 - t13 * t18) * 2.0 - + t43 * (t18 * t32 * 2.0 + t19 * t33 * 2.0); - g[7] = t45 * (t11 * t19 - t13 * t17) * -2.0 - - t43 * (t17 * t32 * 2.0 - t19 * t34 * 2.0); - g[8] = t45 * (t11 * t18 - t12 * t17) * 2.0 - - t43 * (t17 * t33 * 2.0 + t18 * t34 * 2.0); - g[9] = t45 * (t12 * t16 - t13 * t15) * -2.0 - - t43 * (t15 * t32 * 2.0 + t16 * t33 * 2.0); - g[10] = t45 * (t11 * t16 - t13 * t14) * 2.0 - + t43 * (t14 * t32 * 2.0 - t16 * t34 * 2.0); - g[11] = t45 * (t11 * t15 - t12 * t14) * -2.0 - + t43 * (t14 * t33 * 2.0 + t15 * t34 * 2.0); - } - - template - MUDA_GENERIC void H_PT( - T v01, T v02, T v03, T v11, T v12, T v13, T v21, T v22, T v23, T v31, T v32, T v33, T H[144]) - { - T t11; - T t12; - T t13; - T t18; - T t20; - T t22; - T t23; - T t24; - T t25; - T t26; - T t27; - T t28; - T t65; - T t66; - T t67; - T t68; - T t69; - T t70; - T t71; - T t77; - T t85; - T t86; - T t90; - T t94; - T t95; - T t99; - T t103; - T t38; - T t39; - T t40; - T t41; - T t42; - T t43; - T t44; - T t45; - T t46; - T t72; - T t73; - T t75; - T t78; - T t80; - T t82; - T t125; - T t126; - T t127; - T t128; - T t129; - T t130; - T t131; - T t133; - T t135; - T t149; - T t150; - T t151; - T t189; - T t190; - T t191; - T t192; - T t193; - T t194; - T t195; - T t196; - T t197; - T t198; - T t199; - T t200; - T t202; - T t205; - T t203; - T t204; - T t206; - T t241; - T t309; - T t310; - T t312; - T t313; - T t314; - T t315; - T t316; - T t317; - T t318; - T t319; - T t321; - T t322; - T t323; - T t324; - T t325; - T t261; - T t262; - T t599; - T t600; - T t602; - T t605; - T t609; - T t610; - T t611; - T t613; - T t615; - T t616; - T t621; - T t622; - T t623; - T t625; - T t645; - T t646_tmp; - T t646; - T t601; - T t603; - T t604; - T t606; - T t607; - T t608; - T t612; - T t614; - T t617; - T t618; - T t619; - T t620; - T t624; - T t626; - T t627; - T t628; - T t629; - T t630; - T t631; - T t632; - T t633; - T t634; - T t635; - T t636; - T t637; - T t638; - - /* H_PT */ - /* H = H_PT(V01,V02,V03,V11,V12,V13,V21,V22,V23,V31,V32,V33) */ - /* This function was generated by the Symbolic Math Toolbox version 8.3. */ - /* 10-Jun-2019 17:42:25 */ - t11 = -v11 + v01; - t12 = -v12 + v02; - t13 = -v13 + v03; - t18 = -v21 + v11; - t20 = -v22 + v12; - t22 = -v23 + v13; - t23 = -v31 + v11; - t24 = -v32 + v12; - t25 = -v33 + v13; - t26 = -v31 + v21; - t27 = -v32 + v22; - t28 = -v33 + v23; - t65 = t18 * t24; - t66 = t20 * t23; - t67 = t18 * t25; - t68 = t22 * t23; - t69 = t20 * t25; - t70 = t22 * t24; - t71 = t18 * t23 * 2.0; - t77 = t20 * t24 * 2.0; - t85 = t22 * t25 * 2.0; - t86 = t18 * t26 * 2.0; - t90 = t20 * t27 * 2.0; - t94 = t22 * t28 * 2.0; - t95 = t23 * t26 * 2.0; - t99 = t24 * t27 * 2.0; - t103 = t25 * t28 * 2.0; - t38 = t18 * t18 * 2.0; - t39 = t20 * t20 * 2.0; - t40 = t22 * t22 * 2.0; - t41 = t23 * t23 * 2.0; - t42 = t24 * t24 * 2.0; - t43 = t25 * t25 * 2.0; - t44 = t26 * t26 * 2.0; - t45 = t27 * t27 * 2.0; - t46 = t28 * t28 * 2.0; - t72 = t65 * 2.0; - t73 = t66 * 2.0; - t75 = t67 * 2.0; - t78 = t68 * 2.0; - t80 = t69 * 2.0; - t82 = t70 * 2.0; - t125 = t11 * t20 + -(t12 * t18); - t126 = t11 * t22 + -(t13 * t18); - t127 = t12 * t22 + -(t13 * t20); - t128 = t11 * t24 + -(t12 * t23); - t129 = t11 * t25 + -(t13 * t23); - t130 = t12 * t25 + -(t13 * t24); - t131 = t65 + -t66; - t133 = t67 + -t68; - t135 = t69 + -t70; - t149 = t131 * t131; - t150 = t133 * t133; - t151 = t135 * t135; - t189 = (t11 * t27 + -(t12 * t26)) + t131; - t190 = (t11 * t28 + -(t13 * t26)) + t133; - t191 = (t12 * t28 + -(t13 * t27)) + t135; - t192 = t20 * t131 * 2.0 + t22 * t133 * 2.0; - t193 = t18 * t133 * 2.0 + t20 * t135 * 2.0; - t194 = t24 * t131 * 2.0 + t25 * t133 * 2.0; - t195 = t23 * t133 * 2.0 + t24 * t135 * 2.0; - t196 = t27 * t131 * 2.0 + t28 * t133 * 2.0; - t197 = t26 * t133 * 2.0 + t27 * t135 * 2.0; - t198 = t18 * t131 * 2.0 + -(t22 * t135 * 2.0); - t199 = t23 * t131 * 2.0 + -(t25 * t135 * 2.0); - t200 = t26 * t131 * 2.0 + -(t28 * t135 * 2.0); - t202 = 1.0 / ((t149 + t150) + t151); - t205 = (t13 * t131 + t11 * t135) + -(t12 * t133); - t203 = t202 * t202; - t204 = pow(t202, 3.0); - t206 = t205 * t205; - t241 = t131 * t135 * t202 * 2.0; - t309 = t11 * t202 * t205 * 2.0; - t310 = t12 * t202 * t205 * 2.0; - t13 = t13 * t202 * t205 * 2.0; - t312 = (-v21 + v01) * t202 * t205 * 2.0; - t313 = (-v22 + v02) * t202 * t205 * 2.0; - t314 = (-v23 + v03) * t202 * t205 * 2.0; - t315 = (-v31 + v01) * t202 * t205 * 2.0; - t316 = t18 * t202 * t205 * 2.0; - t317 = (-v32 + v02) * t202 * t205 * 2.0; - t318 = t20 * t202 * t205 * 2.0; - t319 = (-v33 + v03) * t202 * t205 * 2.0; - t11 = t22 * t202 * t205 * 2.0; - t321 = t23 * t202 * t205 * 2.0; - t322 = t24 * t202 * t205 * 2.0; - t323 = t25 * t202 * t205 * 2.0; - t324 = t26 * t202 * t205 * 2.0; - t325 = t27 * t202 * t205 * 2.0; - t12 = t28 * t202 * t205 * 2.0; - t261 = -(t131 * t133 * t202 * 2.0); - t262 = -(t133 * t135 * t202 * 2.0); - t599 = t130 * t135 * t202 * 2.0 + t135 * t194 * t203 * t205 * 2.0; - t600 = -(t125 * t131 * t202 * 2.0) + t131 * t193 * t203 * t205 * 2.0; - t602 = t129 * t133 * t202 * 2.0 + t133 * t199 * t203 * t205 * 2.0; - t605 = -(t131 * t189 * t202 * 2.0) + t131 * t197 * t203 * t205 * 2.0; - t609 = (t127 * t133 * t202 * 2.0 + -t11) + t133 * t192 * t203 * t205 * 2.0; - t610 = (t126 * t135 * t202 * 2.0 + t11) + t135 * t198 * t203 * t205 * 2.0; - t611 = (t130 * t131 * t202 * 2.0 + -t322) + t131 * t194 * t203 * t205 * 2.0; - t613 = (t126 * t131 * t202 * 2.0 + -t316) + t131 * t198 * t203 * t205 * 2.0; - t615 = (-(t125 * t135 * t202 * 2.0) + -t318) + t135 * t193 * t203 * t205 * 2.0; - t616 = (-(t128 * t133 * t202 * 2.0) + -t321) + t133 * t195 * t203 * t205 * 2.0; - t621 = (t133 * t191 * t202 * 2.0 + -t12) + t133 * t196 * t203 * t205 * 2.0; - t622 = (t135 * t190 * t202 * 2.0 + t12) + t135 * t200 * t203 * t205 * 2.0; - t623 = (t131 * t190 * t202 * 2.0 + -t324) + t131 * t200 * t203 * t205 * 2.0; - t625 = (-(t135 * t189 * t202 * 2.0) + -t325) + t135 * t197 * t203 * t205 * 2.0; - t645 = ((((t127 * t129 * t202 * 2.0 + -t13) + (t72 + -(t66 * 4.0)) * t203 * t206) - + t129 * t192 * t203 * t205 * 2.0) - + t127 * t199 * t203 * t205 * 2.0) - + t192 * t199 * t204 * t206 * 2.0; - t646_tmp = t203 * t206; - t646 = ((((t126 * t130 * t202 * 2.0 + t13) + t646_tmp * (t73 - t65 * 4.0)) - + t126 * t194 * t203 * t205 * 2.0) - + t130 * t198 * t203 * t205 * 2.0) - + t194 * t198 * t204 * t206 * 2.0; - t601 = t128 * t131 * t202 * 2.0 + -(t131 * t195 * t203 * t205 * 2.0); - t603 = -(t127 * t135 * t202 * 2.0) + -(t135 * t192 * t203 * t205 * 2.0); - t604 = -(t126 * t133 * t202 * 2.0) + -(t133 * t198 * t203 * t205 * 2.0); - t606 = -(t135 * t191 * t202 * 2.0) + -(t135 * t196 * t203 * t205 * 2.0); - t607 = -(t133 * t190 * t202 * 2.0) + -(t133 * t200 * t203 * t205 * 2.0); - t608 = (t125 * t133 * t202 * 2.0 + t316) + -(t133 * t193 * t203 * t205 * 2.0); - t612 = (t128 * t135 * t202 * 2.0 + t322) + -(t135 * t195 * t203 * t205 * 2.0); - t614 = (-(t127 * t131 * t202 * 2.0) + t318) + -(t131 * t192 * t203 * t205 * 2.0); - t617 = (-(t130 * t133 * t202 * 2.0) + t323) + -(t133 * t194 * t203 * t205 * 2.0); - t618 = (-(t129 * t131 * t202 * 2.0) + t321) + -(t131 * t199 * t203 * t205 * 2.0); - t619 = (-(t129 * t135 * t202 * 2.0) + -t323) + -(t135 * t199 * t203 * t205 * 2.0); - t620 = (t133 * t189 * t202 * 2.0 + t324) + -(t133 * t197 * t203 * t205 * 2.0); - t624 = (-(t131 * t191 * t202 * 2.0) + t325) + -(t131 * t196 * t203 * t205 * 2.0); - t626 = (((t125 * t127 * t202 * 2.0 + t18 * t22 * t203 * t206 * 2.0) - + t125 * t192 * t203 * t205 * 2.0) - + -(t127 * t193 * t203 * t205 * 2.0)) - + -(t192 * t193 * t204 * t206 * 2.0); - t627 = (((t128 * t130 * t202 * 2.0 + t23 * t25 * t203 * t206 * 2.0) - + t128 * t194 * t203 * t205 * 2.0) - + -(t130 * t195 * t203 * t205 * 2.0)) - + -(t194 * t195 * t204 * t206 * 2.0); - t628 = (((-(t125 * t126 * t202 * 2.0) + t20 * t22 * t203 * t206 * 2.0) - + t126 * t193 * t203 * t205 * 2.0) - + -(t125 * t198 * t203 * t205 * 2.0)) - + t193 * t198 * t204 * t206 * 2.0; - t629 = (((-(t128 * t129 * t202 * 2.0) + t24 * t25 * t203 * t206 * 2.0) - + t129 * t195 * t203 * t205 * 2.0) - + -(t128 * t199 * t203 * t205 * 2.0)) - + t195 * t199 * t204 * t206 * 2.0; - t630 = (((-(t126 * t127 * t202 * 2.0) + t18 * t20 * t203 * t206 * 2.0) - + -(t126 * t192 * t203 * t205 * 2.0)) - + -(t127 * t198 * t203 * t205 * 2.0)) - + -(t192 * t198 * t204 * t206 * 2.0); - t631 = (((-(t129 * t130 * t202 * 2.0) + t23 * t24 * t203 * t206 * 2.0) - + -(t129 * t194 * t203 * t205 * 2.0)) - + -(t130 * t199 * t203 * t205 * 2.0)) - + -(t194 * t199 * t204 * t206 * 2.0); - t632 = (((-(t125 * t128 * t202 * 2.0) + (t71 + t77) * t203 * t206) - + t128 * t193 * t203 * t205 * 2.0) - + t125 * t195 * t203 * t205 * 2.0) - + -(t193 * t195 * t204 * t206 * 2.0); - t633 = (((-(t127 * t130 * t202 * 2.0) + (t77 + t85) * t203 * t206) - + -(t130 * t192 * t203 * t205 * 2.0)) - + -(t127 * t194 * t203 * t205 * 2.0)) - + -(t192 * t194 * t204 * t206 * 2.0); - t634 = (((-(t126 * t129 * t202 * 2.0) + (t71 + t85) * t203 * t206) - + -(t129 * t198 * t203 * t205 * 2.0)) - + -(t126 * t199 * t203 * t205 * 2.0)) - + -(t198 * t199 * t204 * t206 * 2.0); - t635 = (((t127 * t191 * t202 * 2.0 + -((t90 + t94) * t203 * t206)) - + t127 * t196 * t203 * t205 * 2.0) - + t191 * t192 * t203 * t205 * 2.0) - + t192 * t196 * t204 * t206 * 2.0; - t636 = (((-(t128 * t189 * t202 * 2.0) + (t95 + t99) * t203 * t206) - + t128 * t197 * t203 * t205 * 2.0) - + t189 * t195 * t203 * t205 * 2.0) - + -(t195 * t197 * t204 * t206 * 2.0); - t637 = (((t125 * t189 * t202 * 2.0 + -((t86 + t90) * t203 * t206)) - + -(t125 * t197 * t203 * t205 * 2.0)) - + -(t189 * t193 * t203 * t205 * 2.0)) - + t193 * t197 * t204 * t206 * 2.0; - t638 = (((-(t130 * t191 * t202 * 2.0) + (t99 + t103) * t203 * t206) - + -(t130 * t196 * t203 * t205 * 2.0)) - + -(t191 * t194 * t203 * t205 * 2.0)) - + -(t194 * t196 * t204 * t206 * 2.0); - t86 = (((t126 * t190 * t202 * 2.0 + -((t86 + t94) * t203 * t206)) - + t126 * t200 * t203 * t205 * 2.0) - + t190 * t198 * t203 * t205 * 2.0) - + t198 * t200 * t204 * t206 * 2.0; - t71 = (((-(t129 * t190 * t202 * 2.0) + (t95 + t103) * t203 * t206) - + -(t129 * t200 * t203 * t205 * 2.0)) - + -(t190 * t199 * t203 * t205 * 2.0)) - + -(t199 * t200 * t204 * t206 * 2.0); - t85 = (((t189 * t191 * t202 * 2.0 + t26 * t28 * t203 * t206 * 2.0) - + t189 * t196 * t203 * t205 * 2.0) - + -(t191 * t197 * t203 * t205 * 2.0)) - + -(t196 * t197 * t204 * t206 * 2.0); - t90 = (((-(t189 * t190 * t202 * 2.0) + t27 * t28 * t203 * t206 * 2.0) - + t190 * t197 * t203 * t205 * 2.0) - + -(t189 * t200 * t203 * t205 * 2.0)) - + t197 * t200 * t204 * t206 * 2.0; - t99 = (((-(t190 * t191 * t202 * 2.0) + t26 * t27 * t203 * t206 * 2.0) - + -(t190 * t196 * t203 * t205 * 2.0)) - + -(t191 * t200 * t203 * t205 * 2.0)) - + -(t196 * t200 * t204 * t206 * 2.0); - t77 = ((((-(t127 * t128 * t202 * 2.0) + t310) + (t75 + -(t68 * 4.0)) * t203 * t206) - + t127 * t195 * t203 * t205 * 2.0) - + -(t128 * t192 * t203 * t205 * 2.0)) - + t192 * t195 * t204 * t206 * 2.0; - t131 = ((((t126 * t128 * t202 * 2.0 + -t309) + (t80 + -(t70 * 4.0)) * t203 * t206) - + t128 * t198 * t203 * t205 * 2.0) - + -(t126 * t195 * t203 * t205 * 2.0)) - + -(t195 * t198 * t204 * t206 * 2.0); - t133 = ((((-(t125 * t130 * t202 * 2.0) + -t310) + t646_tmp * (t78 - t67 * 4.0)) - + t130 * t193 * t203 * t205 * 2.0) - + -(t125 * t194 * t203 * t205 * 2.0)) - + t193 * t194 * t204 * t206 * 2.0; - t325 = ((((t125 * t129 * t202 * 2.0 + t309) + t646_tmp * (t82 - t69 * 4.0)) - + t125 * t199 * t203 * t205 * 2.0) - + -(t129 * t193 * t203 * t205 * 2.0)) - + -(t193 * t199 * t204 * t206 * 2.0); - t135 = ((((t125 * t191 * t202 * 2.0 + t313) + ((t75 + t18 * t28 * 2.0) + -t78) * t203 * t206) - + t125 * t196 * t203 * t205 * 2.0) - + -(t191 * t193 * t203 * t205 * 2.0)) - + -(t193 * t196 * t204 * t206 * 2.0); - t324 = ((((t127 * t189 * t202 * 2.0 + -t313) + ((t78 + t22 * t26 * 2.0) + -t75) * t203 * t206) - + -(t127 * t197 * t203 * t205 * 2.0)) - + t189 * t192 * t203 * t205 * 2.0) - + -(t192 * t197 * t204 * t206 * 2.0); - t318 = ((((-(t126 * t189 * t202 * 2.0) + t312) - + ((t82 + t22 * t27 * 2.0) + -t80) * t203 * t206) - + t126 * t197 * t203 * t205 * 2.0) - + -(t189 * t198 * t203 * t205 * 2.0)) - + t197 * t198 * t204 * t206 * 2.0; - t321 = ((((-(t130 * t189 * t202 * 2.0) + t317) - + -(((t78 + t25 * t26 * 2.0) + -t75) * t203 * t206)) - + t130 * t197 * t203 * t205 * 2.0) - + -(t189 * t194 * t203 * t205 * 2.0)) - + t194 * t197 * t204 * t206 * 2.0; - t323 = ((((t129 * t191 * t202 * 2.0 + t319) - + -(((t72 + t23 * t27 * 2.0) + -t73) * t203 * t206)) - + t129 * t196 * t203 * t205 * 2.0) - + t191 * t199 * t203 * t205 * 2.0) - + t196 * t199 * t204 * t206 * 2.0; - t322 = ((((-(t125 * t190 * t202 * 2.0) + -t312) - + ((t80 + t20 * t28 * 2.0) + -t82) * t203 * t206) - + -(t125 * t200 * t203 * t205 * 2.0)) - + t190 * t193 * t203 * t205 * 2.0) - + t193 * t200 * t204 * t206 * 2.0; - t316 = ((((t130 * t190 * t202 * 2.0 + -t319) - + -(((t73 + t24 * t26 * 2.0) + -t72) * t203 * t206)) - + t130 * t200 * t203 * t205 * 2.0) - + t190 * t194 * t203 * t205 * 2.0) - + t194 * t200 * t204 * t206 * 2.0; - t65 = ((((-(t128 * t191 * t202 * 2.0) + -t317) - + -(((t75 + t23 * t28 * 2.0) + -t78) * t203 * t206)) - + -(t128 * t196 * t203 * t205 * 2.0)) - + t191 * t195 * t203 * t205 * 2.0) - + t195 * t196 * t204 * t206 * 2.0; - t66 = ((((-(t127 * t190 * t202 * 2.0) + t314) + ((t73 + t20 * t26 * 2.0) + -t72) * t203 * t206) - + -(t127 * t200 * t203 * t205 * 2.0)) - + -(t190 * t192 * t203 * t205 * 2.0)) - + -(t192 * t200 * t204 * t206 * 2.0); - t13 = ((((t128 * t190 * t202 * 2.0 + t315) - + -(((t80 + t24 * t28 * 2.0) + -t82) * t203 * t206)) - + t128 * t200 * t203 * t205 * 2.0) - + -(t190 * t195 * t203 * t205 * 2.0)) - + -(t195 * t200 * t204 * t206 * 2.0); - t12 = ((((-(t126 * t191 * t202 * 2.0) + -t314) - + ((t72 + t18 * t27 * 2.0) + -t73) * t203 * t206) - + -(t126 * t196 * t203 * t205 * 2.0)) - + -(t191 * t198 * t203 * t205 * 2.0)) - + -(t196 * t198 * t204 * t206 * 2.0); - t11 = ((((t129 * t189 * t202 * 2.0 + -t315) - + -(((t82 + t25 * t27 * 2.0) + -t80) * t203 * t206)) - + -(t129 * t197 * t203 * t205 * 2.0)) - + t189 * t199 * t203 * t205 * 2.0) - + -(t197 * t199 * t204 * t206 * 2.0); - H[0] = t151 * t202 * 2.0; - H[1] = t262; - H[2] = t241; - H[3] = t606; - H[4] = t622; - H[5] = t625; - H[6] = t599; - H[7] = t619; - H[8] = t612; - H[9] = t603; - H[10] = t610; - H[11] = t615; - H[12] = t262; - H[13] = t150 * t202 * 2.0; - H[14] = t261; - H[15] = t621; - H[16] = t607; - H[17] = t620; - H[18] = t617; - H[19] = t602; - H[20] = t616; - H[21] = t609; - H[22] = t604; - H[23] = t608; - H[24] = t241; - H[25] = t261; - H[26] = t149 * t202 * 2.0; - H[27] = t624; - H[28] = t623; - H[29] = t605; - H[30] = t611; - H[31] = t618; - H[32] = t601; - H[33] = t614; - H[34] = t613; - H[35] = t600; - H[36] = t606; - H[37] = t621; - H[38] = t624; - H[39] = ((t191 * t191 * t202 * 2.0 + t196 * t196 * t204 * t206 * 2.0) - - t646_tmp * (t45 + t46)) - + t191 * t196 * t203 * t205 * 4.0; - H[40] = t99; - H[41] = t85; - H[42] = t638; - H[43] = t323; - H[44] = t65; - H[45] = t635; - H[46] = t12; - H[47] = t135; - H[48] = t622; - H[49] = t607; - H[50] = t623; - H[51] = t99; - H[52] = ((t190 * t190 * t202 * 2.0 + t200 * t200 * t204 * t206 * 2.0) - - t646_tmp * (t44 + t46)) - + t190 * t200 * t203 * t205 * 4.0; - H[53] = t90; - H[54] = t316; - H[55] = t71; - H[56] = t13; - H[57] = t66; - H[58] = t86; - H[59] = t322; - H[60] = t625; - H[61] = t620; - H[62] = t605; - H[63] = t85; - H[64] = t90; - H[65] = ((t189 * t189 * t202 * 2.0 + t197 * t197 * t204 * t206 * 2.0) - - t646_tmp * (t44 + t45)) - - t189 * t197 * t203 * t205 * 4.0; - H[66] = t321; - H[67] = t11; - H[68] = t636; - H[69] = t324; - H[70] = t318; - H[71] = t637; - H[72] = t599; - H[73] = t617; - H[74] = t611; - H[75] = t638; - H[76] = t316; - H[77] = t321; - H[78] = ((t130 * t130 * t202 * 2.0 + t194 * t194 * t204 * t206 * 2.0) - - t646_tmp * (t42 + t43)) - + t130 * t194 * t203 * t205 * 4.0; - H[79] = t631; - H[80] = t627; - H[81] = t633; - H[82] = t646; - H[83] = t133; - H[84] = t619; - H[85] = t602; - H[86] = t618; - H[87] = t323; - H[88] = t71; - H[89] = t11; - H[90] = t631; - H[91] = ((t129 * t129 * t202 * 2.0 + t199 * t199 * t204 * t206 * 2.0) - - t646_tmp * (t41 + t43)) - + t129 * t199 * t203 * t205 * 4.0; - H[92] = t629; - H[93] = t645; - H[94] = t634; - H[95] = t325; - H[96] = t612; - H[97] = t616; - H[98] = t601; - H[99] = t65; - H[100] = t13; - H[101] = t636; - H[102] = t627; - H[103] = t629; - H[104] = ((t128 * t128 * t202 * 2.0 + t195 * t195 * t204 * t206 * 2.0) - - t646_tmp * (t41 + t42)) - - t128 * t195 * t203 * t205 * 4.0; - H[105] = t77; - H[106] = t131; - H[107] = t632; - H[108] = t603; - H[109] = t609; - H[110] = t614; - H[111] = t635; - H[112] = t66; - H[113] = t324; - H[114] = t633; - H[115] = t645; - H[116] = t77; - H[117] = ((t127 * t127 * t202 * 2.0 + t192 * t192 * t204 * t206 * 2.0) - - t646_tmp * (t39 + t40)) - + t127 * t192 * t203 * t205 * 4.0; - H[118] = t630; - H[119] = t626; - H[120] = t610; - H[121] = t604; - H[122] = t613; - H[123] = t12; - H[124] = t86; - H[125] = t318; - H[126] = t646; - H[127] = t634; - H[128] = t131; - H[129] = t630; - H[130] = ((t126 * t126 * t202 * 2.0 + t198 * t198 * t204 * t206 * 2.0) - - t646_tmp * (t38 + t40)) - + t126 * t198 * t203 * t205 * 4.0; - H[131] = t628; - H[132] = t615; - H[133] = t608; - H[134] = t600; - H[135] = t135; - H[136] = t322; - H[137] = t637; - H[138] = t133; - H[139] = t325; - H[140] = t632; - H[141] = t626; - H[142] = t628; - H[143] = ((t125 * t125 * t202 * 2.0 + t193 * t193 * t204 * t206 * 2.0) - - t646_tmp * (t38 + t39)) - - t125 * t193 * t203 * t205 * 4.0; - } -} // namespace details - -template -MUDA_GENERIC void point_triangle_distance(const Eigen::Vector& p, - const Eigen::Vector& t0, - const Eigen::Vector& t1, - const Eigen::Vector& t2, - T& dist2) -{ - const Eigen::Vector b = (t1 - t0).cross(t2 - t0); - T aTb = (p - t0).dot(b); - dist2 = aTb * aTb / b.squaredNorm(); -} - -template -MUDA_GENERIC void point_triangle_distance_gradient(const Eigen::Vector& p, - const Eigen::Vector& t0, - const Eigen::Vector& t1, - const Eigen::Vector& t2, - Eigen::Vector& grad) -{ - details::g_PT( - p[0], p[1], p[2], t0[0], t0[1], t0[2], t1[0], t1[1], t1[2], t2[0], t2[1], t2[2], grad.data()); -} - -template -MUDA_GENERIC void point_triangle_distance_hessian(const Eigen::Vector& p, - const Eigen::Vector& t0, - const Eigen::Vector& t1, - const Eigen::Vector& t2, - Eigen::Matrix& Hessian) -{ - details::H_PT(p[0], - p[1], - p[2], - t0[0], - t0[1], - t0[2], - t1[0], - t1[1], - t1[2], - t2[0], - t2[1], - t2[2], - Hessian.data()); -} - -} // namespace muda::distance \ No newline at end of file diff --git a/src/muda/ext/geo/distance/distance_type.h b/src/muda/ext/geo/distance/distance_type.h deleted file mode 100644 index 3cc197ab..00000000 --- a/src/muda/ext/geo/distance/distance_type.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once -#include -#include -#include -#include - -namespace muda::distance -{ -enum class PointPointDistanceType : unsigned char -{ - PP = 0, // point-point, the shortest distance is the distance between the two points -}; - -enum class PointEdgeDistanceType : unsigned char -{ - PP_PE0 = 0, // point-edge, the shortest distance is the distance between the point and the point 0 in edge - PP_PE1 = 1, // point-edge, the shortest distance is the distance between the point and the point 1 in edge - PE = 2, // point-edge, the shortest distance is the distance between the point and some point on the edge -}; - -enum class PointTriangleDistanceType : unsigned char -{ - PP_PT0 = 0, // point-triangle, the closest point is the point 0 in triangle - PP_PT1 = 1, // point-triangle, the closest point is the point 1 in triangle - PP_PT2 = 2, // point-triangle, the closest point is the point 2 in triangle - PE_PT0T1 = 3, // point-triangle, the closest point is on the edge (t0, t1) - PE_PT1T2 = 4, // point-triangle, the closest point is on the edge (t1, t2) - PE_PT2T0 = 5, // point-triangle, the closest point is on the edge (t2, t0) - PT = 6, // point-triangle, the closest point is on the triangle -}; - -enum class EdgeEdgeDistanceType : unsigned char -{ - PP_Ea0Eb0 = 0, // point-point, the shortest distance is the distance between the point 0 in edge a and the point 0 in edge b - PP_Ea0Eb1 = 1, // point-point, the shortest distance is the distance between the point 0 in edge a and the point 1 in edge b - PE_Ea0Eb0Eb1 = 2, // point-edge, the shortest distance is the distance between the point 0 in edge a and some point the edge b - PP_Ea1Eb0 = 3, // point-point, the shortest distance is the distance between the point 1 in edge a and the point 0 in edge b - PP_Ea1Eb1 = 4, // point-point, the shortest distance is the distance between the point 1 in edge a and the point 1 in edge b - PE_Ea1Eb0Eb1 = 5, // point-edge, the shortest distance is the distance between the point 1 in edge a and some point the edge b - PE_Eb0Ea0Ea1 = 6, // point-edge, the shortest distance is the distance between the point 0 in edge b and some point the edge a - PE_Eb1Ea0Ea1 = 7, // point-edge, the shortest distance is the distance between the point 1 in edge b and some point the edge a - EE = 8, // edge-edge, the shortest distance is the distance between some point on edge a and some point on edge b -}; - - -template -MUDA_GENERIC PointPointDistanceType point_point_distance_type( - const Eigen::Vector& p0, const Eigen::Vector& p1); - -template -MUDA_GENERIC PointEdgeDistanceType -point_edge_distance_type(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1); - -template -MUDA_GENERIC PointEdgeDistanceType -point_edge_distance_type(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1, - T& ratio); - -template -MUDA_GENERIC PointTriangleDistanceType -point_triangle_distance_type(const Eigen::Vector& p, - const Eigen::Vector& t0, - const Eigen::Vector& t1, - const Eigen::Vector& t2); - -// a more robust implementation of http://geomalgorithms.com/a07-_distance.html -template -MUDA_GENERIC EdgeEdgeDistanceType edge_edge_distance_type(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1); - -} // namespace muda::distance - -#include "details/distance_type.inl" diff --git a/src/muda/ext/geo/distance/distance_unclassified.h b/src/muda/ext/geo/distance/distance_unclassified.h deleted file mode 100644 index b9883fc4..00000000 --- a/src/muda/ext/geo/distance/distance_unclassified.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include -#include - -namespace muda::distance -{ -template -MUDA_GENERIC void point_point_distance_unclassified(const Eigen::Vector& p0, - const Eigen::Vector& p1, - T& dist2); - -template -MUDA_GENERIC void point_triangle_distance_unclassified(const Eigen::Vector& p, - const Eigen::Vector& t0, - const Eigen::Vector& t1, - const Eigen::Vector& t2, - T& dist2); - -template -MUDA_GENERIC void edge_edge_distance_unclassified(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - T& dist2); - -// http://geomalgorithms.com/a02-_lines.html -template -MUDA_GENERIC void point_edge_distance_unclassified(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1, - T& dist2); - -} // namespace muda::distance - -#include "details/distance_unclassified.inl" diff --git a/src/muda/ext/geo/distance/edge_edge.h b/src/muda/ext/geo/distance/edge_edge.h deleted file mode 100644 index 2454a5e9..00000000 --- a/src/muda/ext/geo/distance/edge_edge.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once -#include -#include - -namespace muda::distance -{ -template -MUDA_GENERIC void edge_edge_distance(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - T& dist2); - -template -MUDA_GENERIC void edge_edge_distance_gradient(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - Eigen::Vector& grad); - -template -MUDA_GENERIC void edge_edge_distance_hessian(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - Eigen::Matrix& Hessian); - -} // namespace muda - -#include "details/edge_edge.inl" diff --git a/src/muda/ext/geo/distance/edge_edge_mollified.h b/src/muda/ext/geo/distance/edge_edge_mollified.h deleted file mode 100644 index 48614cc9..00000000 --- a/src/muda/ext/geo/distance/edge_edge_mollified.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once -#include -#include - -namespace muda::distance -{ -template -MUDA_GENERIC void edge_edge_cross_norm2(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - T& result); - -template -MUDA_GENERIC void edge_edge_cross_norm2_gradient(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - Eigen::Vector& grad); - -template -MUDA_GENERIC void edge_edge_cross_norm2_hessian(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - Eigen::Matrix& Hessian); - -template -MUDA_GENERIC void edge_edge_mollifier(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - T eps_x, - T& e); - -template -MUDA_GENERIC void edge_edge_mollifier_gradient(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - T eps_x, - Eigen::Vector& g); - -template -MUDA_GENERIC void edge_edge_mollifier_hessian(const Eigen::Vector& ea0, - const Eigen::Vector& ea1, - const Eigen::Vector& eb0, - const Eigen::Vector& eb1, - T eps_x, - Eigen::Matrix& H); - -template -MUDA_GENERIC void edge_edge_mollifier_threshold(const Eigen::Vector& ea0_rest, - const Eigen::Vector& ea1_rest, - const Eigen::Vector& eb0_rest, - const Eigen::Vector& eb1_rest, - T& eps_x); -} // namespace muda::distance - -#include "details/edge_edge_mollified.inl" diff --git a/src/muda/ext/geo/distance/point_edge.h b/src/muda/ext/geo/distance/point_edge.h deleted file mode 100644 index 8e707186..00000000 --- a/src/muda/ext/geo/distance/point_edge.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -#include -#include - -namespace muda::distance -{ -template -MUDA_GENERIC void point_edge_distance(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1, - T& dist2); - -template -MUDA_GENERIC void point_edge_distance_gradient(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1, - Eigen::Vector& grad); - -template -MUDA_GENERIC void point_edge_distance_hessian(const Eigen::Vector& p, - const Eigen::Vector& e0, - const Eigen::Vector& e1, - Eigen::Matrix& Hessian); - -} // namespace muda::distance - -#include "details/point_edge.inl" diff --git a/src/muda/ext/geo/distance/point_point.h b/src/muda/ext/geo/distance/point_point.h deleted file mode 100644 index e2d6260a..00000000 --- a/src/muda/ext/geo/distance/point_point.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once -#include -#include - -namespace muda::distance -{ -template -MUDA_GENERIC void point_point_distance(const Eigen::Vector& a, - const Eigen::Vector& b, - T& dist2); - -template -MUDA_GENERIC void point_point_distance_gradient(const Eigen::Vector& a, - const Eigen::Vector& b, - Eigen::Vector& grad); - -template -MUDA_GENERIC void point_point_distance_hessian(const Eigen::Vector& a, - const Eigen::Vector& b, - Eigen::Matrix& Hessian); -} // namespace muda::distance - -#include "details/point_point.inl" diff --git a/src/muda/ext/geo/distance/point_triangle.h b/src/muda/ext/geo/distance/point_triangle.h deleted file mode 100644 index ea001718..00000000 --- a/src/muda/ext/geo/distance/point_triangle.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include -#include - -namespace muda::distance -{ -template -MUDA_GENERIC void point_triangle_distance(const Eigen::Vector& p, - const Eigen::Vector& t0, - const Eigen::Vector& t1, - const Eigen::Vector& t2, - T& dist2); - -template -MUDA_GENERIC void point_triangle_distance_gradient(const Eigen::Vector& p, - const Eigen::Vector& t0, - const Eigen::Vector& t1, - const Eigen::Vector& t2, - Eigen::Vector& grad); - -template -MUDA_GENERIC void point_triangle_distance_hessian(const Eigen::Vector& p, - const Eigen::Vector& t0, - const Eigen::Vector& t1, - const Eigen::Vector& t2, - Eigen::Matrix& Hessian); -} // namespace muda::distance - -#include "details/point_triangle.inl" diff --git a/src/muda/ext/geo/lbvh.h b/src/muda/ext/geo/lbvh.h deleted file mode 100644 index 5d2e7405..00000000 --- a/src/muda/ext/geo/lbvh.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once -#include - -//The main implementation of the LBVH is from Toru Niina (https://github.com/ToruNiina/lbvh) -// with MIT license. -// muda modified the code to fit the muda framework. - -/* -The MIT License (MIT) - -Copyright (c) 2019 Toru Niina - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ \ No newline at end of file diff --git a/src/muda/ext/geo/lbvh/aabb.h b/src/muda/ext/geo/lbvh/aabb.h deleted file mode 100644 index 056fbab2..00000000 --- a/src/muda/ext/geo/lbvh/aabb.h +++ /dev/null @@ -1,150 +0,0 @@ -#pragma once -#include -#include -#include -#include - -namespace muda::lbvh -{ -template -struct AABB -{ - typename vector_of::type upper; - typename vector_of::type lower; - - MUDA_GENERIC AABB() noexcept = default; - MUDA_GENERIC AABB(const AABB&) noexcept = default; - MUDA_GENERIC AABB(AABB&&) noexcept = default; - MUDA_GENERIC AABB& operator=(const AABB&) noexcept = default; - MUDA_GENERIC AABB& operator=(AABB&&) noexcept = default; -}; - -template -MUDA_GENERIC inline bool intersects(const AABB& lhs, const AABB& rhs) noexcept -{ - if(lhs.upper.x < rhs.lower.x || rhs.upper.x < lhs.lower.x) - { - return false; - } - if(lhs.upper.y < rhs.lower.y || rhs.upper.y < lhs.lower.y) - { - return false; - } - if(lhs.upper.z < rhs.lower.z || rhs.upper.z < lhs.lower.z) - { - return false; - } - return true; -} - -MUDA_GENERIC inline AABB merge(const AABB& lhs, const AABB& rhs) noexcept -{ - AABB merged; - merged.upper.x = ::fmax(lhs.upper.x, rhs.upper.x); - merged.upper.y = ::fmax(lhs.upper.y, rhs.upper.y); - merged.upper.z = ::fmax(lhs.upper.z, rhs.upper.z); - merged.lower.x = ::fmin(lhs.lower.x, rhs.lower.x); - merged.lower.y = ::fmin(lhs.lower.y, rhs.lower.y); - merged.lower.z = ::fmin(lhs.lower.z, rhs.lower.z); - return merged; -} - -MUDA_GENERIC inline AABB merge(const AABB& lhs, const AABB& rhs) noexcept -{ - AABB merged; - merged.upper.x = ::fmaxf(lhs.upper.x, rhs.upper.x); - merged.upper.y = ::fmaxf(lhs.upper.y, rhs.upper.y); - merged.upper.z = ::fmaxf(lhs.upper.z, rhs.upper.z); - merged.lower.x = ::fminf(lhs.lower.x, rhs.lower.x); - merged.lower.y = ::fminf(lhs.lower.y, rhs.lower.y); - merged.lower.z = ::fminf(lhs.lower.z, rhs.lower.z); - return merged; -} - -// metrics defined in -// Nearest Neighbor Queries (1995) ACS-SIGMOD -// - Nick Roussopoulos, Stephen Kelley FredericVincent - -MUDA_GENERIC inline float mindist(const AABB& lhs, const float4& rhs) noexcept -{ - const float dx = ::fminf(lhs.upper.x, ::fmaxf(lhs.lower.x, rhs.x)) - rhs.x; - const float dy = ::fminf(lhs.upper.y, ::fmaxf(lhs.lower.y, rhs.y)) - rhs.y; - const float dz = ::fminf(lhs.upper.z, ::fmaxf(lhs.lower.z, rhs.z)) - rhs.z; - return dx * dx + dy * dy + dz * dz; -} - -MUDA_GENERIC inline double mindist(const AABB& lhs, const double4& rhs) noexcept -{ - const double dx = ::fmin(lhs.upper.x, ::fmax(lhs.lower.x, rhs.x)) - rhs.x; - const double dy = ::fmin(lhs.upper.y, ::fmax(lhs.lower.y, rhs.y)) - rhs.y; - const double dz = ::fmin(lhs.upper.z, ::fmax(lhs.lower.z, rhs.z)) - rhs.z; - return dx * dx + dy * dy + dz * dz; -} - -MUDA_GENERIC inline float minmaxdist(const AABB& lhs, const float4& rhs) noexcept -{ - float3 rm_sq = make_float3((lhs.lower.x - rhs.x) * (lhs.lower.x - rhs.x), - (lhs.lower.y - rhs.y) * (lhs.lower.y - rhs.y), - (lhs.lower.z - rhs.z) * (lhs.lower.z - rhs.z)); - float3 rM_sq = make_float3((lhs.upper.x - rhs.x) * (lhs.upper.x - rhs.x), - (lhs.upper.y - rhs.y) * (lhs.upper.y - rhs.y), - (lhs.upper.z - rhs.z) * (lhs.upper.z - rhs.z)); - - if((lhs.upper.x + lhs.lower.x) * 0.5f < rhs.x) - { - thrust::swap(rm_sq.x, rM_sq.x); - } - if((lhs.upper.y + lhs.lower.y) * 0.5f < rhs.y) - { - thrust::swap(rm_sq.y, rM_sq.y); - } - if((lhs.upper.z + lhs.lower.z) * 0.5f < rhs.z) - { - thrust::swap(rm_sq.z, rM_sq.z); - } - - const float dx = rm_sq.x + rM_sq.y + rM_sq.z; - const float dy = rM_sq.x + rm_sq.y + rM_sq.z; - const float dz = rM_sq.x + rM_sq.y + rm_sq.z; - return ::fminf(dx, ::fminf(dy, dz)); -} - -MUDA_GENERIC inline double minmaxdist(const AABB& lhs, const double4& rhs) noexcept -{ - double3 rm_sq = make_double3((lhs.lower.x - rhs.x) * (lhs.lower.x - rhs.x), - (lhs.lower.y - rhs.y) * (lhs.lower.y - rhs.y), - (lhs.lower.z - rhs.z) * (lhs.lower.z - rhs.z)); - double3 rM_sq = make_double3((lhs.upper.x - rhs.x) * (lhs.upper.x - rhs.x), - (lhs.upper.y - rhs.y) * (lhs.upper.y - rhs.y), - (lhs.upper.z - rhs.z) * (lhs.upper.z - rhs.z)); - - if((lhs.upper.x + lhs.lower.x) * 0.5 < rhs.x) - { - thrust::swap(rm_sq.x, rM_sq.x); - } - if((lhs.upper.y + lhs.lower.y) * 0.5 < rhs.y) - { - thrust::swap(rm_sq.y, rM_sq.y); - } - if((lhs.upper.z + lhs.lower.z) * 0.5 < rhs.z) - { - thrust::swap(rm_sq.z, rM_sq.z); - } - - const double dx = rm_sq.x + rM_sq.y + rM_sq.z; - const double dy = rM_sq.x + rm_sq.y + rM_sq.z; - const double dz = rM_sq.x + rM_sq.y + rm_sq.z; - return ::fmin(dx, ::fmin(dy, dz)); -} - -template -MUDA_GENERIC inline typename vector_of::type centroid(const AABB& box) noexcept -{ - typename vector_of::type c; - c.x = (box.upper.x + box.lower.x) * 0.5; - c.y = (box.upper.y + box.lower.y) * 0.5; - c.z = (box.upper.z + box.lower.z) * 0.5; - return c; -} - -} // namespace muda::lbvh diff --git a/src/muda/ext/geo/lbvh/bvh.h b/src/muda/ext/geo/lbvh/bvh.h deleted file mode 100644 index c3e7477a..00000000 --- a/src/muda/ext/geo/lbvh/bvh.h +++ /dev/null @@ -1,369 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace muda::lbvh -{ -namespace details -{ - template - void construct_internal_nodes(const thrust::detail::execution_policy_base& policy, - Node* nodes, - UInt const* node_code, - const uint32_t num_objects) - { - thrust::for_each( - policy, - thrust::make_counting_iterator(0), - thrust::make_counting_iterator(num_objects - 1), - [nodes, node_code, num_objects] __device__(const uint32_t idx) - { - nodes[idx].object_idx = 0xFFFFFFFF; // internal nodes - - const uint2 ij = determine_range(node_code, num_objects, idx); - const int gamma = find_split(node_code, num_objects, ij.x, ij.y); - - nodes[idx].left_idx = gamma; - nodes[idx].right_idx = gamma + 1; - if(thrust::min(ij.x, ij.y) == gamma) - { - nodes[idx].left_idx += num_objects - 1; - } - if(thrust::max(ij.x, ij.y) == gamma + 1) - { - nodes[idx].right_idx += num_objects - 1; - } - nodes[nodes[idx].left_idx].parent_idx = idx; - nodes[nodes[idx].right_idx].parent_idx = idx; - return; - }); - } -} // namespace details - -template -struct DefaultMortonCodeCalculator -{ - DefaultMortonCodeCalculator(AABB w) - : whole(w) - { - } - DefaultMortonCodeCalculator() = default; - ~DefaultMortonCodeCalculator() = default; - DefaultMortonCodeCalculator(DefaultMortonCodeCalculator const&) = default; - DefaultMortonCodeCalculator(DefaultMortonCodeCalculator&&) = default; - DefaultMortonCodeCalculator& operator=(DefaultMortonCodeCalculator const&) = default; - DefaultMortonCodeCalculator& operator=(DefaultMortonCodeCalculator&&) = default; - - __device__ __host__ inline uint32_t operator()(const Object&, const AABB& box) noexcept - { - auto p = centroid(box); - p.x -= whole.lower.x; - p.y -= whole.lower.y; - p.z -= whole.lower.z; - p.x /= (whole.upper.x - whole.lower.x); - p.y /= (whole.upper.y - whole.lower.y); - p.z /= (whole.upper.z - whole.lower.z); - return morton_code(p); - } - AABB whole; -}; - -template > -class BVH -{ - public: - using real_type = Real; - using index_type = std::uint32_t; - using object_type = Object; - using aabb_type = AABB; - using node_type = details::Node; - using aabb_getter_type = AABBGetter; - using morton_code_calculator_type = MortonCodeCalculator; - - public: - BVH() = default; - ~BVH() = default; - BVH(const BVH&) = default; - BVH(BVH&&) = default; - BVH& operator=(const BVH&) = default; - BVH& operator=(BVH&&) = default; - - void clear() - { - this->m_objects.clear(); - this->m_aabbs.clear(); - this->m_nodes.clear(); - return; - } - - BVHViewer viewer() noexcept - { - return BVHViewer{ - static_cast(m_nodes.size()), - static_cast(m_objects.size()), - thrust::raw_pointer_cast(m_nodes.data()), - thrust::raw_pointer_cast(m_aabbs.data()), - thrust::raw_pointer_cast(m_objects.data())}; - } - - CBVHViewer cviewer() const noexcept - { - return CBVHViewer{ - static_cast(m_nodes.size()), - static_cast(m_objects.size()), - thrust::raw_pointer_cast(m_nodes.data()), - thrust::raw_pointer_cast(m_aabbs.data()), - thrust::raw_pointer_cast(m_objects.data())}; - } - - - void build(cudaStream_t stream = nullptr) - { - auto policy = thrust::system::cuda::par_nosync.on(stream); - //auto policy = thrust::device; - - if(m_objects.size() == 0u) - { - return; - } - - m_host_dirty = true; - - const uint32_t num_objects = m_objects.size(); - const uint32_t num_internal_nodes = num_objects - 1; - const uint32_t num_nodes = num_objects * 2 - 1; - - // -------------------------------------------------------------------- - // calculate morton code of each points - - const auto inf = std::numeric_limits::infinity(); - aabb_type default_aabb; - default_aabb.upper.x = -inf; - default_aabb.lower.x = inf; - default_aabb.upper.y = -inf; - default_aabb.lower.y = inf; - default_aabb.upper.z = -inf; - default_aabb.lower.z = inf; - - this->m_aabbs.resize(num_nodes, default_aabb); - m_morton.resize(num_objects); - m_indices.resize(num_objects); - m_morton64.resize(num_objects); - node_type default_node; - default_node.parent_idx = 0xFFFFFFFF; - default_node.left_idx = 0xFFFFFFFF; - default_node.right_idx = 0xFFFFFFFF; - default_node.object_idx = 0xFFFFFFFF; - m_nodes.resize(num_nodes, default_node); - m_flag_container.clear(); - m_flag_container.resize(num_internal_nodes, 0); - - thrust::transform(policy, - this->m_objects.begin(), - this->m_objects.end(), - m_aabbs.begin() + num_internal_nodes, - aabb_getter_type()); - - //muda::DeviceReduce(stream).Reduce( - // m_aabbs.data() + num_internal_nodes, - // m_aabb_whole.data(), - // m_aabbs.size() - num_internal_nodes, - // [] CUB_RUNTIME_FUNCTION(const aabb_type& lhs, const aabb_type& rhs) -> aabb_type - // { return merge(lhs, rhs); }, - // default_aabb); - - const auto aabb_whole = thrust::reduce( - policy, - m_aabbs.data() + num_internal_nodes, - m_aabbs.data() + m_aabbs.size(), - default_aabb, - [] __device__ __host__(const aabb_type& lhs, const aabb_type& rhs) -> aabb_type - { return merge(lhs, rhs); }); - - thrust::transform(policy, - this->m_objects.begin(), - this->m_objects.end(), - m_aabbs.begin() + num_internal_nodes, - m_morton.begin(), - morton_code_calculator_type(aabb_whole)); - - // -------------------------------------------------------------------- - // sort object-indices by morton code - - // iota the indices - thrust::copy(policy, - thrust::make_counting_iterator(0), - thrust::make_counting_iterator(num_objects), - m_indices.begin()); - - // keep indices ascending order - thrust::stable_sort_by_key( - policy, - m_morton.begin(), - m_morton.end(), - thrust::make_zip_iterator(thrust::make_tuple(m_aabbs.begin() + num_internal_nodes, - m_indices.begin()))); - - // -------------------------------------------------------------------- - // check morton codes are unique - - - const auto uniqued = thrust::unique_copy( - policy, m_morton.begin(), m_morton.end(), m_morton64.begin()); - - const bool morton_code_is_unique = (m_morton64.end() == uniqued); - if(!morton_code_is_unique) - { - thrust::transform(policy, - m_morton.begin(), - m_morton.end(), - m_indices.begin(), - m_morton64.begin(), - [] __device__ __host__(const uint32_t m, const uint32_t idx) - { - unsigned long long int m64 = m; - m64 <<= 32; - m64 |= idx; - return m64; - }); - } - - // -------------------------------------------------------------------- - // construct leaf nodes and aabbs - - thrust::transform(policy, - m_indices.begin(), - m_indices.end(), - this->m_nodes.begin() + num_internal_nodes, - [] __device__ __host__(const index_type idx) - { - node_type n; - n.parent_idx = 0xFFFFFFFF; - n.left_idx = 0xFFFFFFFF; - n.right_idx = 0xFFFFFFFF; - n.object_idx = idx; - return n; - }); - - // -------------------------------------------------------------------- - // construct internal nodes - - if(morton_code_is_unique) - { - const uint32_t* node_code = thrust::raw_pointer_cast(m_morton.data()); - details::construct_internal_nodes( - policy, thrust::raw_pointer_cast(m_nodes.data()), node_code, num_objects); - } - else // 64bit version - { - const unsigned long long int* node_code = - thrust::raw_pointer_cast(m_morton64.data()); - details::construct_internal_nodes( - policy, thrust::raw_pointer_cast(m_nodes.data()), node_code, num_objects); - } - - // -------------------------------------------------------------------- - // create AABB for each node by bottom-up strategy - - const auto flags = thrust::raw_pointer_cast(m_flag_container.data()); - - - thrust::for_each(policy, - thrust::make_counting_iterator(num_internal_nodes), - thrust::make_counting_iterator(num_nodes), - [nodes = thrust::raw_pointer_cast(m_nodes.data()), - aabbs = thrust::raw_pointer_cast(m_aabbs.data()), - flags] __device__(index_type idx) - { - uint32_t parent = nodes[idx].parent_idx; - while(parent != 0xFFFFFFFF) // means idx == 0 - { - const int old = atomicCAS(flags + parent, 0, 1); - if(old == 0) - { - // this is the first thread entered here. - // wait the other thread from the other child node. - return; - } - MUDA_KERNEL_ASSERT(old == 1, "old=%d", old); - // here, the flag has already been 1. it means that this - // thread is the 2nd thread. merge AABB of both childlen. - - const auto lidx = nodes[parent].left_idx; - const auto ridx = nodes[parent].right_idx; - const auto lbox = aabbs[lidx]; - const auto rbox = aabbs[ridx]; - aabbs[parent] = merge(lbox, rbox); - - // look the next parent... - parent = nodes[parent].parent_idx; - } - return; - }); - } - - const auto& objects() const noexcept { return m_objects; } - auto& objects() noexcept { return m_objects; } - const auto& aabbs() const noexcept { return m_aabbs; } - const auto& nodes() const noexcept { return m_nodes; } - - const auto& host_objects() const noexcept - { - download_if_dirty(); - return m_h_objects; - } - const auto& host_aabbs() const noexcept - { - download_if_dirty(); - return m_h_aabbs; - } - const auto& host_nodes() const noexcept - { - download_if_dirty(); - return m_h_nodes; - } - - private: - muda::DeviceVector m_morton; - muda::DeviceVector m_indices; - muda::DeviceVector m_morton64; - muda::DeviceVector m_flag_container; - - muda::DeviceVector m_objects; - muda::DeviceVector m_aabbs; - muda::DeviceVector m_nodes; - - mutable bool m_host_dirty = true; - mutable thrust::host_vector m_h_objects; - mutable thrust::host_vector m_h_aabbs; - mutable thrust::host_vector m_h_nodes; - - void download_if_dirty() const - { - if(m_host_dirty) - { - m_h_objects = m_objects; - m_h_aabbs = m_aabbs; - m_h_nodes = m_nodes; - m_host_dirty = false; - } - } -}; -} // namespace muda::lbvh diff --git a/src/muda/ext/geo/lbvh/bvh_viewer.h b/src/muda/ext/geo/lbvh/bvh_viewer.h deleted file mode 100644 index 4df2c37e..00000000 --- a/src/muda/ext/geo/lbvh/bvh_viewer.h +++ /dev/null @@ -1,378 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include - -namespace muda::lbvh -{ -template -class BVH; - -namespace details -{ - struct Node - { - std::uint32_t parent_idx; // parent node - std::uint32_t left_idx; // index of left child node - std::uint32_t right_idx; // index of right child node - std::uint32_t object_idx; // == 0xFFFFFFFF if internal node. - }; - - template - MUDA_GENERIC uint2 determine_range(UInt const* node_code, const uint32_t num_leaves, uint32_t idx) - { - if(idx == 0) - { - return make_uint2(0, num_leaves - 1); - } - - // determine direction of the range - const UInt self_code = node_code[idx]; - const int L_delta = common_upper_bits(self_code, node_code[idx - 1]); - const int R_delta = common_upper_bits(self_code, node_code[idx + 1]); - const int d = (R_delta > L_delta) ? 1 : -1; - - // Compute upper bound for the length of the range - - const int delta_min = std::min(L_delta, R_delta); - int l_max = 2; - int delta = -1; - int i_tmp = idx + d * l_max; - if(0 <= i_tmp && i_tmp < num_leaves) - { - delta = common_upper_bits(self_code, node_code[i_tmp]); - } - while(delta > delta_min) - { - l_max <<= 1; - i_tmp = idx + d * l_max; - delta = -1; - if(0 <= i_tmp && i_tmp < num_leaves) - { - delta = common_upper_bits(self_code, node_code[i_tmp]); - } - } - - // Find the other end by binary search - int l = 0; - int t = l_max >> 1; - while(t > 0) - { - i_tmp = idx + (l + t) * d; - delta = -1; - if(0 <= i_tmp && i_tmp < num_leaves) - { - delta = common_upper_bits(self_code, node_code[i_tmp]); - } - if(delta > delta_min) - { - l += t; - } - t >>= 1; - } - uint32_t jdx = idx + l * d; - if(d < 0) - { - thrust::swap(idx, jdx); // make it sure that idx < jdx - } - return make_uint2(idx, jdx); - } - - template - MUDA_GENERIC uint32_t find_split(UInt const* node_code, - const uint32_t num_leaves, - const uint32_t first, - const uint32_t last) noexcept - { - const UInt first_code = node_code[first]; - const UInt last_code = node_code[last]; - if(first_code == last_code) - { - return (first + last) >> 1; - } - const int delta_node = common_upper_bits(first_code, last_code); - - // binary search... - int split = first; - int stride = last - first; - do - { - stride = (stride + 1) >> 1; - const int middle = split + stride; - if(middle < last) - { - const int delta = common_upper_bits(first_code, node_code[middle]); - if(delta > delta_node) - { - split = middle; - } - } - } while(stride > 1); - - return split; - } - - - template - class BVHViewerBase : muda::ViewerBase - { - MUDA_VIEWER_COMMON_NAME(BVHViewerBase); - - using Base = muda::ViewerBase; - template - using auto_const_t = typename Base::template auto_const_t; - - template - friend class BVH; - - public: - using real_type = Real; - using aabb_type = AABB; - using node_type = details::Node; - using index_type = std::uint32_t; - using object_type = Object; - - - using ConstViewer = BVHViewerBase; - using NonConstViewer = BVHViewerBase; - using ThisViewer = BVHViewerBase; - - struct DefaultQueryCallback - { - MUDA_GENERIC void operator()(uint32_t obj_idx) const noexcept {} - }; - - MUDA_GENERIC BVHViewerBase(const uint32_t num_nodes, - const uint32_t num_objects, - auto_const_t* nodes, - auto_const_t* aabbs, - auto_const_t* objects) - : m_num_nodes(num_nodes) - , m_num_objects(num_objects) - , m_nodes(nodes) - , m_aabbs(aabbs) - , m_objects(objects) - { - MUDA_KERNEL_ASSERT(m_nodes && m_aabbs && m_objects, - "BVHViewerBase[%s:%s]: nullptr is passed," - "nodes=%p," - "aabbs=%p," - "objects=%p\n", - this->name(), - this->kernel_name(), - m_nodes, - m_aabbs, - m_objects); - } - - MUDA_GENERIC auto as_const() const noexcept - { - return ConstViewer{m_num_nodes, m_num_objects, m_nodes, m_aabbs, m_objects}; - } - - MUDA_GENERIC operator ConstViewer() const noexcept - { - return as_const(); - } - - MUDA_GENERIC auto num_nodes() const noexcept { return m_num_nodes; } - MUDA_GENERIC auto num_objects() const noexcept { return m_num_objects; } - - // query object indices that potentially overlaps with query aabb. - // - // requirements: - // - F: void (uin32_t obj_idx) - template - MUDA_GENERIC uint32_t query(const query_overlap& q, - F callback = DefaultQueryCallback{}) const noexcept - { - index_type stack[StackNum]; - index_type* stack_ptr = stack; - index_type* stack_end = stack + StackNum; - *stack_ptr++ = 0; // root node is always 0 - - uint32_t num_found = 0; - do - { - const index_type node = *--stack_ptr; - const index_type L_idx = m_nodes[node].left_idx; - const index_type R_idx = m_nodes[node].right_idx; - - if(intersects(q.target, m_aabbs[L_idx])) - { - const auto obj_idx = m_nodes[L_idx].object_idx; - if(obj_idx != 0xFFFFFFFF) - { - if constexpr(!std::is_same_v) - { - callback(obj_idx); - } - ++num_found; - } - else // the node is not a leaf. - { - *stack_ptr++ = L_idx; - } - } - if(intersects(q.target, m_aabbs[R_idx])) - { - const auto obj_idx = m_nodes[R_idx].object_idx; - if(obj_idx != 0xFFFFFFFF) - { - if constexpr(!std::is_same_v) - { - callback(obj_idx); - } - ++num_found; - } - else // the node is not a leaf. - { - *stack_ptr++ = R_idx; - } - } - MUDA_KERNEL_ASSERT(stack_ptr < stack_end, - "LBVHQuery[%s:%s]: stack overflow, try use a larger StackNum.", - this->name(), - this->kernel_name()); - } while(stack < stack_ptr); - return num_found; - } - - // query object index that is the nearst to the query point. - // - // requirements: - // - FDistanceCalculator must be able to calc distance between a point to an object. - // which means FDistanceCalculator: Real (const object_type& lhs, const object_type& rhs) - // - template - MUDA_GENERIC thrust::pair query( - const query_nearest& q, FDistanceCalculator calc_dist) const noexcept - { - // pair of {node_idx, mindist} - thrust::pair stack[StackNum]; - thrust::pair* stack_ptr = stack; - thrust::pair* stack_end = stack + StackNum; - - *stack_ptr++ = thrust::make_pair(0, mindist(m_aabbs[0], q.target)); - - uint32_t nearest = 0xFFFFFFFF; - real_type dist_to_nearest_object = infinity(); - do - { - const auto node = *--stack_ptr; - if(node.second > dist_to_nearest_object) - { - // if aabb mindist > already_found_mindist, it cannot have a nearest - continue; - } - - const index_type L_idx = m_nodes[node.first].left_idx; - const index_type R_idx = m_nodes[node.first].right_idx; - - const aabb_type& L_box = m_aabbs[L_idx]; - const aabb_type& R_box = m_aabbs[R_idx]; - - const real_type L_mindist = mindist(L_box, q.target); - const real_type R_mindist = mindist(R_box, q.target); - - const real_type L_minmaxdist = minmaxdist(L_box, q.target); - const real_type R_minmaxdist = minmaxdist(R_box, q.target); - - // there should be an object that locates within minmaxdist. - - if(L_mindist <= R_minmaxdist) // L is worth considering - { - const auto obj_idx = m_nodes[L_idx].object_idx; - if(obj_idx != 0xFFFFFFFF) // leaf node - { - const real_type dist = calc_dist(q.target, m_objects[obj_idx]); - if(dist <= dist_to_nearest_object) - { - dist_to_nearest_object = dist; - nearest = obj_idx; - } - } - else - { - *stack_ptr++ = thrust::make_pair(L_idx, L_mindist); - } - } - if(R_mindist <= L_minmaxdist) // R is worth considering - { - const auto obj_idx = m_nodes[R_idx].object_idx; - if(obj_idx != 0xFFFFFFFF) // leaf node - { - const real_type dist = calc_dist(q.target, m_objects[obj_idx]); - if(dist <= dist_to_nearest_object) - { - dist_to_nearest_object = dist; - nearest = obj_idx; - } - } - else - { - *stack_ptr++ = thrust::make_pair(R_idx, R_mindist); - } - } - MUDA_KERNEL_ASSERT(stack_ptr < stack_end, - "LBVHQuery[%s:%s]: stack overflow, try use a larger StackNum.", - this->name(), - this->kernel_name()); - } while(stack < stack_ptr); - return thrust::make_pair(nearest, dist_to_nearest_object); - } - - MUDA_GENERIC auto_const_t& object(const uint32_t idx) noexcept - { - check_index(idx); - return m_objects[idx]; - } - - MUDA_GENERIC const object_type& object(const uint32_t idx) const noexcept - { - check_index(idx); - return m_objects[idx]; - } - - private: - uint32_t m_num_nodes; // (# of internal node) + (# of leaves), 2N+1 - uint32_t m_num_objects; // (# of leaves), the same as the number of objects - - auto_const_t* m_nodes; - auto_const_t* m_aabbs; - auto_const_t* m_objects; - - MUDA_INLINE MUDA_GENERIC void check_index(const uint32_t idx) const noexcept - { - MUDA_KERNEL_ASSERT(idx < m_num_objects, - "BVHViewer[%s:%s]: index out of range, idx=%u, num_objects=%u", - this->name(), - this->kernel_name(), - idx, - m_num_objects); - } - }; -} // namespace details - -template -using BVHViewer = details::BVHViewerBase; -template -using CBVHViewer = details::BVHViewerBase; -} // namespace muda::lbvh - -namespace muda -{ -template -struct read_only_view> -{ - using type = lbvh::CBVHViewer; -}; - -template -struct read_write_view> -{ - using type = lbvh::BVHViewer; -}; -} // namespace muda \ No newline at end of file diff --git a/src/muda/ext/geo/lbvh/lbvh.h b/src/muda/ext/geo/lbvh/lbvh.h deleted file mode 100644 index 69d79d92..00000000 --- a/src/muda/ext/geo/lbvh/lbvh.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include diff --git a/src/muda/ext/geo/lbvh/morton_code.h b/src/muda/ext/geo/lbvh/morton_code.h deleted file mode 100644 index fae8d66b..00000000 --- a/src/muda/ext/geo/lbvh/morton_code.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once -#include -#include -#include - -namespace muda::lbvh -{ -MUDA_GENERIC MUDA_INLINE std::uint32_t expand_bits(std::uint32_t v) noexcept -{ - v = (v * 0x00010001u) & 0xFF0000FFu; - v = (v * 0x00000101u) & 0x0F00F00Fu; - v = (v * 0x00000011u) & 0xC30C30C3u; - v = (v * 0x00000005u) & 0x49249249u; - return v; -} - -// Calculates a 30-bit Morton code for the -// given 3D point located within the unit cube [0,1]. -MUDA_GENERIC MUDA_INLINE std::uint32_t morton_code(float4 xyz, float resolution = 1024.0f) noexcept -{ - xyz.x = ::fminf(::fmaxf(xyz.x * resolution, 0.0f), resolution - 1.0f); - xyz.y = ::fminf(::fmaxf(xyz.y * resolution, 0.0f), resolution - 1.0f); - xyz.z = ::fminf(::fmaxf(xyz.z * resolution, 0.0f), resolution - 1.0f); - const std::uint32_t xx = expand_bits(static_cast(xyz.x)); - const std::uint32_t yy = expand_bits(static_cast(xyz.y)); - const std::uint32_t zz = expand_bits(static_cast(xyz.z)); - return xx * 4 + yy * 2 + zz; -} - -MUDA_GENERIC MUDA_INLINE std::uint32_t morton_code(double4 xyz, double resolution = 1024.0) noexcept -{ - xyz.x = ::fmin(::fmax(xyz.x * resolution, 0.0), resolution - 1.0); - xyz.y = ::fmin(::fmax(xyz.y * resolution, 0.0), resolution - 1.0); - xyz.z = ::fmin(::fmax(xyz.z * resolution, 0.0), resolution - 1.0); - const std::uint32_t xx = expand_bits(static_cast(xyz.x)); - const std::uint32_t yy = expand_bits(static_cast(xyz.y)); - const std::uint32_t zz = expand_bits(static_cast(xyz.z)); - return xx * 4 + yy * 2 + zz; -} - -__device__ MUDA_INLINE int common_upper_bits(const unsigned int lhs, const unsigned int rhs) noexcept -{ - return ::__clz(lhs ^ rhs); -} -__device__ MUDA_INLINE int common_upper_bits(const unsigned long long int lhs, - const unsigned long long int rhs) noexcept -{ - return ::__clzll(lhs ^ rhs); -} - -} // namespace muda::lbvh diff --git a/src/muda/ext/geo/lbvh/predicator.h b/src/muda/ext/geo/lbvh/predicator.h deleted file mode 100644 index 2721a41b..00000000 --- a/src/muda/ext/geo/lbvh/predicator.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once -#include - -namespace muda::lbvh -{ -template -struct query_overlap -{ - MUDA_GENERIC query_overlap(const AABB& tgt) - : target(tgt) - { - } - - query_overlap() = default; - ~query_overlap() = default; - query_overlap(const query_overlap&) = default; - query_overlap(query_overlap&&) = default; - query_overlap& operator=(const query_overlap&) = default; - query_overlap& operator=(query_overlap&&) = default; - - MUDA_GENERIC inline bool operator()(const AABB& box) noexcept - { - return intersects(box, target); - } - - AABB target; -}; - -template -MUDA_GENERIC query_overlap overlaps(const AABB& region) noexcept -{ - return query_overlap(region); -} - -template -struct query_nearest -{ - // float4/double4 - using vector_type = typename vector_of::type; - - MUDA_GENERIC query_nearest(const vector_type& tgt) - : target(tgt) - { - } - - query_nearest() = default; - ~query_nearest() = default; - query_nearest(const query_nearest&) = default; - query_nearest(query_nearest&&) = default; - query_nearest& operator=(const query_nearest&) = default; - query_nearest& operator=(query_nearest&&) = default; - - vector_type target; -}; - -MUDA_GENERIC inline query_nearest nearest(const float4& point) noexcept -{ - return query_nearest(point); -} -MUDA_GENERIC inline query_nearest nearest(const float3& point) noexcept -{ - return query_nearest(make_float4(point.x, point.y, point.z, 0.0f)); -} -MUDA_GENERIC inline query_nearest nearest(const double4& point) noexcept -{ - return query_nearest(point); -} -MUDA_GENERIC inline query_nearest nearest(const double3& point) noexcept -{ - return query_nearest(make_double4(point.x, point.y, point.z, 0.0)); -} - -} // namespace muda::lbvh diff --git a/src/muda/ext/geo/lbvh/query.h b/src/muda/ext/geo/lbvh/query.h deleted file mode 100644 index 96566aec..00000000 --- a/src/muda/ext/geo/lbvh/query.h +++ /dev/null @@ -1,143 +0,0 @@ -#pragma once -#include -#include - -namespace muda::lbvh -{ -template -MUDA_HOST uint32_t query(const BVH& tree, - const query_overlap q, - OutputBackInserter outiter) noexcept -{ - using bvh_type = BVH; - using index_type = typename bvh_type::index_type; - using aabb_type = typename bvh_type::aabb_type; - using node_type = typename bvh_type::node_type; - - std::vector stack; - stack.reserve(64); - stack.push_back(0); - - uint32_t num_found = 0; - do - { - const index_type node = stack.back(); - stack.pop_back(); - const index_type L_idx = tree.host_nodes()[node].left_idx; - const index_type R_idx = tree.host_nodes()[node].right_idx; - - if(intersects(q.target, tree.host_aabbs()[L_idx])) - { - const auto obj_idx = tree.host_nodes()[L_idx].object_idx; - if(obj_idx != 0xFFFFFFFF) - { - *outiter++ = obj_idx; - ++num_found; - } - else // the node is not a leaf. - { - stack.push_back(L_idx); - } - } - if(intersects(q.target, tree.host_aabbs()[R_idx])) - { - const auto obj_idx = tree.host_nodes()[R_idx].object_idx; - if(obj_idx != 0xFFFFFFFF) - { - *outiter++ = obj_idx; - ++num_found; - } - else // the node is not a leaf. - { - stack.push_back(R_idx); - } - } - } while(!stack.empty()); - return num_found; -} - -template -MUDA_HOST std::pair query(const BVH& tree, - const query_nearest& q, - DistanceCalculator calc_dist) noexcept -{ - using bvh_type = BVH; - using real_type = typename bvh_type::real_type; - using index_type = typename bvh_type::index_type; - using aabb_type = typename bvh_type::aabb_type; - using node_type = typename bvh_type::node_type; - - //if(!tree.query_host_enabled()) - //{ - // throw std::runtime_error("lbvh::bvh query_host is not enabled"); - //} - - // pair of {node_idx, mindist} - std::vector> stack = { - {0, mindist(tree.host_aabbs()[0], q.target)}}; - stack.reserve(64); - - uint32_t nearest = 0xFFFFFFFF; - real_type current_nearest_dist = infinity(); - do - { - const auto node = stack.back(); - stack.pop_back(); - if(node.second > current_nearest_dist) - { - // if aabb mindist > already_found_mindist, it cannot have a nearest - continue; - } - - const index_type L_idx = tree.host_nodes()[node.first].left_idx; - const index_type R_idx = tree.host_nodes()[node.first].right_idx; - - const aabb_type& L_box = tree.host_aabbs()[L_idx]; - const aabb_type& R_box = tree.host_aabbs()[R_idx]; - - const real_type L_mindist = mindist(L_box, q.target); - const real_type R_mindist = mindist(R_box, q.target); - - const real_type L_minmaxdist = minmaxdist(L_box, q.target); - const real_type R_minmaxdist = minmaxdist(R_box, q.target); - - // there should be an object that locates within minmaxdist. - - if(L_mindist <= R_minmaxdist) // L is worth considering - { - const auto obj_idx = tree.host_nodes()[L_idx].object_idx; - if(obj_idx != 0xFFFFFFFF) // leaf node - { - const real_type dist = calc_dist(q.target, tree.objects_host()[obj_idx]); - if(dist <= current_nearest_dist) - { - current_nearest_dist = dist; - nearest = obj_idx; - } - } - else - { - stack.emplace_back(L_idx, L_mindist); - } - } - if(R_mindist <= L_minmaxdist) // R is worth considering - { - const auto obj_idx = tree.host_nodes()[R_idx].object_idx; - if(obj_idx != 0xFFFFFFFF) // leaf node - { - const real_type dist = calc_dist(q.target, tree.objects_host()[obj_idx]); - if(dist <= current_nearest_dist) - { - current_nearest_dist = dist; - nearest = obj_idx; - } - } - else - { - stack.emplace_back(R_idx, R_mindist); - } - } - } while(!stack.empty()); - return std::make_pair(nearest, current_nearest_dist); -} -} // namespace muda::lbvh diff --git a/src/muda/ext/geo/lbvh/utility.h b/src/muda/ext/geo/lbvh/utility.h deleted file mode 100644 index 2473ef8f..00000000 --- a/src/muda/ext/geo/lbvh/utility.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once -#include -#include -#include - -namespace muda::lbvh -{ -template -struct vector_of; -template <> -struct vector_of -{ - using type = float4; -}; -template <> -struct vector_of -{ - using type = double4; -}; - -template -using vector_of_t = typename vector_of::type; - -template -__device__ inline T infinity() noexcept; - -template <> -__device__ inline float infinity() noexcept -{ - return CUDART_INF_F; -} -template <> -__device__ inline double infinity() noexcept -{ - return CUDART_INF; -} - -} // namespace muda::lbvh diff --git a/src/muda/ext/geo/spatial_hash.h b/src/muda/ext/geo/spatial_hash.h deleted file mode 100644 index 4d0488ce..00000000 --- a/src/muda/ext/geo/spatial_hash.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -#include \ No newline at end of file diff --git a/src/muda/ext/linear_system/bcoo_vector_view.h b/src/muda/ext/linear_system/bcoo_vector_view.h index 75ddd3e3..acc27a2a 100644 --- a/src/muda/ext/linear_system/bcoo_vector_view.h +++ b/src/muda/ext/linear_system/bcoo_vector_view.h @@ -82,8 +82,6 @@ class COOVectorViewBase : public ViewBase m_descr}; } - MUDA_GENERIC operator ConstView() const { return as_const(); } - // non-const accessor MUDA_GENERIC auto viewer() diff --git a/src/muda/ext/linear_system/details/routines/solve/solve_dense.inl b/src/muda/ext/linear_system/details/routines/solve/solve_dense.inl index 4274dda9..a077bff4 100644 --- a/src/muda/ext/linear_system/details/routines/solve/solve_dense.inl +++ b/src/muda/ext/linear_system/details/routines/solve/solve_dense.inl @@ -81,8 +81,8 @@ void LinearSystemContext::gesv(DenseMatrixView A, DenseVectorView b) cusolverDnCreateParams(¶ms); cusolverDnSetAdvOptions(params, CUSOLVERDN_GETRF, CUSOLVER_ALG_0); - constexpr int pivot_on = 1; - size_t d_piv_count = A.row(); + // constexpr int pivot_on = 1; + size_t d_piv_count = A.row(); checkCudaErrors(cusolverDnXgetrf_bufferSize(cusolver, params, diff --git a/src/muda/ext/linear_system/device_bcoo_vector.h b/src/muda/ext/linear_system/device_bcoo_vector.h index 91abbf6c..611d1f29 100644 --- a/src/muda/ext/linear_system/device_bcoo_vector.h +++ b/src/muda/ext/linear_system/device_bcoo_vector.h @@ -1,5 +1,6 @@ #pragma once #include +#include #include #include diff --git a/src/muda/ext/linear_system/doublet_vector_view.h b/src/muda/ext/linear_system/doublet_vector_view.h index 118b1ff3..df955098 100644 --- a/src/muda/ext/linear_system/doublet_vector_view.h +++ b/src/muda/ext/linear_system/doublet_vector_view.h @@ -204,14 +204,16 @@ class DoubletVectorViewT : public ViewBase MUDA_GENERIC auto indices() const noexcept { - return BufferViewT{ - m_indices, size_t{m_doublet_index_offset}, size_t{m_doublet_count}}; + return BufferViewT{m_indices, + static_cast(m_doublet_index_offset), + static_cast(m_doublet_count)}; } MUDA_GENERIC auto values() const noexcept { - return BufferViewT{ - m_values, size_t{m_doublet_index_offset}, size_t{m_doublet_count}}; + return BufferViewT{m_values, + static_cast(m_doublet_index_offset), + static_cast(m_doublet_count)}; } }; diff --git a/src/muda/ext/linear_system/matrix_format_converter_impl.h b/src/muda/ext/linear_system/matrix_format_converter_impl.h index f18b0165..d08f4d9a 100644 --- a/src/muda/ext/linear_system/matrix_format_converter_impl.h +++ b/src/muda/ext/linear_system/matrix_format_converter_impl.h @@ -21,11 +21,25 @@ #include -// for encode run length usage -MUDA_GENERIC constexpr bool operator==(const int2& a, const int2& b) + +namespace muda +{ +namespace details { - return a.x == b.x && a.y == b.y; -} + struct IntPair + { + int x; + int y; + }; + + // A internal muda pair type to avoid int2 equality redefinition conflict + constexpr bool operator==(const IntPair& l, const IntPair& r) + { + return l.x == r.x && l.y == r.y; + } +} // namespace details +} // namespace muda + namespace muda { @@ -113,10 +127,10 @@ namespace details DeviceVar count; - DeviceBuffer ij_pairs; + DeviceBuffer ij_pairs; DeviceBuffer ij_hash; DeviceBuffer ij_hash_input; - DeviceBuffer unique_ij_pairs; + DeviceBuffer unique_ij_pairs; muda::DeviceBuffer blocks_sorted; DeviceBuffer unique_blocks; @@ -204,8 +218,8 @@ namespace details ij_pairs = ij_pairs.viewer().name("ij_pairs")] __device__(int i) mutable { auto hash = ij_hash(i); - auto row_index = int{hash >> 32}; - auto col_index = int{hash & 0xFFFFFFFF}; + auto row_index = static_cast(hash >> 32); + auto col_index = static_cast(hash & 0xFFFFFFFF); ij_pairs(i).x = row_index; ij_pairs(i).y = col_index; }); @@ -256,8 +270,8 @@ namespace details "col_indices")] __device__(int i) mutable { auto hash = ij_hash(i); - auto row_index = int{hash >> 32}; - auto col_index = int{hash & 0xFFFFFFFF}; + auto row_index = static_cast(hash >> 32); + auto col_index = static_cast(hash & 0xFFFFFFFF); row_indices(i) = row_index; col_indices(i) = col_index; }); @@ -292,13 +306,12 @@ namespace details [sort_index = sort_index.viewer().name("sort_index")] __device__( int i) mutable { sort_index(i) = i; }); - DeviceMergeSort().SortPairs(ij_pairs.data(), - sort_index.data(), - ij_pairs.size(), - [] __device__(const int2& a, const int2& b) { - return a.x < b.x - || (a.x == b.x && a.y < b.y); - }); + DeviceMergeSort().SortPairs( + ij_pairs.data(), + sort_index.data(), + ij_pairs.size(), + [] __device__(const IntPair& a, const IntPair& b) + { return a.x < b.x || (a.x == b.x && a.y < b.y); }); // set ij_pairs back to row_indices and col_indices @@ -527,13 +540,12 @@ namespace details ij_pairs(i).y = col_indices(i); }); - DeviceMergeSort().SortPairs(ij_pairs.data(), - to.m_values.data(), - ij_pairs.size(), - [] __device__(const int2& a, const int2& b) { - return a.x < b.x - || (a.x == b.x && a.y < b.y); - }); + DeviceMergeSort().SortPairs( + ij_pairs.data(), + to.m_values.data(), + ij_pairs.size(), + [] __device__(const IntPair& a, const IntPair& b) + { return a.x < b.x || (a.x == b.x && a.y < b.y); }); // set ij_pairs back to row_indices and col_indices diff --git a/src/muda/ext/linear_system/triplet_matrix_view.h b/src/muda/ext/linear_system/triplet_matrix_view.h index 4723914f..b6c43cce 100644 --- a/src/muda/ext/linear_system/triplet_matrix_view.h +++ b/src/muda/ext/linear_system/triplet_matrix_view.h @@ -256,21 +256,22 @@ class TripletMatrixViewT : public ViewBase MUDA_GENERIC auto row_indices() const { return BufferViewT{m_row_indices, - size_t{m_triplet_index_offset}, - size_t{m_triplet_count}}; + static_cast(m_triplet_index_offset), + static_cast(m_triplet_count)}; } MUDA_GENERIC auto col_indices() const { return BufferViewT{m_col_indices, - size_t{m_triplet_index_offset}, - size_t{m_triplet_count}}; + static_cast(m_triplet_index_offset), + static_cast(m_triplet_count)}; } MUDA_GENERIC auto values() const { - return BufferViewT{ - m_values, size_t{m_triplet_index_offset}, size_t{m_triplet_count}}; + return BufferViewT{m_values, + static_cast(m_triplet_index_offset), + static_cast(m_triplet_count)}; } }; diff --git a/src/muda/ext/spatial_hash.h b/src/muda/ext/spatial_hash.h new file mode 100644 index 00000000..f9957edf --- /dev/null +++ b/src/muda/ext/spatial_hash.h @@ -0,0 +1,2 @@ +#pragma once +#include \ No newline at end of file diff --git a/src/muda/ext/geo/spatial_hash/bounding_volume.h b/src/muda/ext/spatial_hash/bounding_volume.h similarity index 100% rename from src/muda/ext/geo/spatial_hash/bounding_volume.h rename to src/muda/ext/spatial_hash/bounding_volume.h diff --git a/src/muda/ext/geo/spatial_hash/collision_pair.h b/src/muda/ext/spatial_hash/collision_pair.h similarity index 100% rename from src/muda/ext/geo/spatial_hash/collision_pair.h rename to src/muda/ext/spatial_hash/collision_pair.h diff --git a/src/muda/ext/geo/spatial_hash/details/sparse_spatial_hash_impl.inl b/src/muda/ext/spatial_hash/details/sparse_spatial_hash_impl.inl similarity index 98% rename from src/muda/ext/geo/spatial_hash/details/sparse_spatial_hash_impl.inl rename to src/muda/ext/spatial_hash/details/sparse_spatial_hash_impl.inl index c6389aa2..5badaca9 100644 --- a/src/muda/ext/geo/spatial_hash/details/sparse_spatial_hash_impl.inl +++ b/src/muda/ext/spatial_hash/details/sparse_spatial_hash_impl.inl @@ -202,7 +202,7 @@ void SparseSpatialHashImpl::fill_hash_cells() // turn off othese non-overlap neighbor cells if we do have. for(; idx < 8; ++idx) - cellArrayValue(objectId, idx) = Cell(-1, -1); + cellArrayValue(objectId, idx) = Cell(~0, ~0); // fill the key for later sorting for(int i = 0; i < 8; ++i) @@ -215,7 +215,7 @@ void SparseSpatialHashImpl::fill_hash_cells() cellArrayKey = cellArrayKey.viewer()] __device__() mutable { cellArrayKey(cellArrayKey.total_size() - 1) = -1; - cellArrayValue(cellArrayValue.total_size() - 1) = Cell(-1, -1); + cellArrayValue(cellArrayValue.total_size() - 1) = Cell(~0, ~0); }); } @@ -419,7 +419,7 @@ void SparseSpatialHashImpl::balanced_setup_collision_pairs( cellToCollisionPairUpperBound.view(0, validCellCount).viewer()] __device__(int cell) mutable { int size = objCountInCell(cell); - cellToCollisionPairUpperBound(cell) = size * (size - 1) / 2 + 1; // +1 for sentinel + cellToCollisionPairUpperBound(cell) = size * (size - 1) / 2 + 1; // +1 for sentinel }); // e.g. @@ -433,7 +433,7 @@ void SparseSpatialHashImpl::balanced_setup_collision_pairs( // count = 14 int collisionPairCountUpperBound = 0; BufferLaunch(m_stream).copy(&collisionPairCountUpperBound, - cellToCollisionPairUpperBoundPrefixSum.view(validCellCount)); + cellToCollisionPairUpperBoundPrefixSum.view(validCellCount)); // e.g. // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 @@ -521,7 +521,7 @@ void SparseSpatialHashImpl::balanced_setup_collision_pairs( collisionPairBuffer(cpI) = CollisionPair::invalid(); - if(cellLocalIndex == 0) // ignore the first sentinel + if(cellLocalIndex == 0) // ignore the first sentinel return; cellLocalIndex -= 1; diff --git a/src/muda/ext/geo/spatial_hash/morton_hash.h b/src/muda/ext/spatial_hash/morton_hash.h similarity index 96% rename from src/muda/ext/geo/spatial_hash/morton_hash.h rename to src/muda/ext/spatial_hash/morton_hash.h index 1b38a45f..0b68595a 100644 --- a/src/muda/ext/geo/spatial_hash/morton_hash.h +++ b/src/muda/ext/spatial_hash/morton_hash.h @@ -8,7 +8,7 @@ namespace muda::spatial_hash template class Morton { - static_assert("Morton not implemented for this type."); + static_assert(always_false_v, "Morton not implemented for this type."); }; template <> diff --git a/src/muda/ext/geo/spatial_hash/sparse_spatial_hash.h b/src/muda/ext/spatial_hash/sparse_spatial_hash.h similarity index 98% rename from src/muda/ext/geo/spatial_hash/sparse_spatial_hash.h rename to src/muda/ext/spatial_hash/sparse_spatial_hash.h index 64f5aaf3..3db635b6 100644 --- a/src/muda/ext/geo/spatial_hash/sparse_spatial_hash.h +++ b/src/muda/ext/spatial_hash/sparse_spatial_hash.h @@ -1,5 +1,5 @@ #pragma once -#include +#include namespace muda::spatial_hash { diff --git a/src/muda/ext/geo/spatial_hash/sparse_spatial_hash_impl.h b/src/muda/ext/spatial_hash/sparse_spatial_hash_impl.h similarity index 97% rename from src/muda/ext/geo/spatial_hash/sparse_spatial_hash_impl.h rename to src/muda/ext/spatial_hash/sparse_spatial_hash_impl.h index 0c43e06c..ffb333fb 100644 --- a/src/muda/ext/geo/spatial_hash/sparse_spatial_hash_impl.h +++ b/src/muda/ext/spatial_hash/sparse_spatial_hash_impl.h @@ -1,12 +1,12 @@ #pragma once #include -#include +#include #include #include #include #include -#include -#include +#include +#include namespace muda::spatial_hash { /** diff --git a/src/muda/ext/spgrid.h b/src/muda/ext/spgrid.h index e69de29b..e4d58d59 100644 --- a/src/muda/ext/spgrid.h +++ b/src/muda/ext/spgrid.h @@ -0,0 +1,6 @@ +#pragma once + +namespace muda::spgrid +{ +// TODO +} diff --git a/src/muda/ext/spgrid/macro.h b/src/muda/ext/spgrid/macro.h deleted file mode 100644 index 718fc8c3..00000000 --- a/src/muda/ext/spgrid/macro.h +++ /dev/null @@ -1,345 +0,0 @@ - -//copy write LuisaCompute/include/core/Macro - -#pragma once - -#define MUDA_MACRO_EVAL0(...) __VA_ARGS__ -#define MUDA_MACRO_EVAL1(...) MUDA_MACRO_EVAL0(MUDA_MACRO_EVAL0(MUDA_MACRO_EVAL0(__VA_ARGS__))) -#define MUDA_MACRO_EVAL2(...) MUDA_MACRO_EVAL1(MUDA_MACRO_EVAL1(MUDA_MACRO_EVAL1(__VA_ARGS__))) -#define MUDA_MACRO_EVAL3(...) MUDA_MACRO_EVAL2(MUDA_MACRO_EVAL2(MUDA_MACRO_EVAL2(__VA_ARGS__))) -#define MUDA_MACRO_EVAL4(...) MUDA_MACRO_EVAL3(MUDA_MACRO_EVAL3(MUDA_MACRO_EVAL3(__VA_ARGS__))) -#define MUDA_MACRO_EVAL5(...) MUDA_MACRO_EVAL4(MUDA_MACRO_EVAL4(MUDA_MACRO_EVAL4(__VA_ARGS__))) -#define MUDA_MACRO_EVAL(...) MUDA_MACRO_EVAL5(__VA_ARGS__) - -#define MUDA_MACRO_EMPTY() -#define MUDA_MACRO_DEFER(id) id MUDA_MACRO_EMPTY() - -// macro reverse -#define MUDA_REVERSE_END(...) -#define MUDA_REVERSE_OUT - -#define MUDA_REVERSE_GET_END2() 0, MUDA_REVERSE_END -#define MUDA_REVERSE_GET_END1(...) MUDA_REVERSE_GET_END2 -#define MUDA_REVERSE_GET_END(...) MUDA_REVERSE_GET_END1 -#define MUDA_REVERSE_NEXT0(test, next, ...) next MUDA_REVERSE_OUT -#define MUDA_REVERSE_NEXT1(test, next) \ - MUDA_MACRO_DEFER(MUDA_REVERSE_NEXT0) \ - (test, next, 0) -#define MUDA_REVERSE_NEXT(test, next) MUDA_REVERSE_NEXT1(MUDA_REVERSE_GET_END test, next) - -#define MUDA_REVERSE0(x, peek, ...) \ - MUDA_MACRO_DEFER(MUDA_REVERSE_NEXT(peek, MUDA_REVERSE1)) \ - (peek, __VA_ARGS__) x, -#define MUDA_REVERSE1(x, peek, ...) \ - MUDA_MACRO_DEFER(MUDA_REVERSE_NEXT(peek, MUDA_REVERSE0)) \ - (peek, __VA_ARGS__) x, -#define MUDA_REVERSE2(x, peek, ...) \ - MUDA_MACRO_DEFER(MUDA_REVERSE_NEXT(peek, MUDA_REVERSE1)) \ - (peek, __VA_ARGS__) x -#define MUDA_REVERSE(...) MUDA_MACRO_EVAL(MUDA_REVERSE2(__VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -// macro map -#define MUDA_MAP_END(...) -#define MUDA_MAP_OUT - -#define MUDA_MAP_GET_END2() 0, MUDA_MAP_END -#define MUDA_MAP_GET_END1(...) MUDA_MAP_GET_END2 -#define MUDA_MAP_GET_END(...) MUDA_MAP_GET_END1 -#define MUDA_MAP_NEXT0(test, next, ...) next MUDA_MAP_OUT -#define MUDA_MAP_NEXT1(test, next) \ - MUDA_MACRO_DEFER(MUDA_MAP_NEXT0) \ - (test, next, 0) -#define MUDA_MAP_NEXT(test, next) MUDA_MAP_NEXT1(MUDA_MAP_GET_END test, next) - -#define MUDA_MAP0(f, x, peek, ...) f(x) MUDA_MACRO_DEFER(MUDA_MAP_NEXT(peek, MUDA_MAP1))(f, peek, __VA_ARGS__) -#define MUDA_MAP1(f, x, peek, ...) f(x) MUDA_MACRO_DEFER(MUDA_MAP_NEXT(peek, MUDA_MAP0))(f, peek, __VA_ARGS__) - -#define MUDA_MAP_LIST0(f, x, peek, ...) , f(x) MUDA_MACRO_DEFER(MUDA_MAP_NEXT(peek, MUDA_MAP_LIST1))(f, peek, __VA_ARGS__) -#define MUDA_MAP_LIST1(f, x, peek, ...) , f(x) MUDA_MACRO_DEFER(MUDA_MAP_NEXT(peek, MUDA_MAP_LIST0))(f, peek, __VA_ARGS__) -#define MUDA_MAP_LIST2(f, x, peek, ...) f(x) MUDA_MACRO_DEFER(MUDA_MAP_NEXT(peek, MUDA_MAP_LIST1))(f, peek, __VA_ARGS__) - -// Applies the function macro `f` to each of the remaining parameters. -#define MUDA_MAP(f, ...) MUDA_MACRO_EVAL(MUDA_MAP1(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -// Applies the function macro `f` to each of the remaining parameters and inserts commas between the results. -#define MUDA_MAP_LIST(f, ...) MUDA_MACRO_EVAL(MUDA_MAP_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -// other useful list operations... -#define MUDA_TAIL_IMPL(x, ...) __VA_ARGS__ -#define MUDA_HEAD_IMPL(x, ...) x -#define MUDA_HEAD(...) MUDA_HEAD_IMPL(__VA_ARGS__) -#define MUDA_TAIL(...) MUDA_TAIL_IMPL(__VA_ARGS__) -#define MUDA_LAST(...) MUDA_HEAD(MUDA_REVERSE(__VA_ARGS__)) -#define MUDA_POP_LAST(...) MUDA_REVERSE(MUDA_TAIL(MUDA_REVERSE(__VA_ARGS__))) - -// inc & dec -#define MUDA_INC_0() 1 -#define MUDA_INC_1() 2 -#define MUDA_INC_2() 3 -#define MUDA_INC_3() 4 -#define MUDA_INC_4() 5 -#define MUDA_INC_5() 6 -#define MUDA_INC_6() 7 -#define MUDA_INC_7() 8 -#define MUDA_INC_8() 9 -#define MUDA_INC_9() 10 -#define MUDA_INC_10() 11 -#define MUDA_INC_11() 12 -#define MUDA_INC_12() 13 -#define MUDA_INC_13() 14 -#define MUDA_INC_14() 15 -#define MUDA_INC_15() 16 -#define MUDA_INC_16() 17 -#define MUDA_INC_17() 18 -#define MUDA_INC_18() 19 -#define MUDA_INC_19() 20 -#define MUDA_INC_20() 21 -#define MUDA_INC_21() 22 -#define MUDA_INC_22() 23 -#define MUDA_INC_23() 24 -#define MUDA_INC_24() 25 -#define MUDA_INC_25() 26 -#define MUDA_INC_26() 27 -#define MUDA_INC_27() 28 -#define MUDA_INC_28() 29 -#define MUDA_INC_29() 30 -#define MUDA_INC_30() 31 -#define MUDA_INC_31() 32 -#define MUDA_INC_32() 33 -#define MUDA_INC_33() 34 -#define MUDA_INC_34() 35 -#define MUDA_INC_35() 36 -#define MUDA_INC_36() 37 -#define MUDA_INC_37() 38 -#define MUDA_INC_38() 39 -#define MUDA_INC_39() 40 -#define MUDA_INC_40() 41 -#define MUDA_INC_41() 42 -#define MUDA_INC_42() 43 -#define MUDA_INC_43() 44 -#define MUDA_INC_44() 45 -#define MUDA_INC_45() 46 -#define MUDA_INC_46() 47 -#define MUDA_INC_47() 48 -#define MUDA_INC_48() 49 -#define MUDA_INC_49() 50 -#define MUDA_INC_50() 51 -#define MUDA_INC_51() 52 -#define MUDA_INC_52() 53 -#define MUDA_INC_53() 54 -#define MUDA_INC_54() 55 -#define MUDA_INC_55() 56 -#define MUDA_INC_56() 57 -#define MUDA_INC_57() 58 -#define MUDA_INC_58() 59 -#define MUDA_INC_59() 60 -#define MUDA_INC_60() 61 -#define MUDA_INC_61() 62 -#define MUDA_INC_62() 63 -#define MUDA_INC_63() 64 -#define MUDA_INC_IMPL(x) MUDA_INC_##x() -#define MUDA_INC(x) MUDA_INC_IMPL(x) - -#define MUDA_DEC_1() 0 -#define MUDA_DEC_2() 1 -#define MUDA_DEC_3() 2 -#define MUDA_DEC_4() 3 -#define MUDA_DEC_5() 4 -#define MUDA_DEC_6() 5 -#define MUDA_DEC_7() 6 -#define MUDA_DEC_8() 7 -#define MUDA_DEC_9() 8 -#define MUDA_DEC_10() 9 -#define MUDA_DEC_11() 10 -#define MUDA_DEC_12() 11 -#define MUDA_DEC_13() 12 -#define MUDA_DEC_14() 13 -#define MUDA_DEC_15() 14 -#define MUDA_DEC_16() 15 -#define MUDA_DEC_17() 16 -#define MUDA_DEC_18() 17 -#define MUDA_DEC_19() 18 -#define MUDA_DEC_20() 19 -#define MUDA_DEC_21() 20 -#define MUDA_DEC_22() 21 -#define MUDA_DEC_23() 22 -#define MUDA_DEC_24() 23 -#define MUDA_DEC_25() 24 -#define MUDA_DEC_26() 25 -#define MUDA_DEC_27() 26 -#define MUDA_DEC_28() 27 -#define MUDA_DEC_29() 28 -#define MUDA_DEC_30() 29 -#define MUDA_DEC_31() 30 -#define MUDA_DEC_32() 31 -#define MUDA_DEC_33() 32 -#define MUDA_DEC_34() 33 -#define MUDA_DEC_35() 34 -#define MUDA_DEC_36() 35 -#define MUDA_DEC_37() 36 -#define MUDA_DEC_38() 37 -#define MUDA_DEC_39() 38 -#define MUDA_DEC_40() 39 -#define MUDA_DEC_41() 40 -#define MUDA_DEC_42() 41 -#define MUDA_DEC_43() 42 -#define MUDA_DEC_44() 43 -#define MUDA_DEC_45() 44 -#define MUDA_DEC_46() 45 -#define MUDA_DEC_47() 46 -#define MUDA_DEC_48() 47 -#define MUDA_DEC_49() 48 -#define MUDA_DEC_50() 49 -#define MUDA_DEC_51() 50 -#define MUDA_DEC_52() 51 -#define MUDA_DEC_53() 52 -#define MUDA_DEC_54() 53 -#define MUDA_DEC_55() 54 -#define MUDA_DEC_56() 55 -#define MUDA_DEC_57() 56 -#define MUDA_DEC_58() 57 -#define MUDA_DEC_59() 58 -#define MUDA_DEC_60() 59 -#define MUDA_DEC_61() 60 -#define MUDA_DEC_62() 61 -#define MUDA_DEC_63() 62 -#define MUDA_DEC_64() 63 -#define MUDA_DEC_IMPL(x) MUDA_DEC_##x() -#define MUDA_DEC(x) MUDA_DEC_IMPL(x) - -#define MUDA_RANGE_GEN_1() 0 -#define MUDA_RANGE_GEN_2() 0, 1 -#define MUDA_RANGE_GEN_3() 0, 1, 2 -#define MUDA_RANGE_GEN_4() 0, 1, 2, 3 -#define MUDA_RANGE_GEN_5() 0, 1, 2, 3, 4 -#define MUDA_RANGE_GEN_6() 0, 1, 2, 3, 4, 5 -#define MUDA_RANGE_GEN_7() 0, 1, 2, 3, 4, 5, 6 -#define MUDA_RANGE_GEN_8() 0, 1, 2, 3, 4, 5, 6, 7 -#define MUDA_RANGE_GEN_9() 0, 1, 2, 3, 4, 5, 6, 7, 8 -#define MUDA_RANGE_GEN_10() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 -#define MUDA_RANGE_GEN_11() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 -#define MUDA_RANGE_GEN_12() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 -#define MUDA_RANGE_GEN_13() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 -#define MUDA_RANGE_GEN_14() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 -#define MUDA_RANGE_GEN_15() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 -#define MUDA_RANGE_GEN_16() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -#define MUDA_RANGE_GEN_17() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 -#define MUDA_RANGE_GEN_18() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 -#define MUDA_RANGE_GEN_19() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 -#define MUDA_RANGE_GEN_20() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 -#define MUDA_RANGE_GEN_21() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 -#define MUDA_RANGE_GEN_22() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 -#define MUDA_RANGE_GEN_23() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 -#define MUDA_RANGE_GEN_24() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 -#define MUDA_RANGE_GEN_25() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 -#define MUDA_RANGE_GEN_26() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 -#define MUDA_RANGE_GEN_27() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 -#define MUDA_RANGE_GEN_28() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 -#define MUDA_RANGE_GEN_29() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 -#define MUDA_RANGE_GEN_30() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 -#define MUDA_RANGE_GEN_31() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 -#define MUDA_RANGE_GEN_32() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 -#define MUDA_RANGE_GEN_33() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 -#define MUDA_RANGE_GEN_34() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 -#define MUDA_RANGE_GEN_35() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 -#define MUDA_RANGE_GEN_36() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 -#define MUDA_RANGE_GEN_37() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 -#define MUDA_RANGE_GEN_38() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37 -#define MUDA_RANGE_GEN_39() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38 -#define MUDA_RANGE_GEN_40() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 -#define MUDA_RANGE_GEN_41() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 -#define MUDA_RANGE_GEN_42() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41 -#define MUDA_RANGE_GEN_43() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 -#define MUDA_RANGE_GEN_44() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43 -#define MUDA_RANGE_GEN_45() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 -#define MUDA_RANGE_GEN_46() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 -#define MUDA_RANGE_GEN_47() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46 -#define MUDA_RANGE_GEN_48() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47 -#define MUDA_RANGE_GEN_49() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48 -#define MUDA_RANGE_GEN_50() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 -#define MUDA_RANGE_GEN_51() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 -#define MUDA_RANGE_GEN_52() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 -#define MUDA_RANGE_GEN_53() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 -#define MUDA_RANGE_GEN_54() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 -#define MUDA_RANGE_GEN_55() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54 -#define MUDA_RANGE_GEN_56() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55 -#define MUDA_RANGE_GEN_57() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 -#define MUDA_RANGE_GEN_58() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 -#define MUDA_RANGE_GEN_59() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58 -#define MUDA_RANGE_GEN_60() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 -#define MUDA_RANGE_GEN_61() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60 -#define MUDA_RANGE_GEN_62() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61 -#define MUDA_RANGE_GEN_63() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62 -#define MUDA_RANGE_GEN_64() 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63 -#define MUDA_RANGE_GEN(N) MUDA_RANGE_GEN_##N() -#define MUDA_RANGE(N) MUDA_RANGE_GEN(N) - -#define MUDA_STRINGIFY_IMPL(x) #x -#define MUDA_STRINGIFY(x) MUDA_STRINGIFY_IMPL(x) - -#define MUDA_AT_IMPL0(x, ...) x -#define MUDA_AT_IMPL1(x, ...) MUDA_AT_IMPL0(__VA_ARGS__) -#define MUDA_AT_IMPL2(x, ...) MUDA_AT_IMPL1(__VA_ARGS__) -#define MUDA_AT_IMPL3(x, ...) MUDA_AT_IMPL2(__VA_ARGS__) -#define MUDA_AT_IMPL4(x, ...) MUDA_AT_IMPL3(__VA_ARGS__) -#define MUDA_AT_IMPL5(x, ...) MUDA_AT_IMPL4(__VA_ARGS__) -#define MUDA_AT_IMPL6(x, ...) MUDA_AT_IMPL5(__VA_ARGS__) -#define MUDA_AT_IMPL7(x, ...) MUDA_AT_IMPL6(__VA_ARGS__) -#define MUDA_AT_IMPL8(x, ...) MUDA_AT_IMPL7(__VA_ARGS__) -#define MUDA_AT_IMPL9(x, ...) MUDA_AT_IMPL8(__VA_ARGS__) -#define MUDA_AT_IMPL10(x, ...) MUDA_AT_IMPL9(__VA_ARGS__) -#define MUDA_AT_IMPL11(x, ...) MUDA_AT_IMPL10(__VA_ARGS__) -#define MUDA_AT_IMPL12(x, ...) MUDA_AT_IMPL11(__VA_ARGS__) -#define MUDA_AT_IMPL13(x, ...) MUDA_AT_IMPL12(__VA_ARGS__) -#define MUDA_AT_IMPL14(x, ...) MUDA_AT_IMPL13(__VA_ARGS__) -#define MUDA_AT_IMPL15(x, ...) MUDA_AT_IMPL14(__VA_ARGS__) -#define MUDA_AT_IMPL16(x, ...) MUDA_AT_IMPL15(__VA_ARGS__) -#define MUDA_AT_IMPL17(x, ...) MUDA_AT_IMPL16(__VA_ARGS__) -#define MUDA_AT_IMPL18(x, ...) MUDA_AT_IMPL17(__VA_ARGS__) -#define MUDA_AT_IMPL19(x, ...) MUDA_AT_IMPL18(__VA_ARGS__) -#define MUDA_AT_IMPL20(x, ...) MUDA_AT_IMPL19(__VA_ARGS__) -#define MUDA_AT_IMPL21(x, ...) MUDA_AT_IMPL20(__VA_ARGS__) -#define MUDA_AT_IMPL22(x, ...) MUDA_AT_IMPL21(__VA_ARGS__) -#define MUDA_AT_IMPL23(x, ...) MUDA_AT_IMPL22(__VA_ARGS__) -#define MUDA_AT_IMPL24(x, ...) MUDA_AT_IMPL23(__VA_ARGS__) -#define MUDA_AT_IMPL25(x, ...) MUDA_AT_IMPL24(__VA_ARGS__) -#define MUDA_AT_IMPL26(x, ...) MUDA_AT_IMPL25(__VA_ARGS__) -#define MUDA_AT_IMPL27(x, ...) MUDA_AT_IMPL26(__VA_ARGS__) -#define MUDA_AT_IMPL28(x, ...) MUDA_AT_IMPL27(__VA_ARGS__) -#define MUDA_AT_IMPL29(x, ...) MUDA_AT_IMPL28(__VA_ARGS__) -#define MUDA_AT_IMPL30(x, ...) MUDA_AT_IMPL29(__VA_ARGS__) -#define MUDA_AT_IMPL31(x, ...) MUDA_AT_IMPL30(__VA_ARGS__) -#define MUDA_AT_IMPL32(x, ...) MUDA_AT_IMPL31(__VA_ARGS__) -#define MUDA_AT_IMPL33(x, ...) MUDA_AT_IMPL32(__VA_ARGS__) -#define MUDA_AT_IMPL34(x, ...) MUDA_AT_IMPL33(__VA_ARGS__) -#define MUDA_AT_IMPL35(x, ...) MUDA_AT_IMPL34(__VA_ARGS__) -#define MUDA_AT_IMPL36(x, ...) MUDA_AT_IMPL35(__VA_ARGS__) -#define MUDA_AT_IMPL37(x, ...) MUDA_AT_IMPL36(__VA_ARGS__) -#define MUDA_AT_IMPL38(x, ...) MUDA_AT_IMPL37(__VA_ARGS__) -#define MUDA_AT_IMPL39(x, ...) MUDA_AT_IMPL38(__VA_ARGS__) -#define MUDA_AT_IMPL40(x, ...) MUDA_AT_IMPL39(__VA_ARGS__) -#define MUDA_AT_IMPL41(x, ...) MUDA_AT_IMPL40(__VA_ARGS__) -#define MUDA_AT_IMPL42(x, ...) MUDA_AT_IMPL41(__VA_ARGS__) -#define MUDA_AT_IMPL43(x, ...) MUDA_AT_IMPL42(__VA_ARGS__) -#define MUDA_AT_IMPL44(x, ...) MUDA_AT_IMPL43(__VA_ARGS__) -#define MUDA_AT_IMPL45(x, ...) MUDA_AT_IMPL44(__VA_ARGS__) -#define MUDA_AT_IMPL46(x, ...) MUDA_AT_IMPL45(__VA_ARGS__) -#define MUDA_AT_IMPL47(x, ...) MUDA_AT_IMPL46(__VA_ARGS__) -#define MUDA_AT_IMPL48(x, ...) MUDA_AT_IMPL47(__VA_ARGS__) -#define MUDA_AT_IMPL49(x, ...) MUDA_AT_IMPL48(__VA_ARGS__) -#define MUDA_AT_IMPL50(x, ...) MUDA_AT_IMPL49(__VA_ARGS__) -#define MUDA_AT_IMPL51(x, ...) MUDA_AT_IMPL50(__VA_ARGS__) -#define MUDA_AT_IMPL52(x, ...) MUDA_AT_IMPL51(__VA_ARGS__) -#define MUDA_AT_IMPL53(x, ...) MUDA_AT_IMPL52(__VA_ARGS__) -#define MUDA_AT_IMPL54(x, ...) MUDA_AT_IMPL53(__VA_ARGS__) -#define MUDA_AT_IMPL55(x, ...) MUDA_AT_IMPL54(__VA_ARGS__) -#define MUDA_AT_IMPL56(x, ...) MUDA_AT_IMPL55(__VA_ARGS__) -#define MUDA_AT_IMPL57(x, ...) MUDA_AT_IMPL56(__VA_ARGS__) -#define MUDA_AT_IMPL58(x, ...) MUDA_AT_IMPL57(__VA_ARGS__) -#define MUDA_AT_IMPL59(x, ...) MUDA_AT_IMPL58(__VA_ARGS__) -#define MUDA_AT_IMPL60(x, ...) MUDA_AT_IMPL59(__VA_ARGS__) -#define MUDA_AT_IMPL61(x, ...) MUDA_AT_IMPL60(__VA_ARGS__) -#define MUDA_AT_IMPL62(x, ...) MUDA_AT_IMPL61(__VA_ARGS__) -#define MUDA_AT_IMPL63(x, ...) MUDA_AT_IMPL62(__VA_ARGS__) -#define MUDA_AT(index, ...) MUDA_AT_IMPL##index __VA_ARGS__ - diff --git a/src/muda/ext/spgrid/spgrid.h b/src/muda/ext/spgrid/spgrid.h deleted file mode 100644 index 7c422b0d..00000000 --- a/src/muda/ext/spgrid/spgrid.h +++ /dev/null @@ -1,167 +0,0 @@ -#pragma once -#include -#include -#include - -namespace SparseGrid -{ -template -class SPGrid -{ - public: - using LayoutType = Layout; - using StructType = typename Layout::StructType; - - static constexpr size_t Block_size = Layout::Block_size; - static constexpr size_t cell_memory = Layout::cell_memory; - static constexpr size_t Block_memory = Layout::Block_memory; - static constexpr size_t num_T = Layout::num_T; - - SPGrid(){}; - ~SPGrid(){}; - - SPGrid(const SPGrid& other); - SPGrid(size_t& num_blocks); - - - MUDA_HOST void grid_hash_build(muda::BufferView offset_key, - muda::BufferView index); - - MUDA_HOST void Grid_build_topology(); - - MUDA_DEVICE void visit_table(muda::BufferView particle_2_block_id); - - - private: - int* d_data = nullptr; - size_t m_num_blocks = 0; - muda::DeviceBuffer key; - muda::DeviceBuffer value; - muda::DeviceBuffer block_offset; - muda::DeviceVar block_counter; - muda::DeviceBuffer topology_cache; -}; - -template -MUDA_HOST void SPGrid::grid_hash_build(muda::BufferView offset_key, - muda::BufferView index) -{ - muda::Launch().apply( - [index = index.viewer(), - offset_key = offset_key.viewer(), - tablesize = m_num_blocks, - keyTable = key.viewer(), - valueTable = value.viewer(), - block_id2key = block_offset.viewer(), - block_counter = block_counter.viewer()] __device__() mutable - { - auto global_thread_id = blockDim.x * blockIdx.x + threadIdx.x; - - if(global_thread_id > index.total_size()) - { - return; - } - - auto particle_index = index(global_thread_id); - uint64_t key = offset_key(particle_index) >> 6; - uint64_t hashkey = key % tablesize; - int block_id = 0; - - while(true) - { - - auto key_prev = - muda::atomic_cas((unsigned long long int*)keyTable.data() + hashkey, - 0xffffffffffffffff, - (unsigned long long int)key); - if(keyTable(hashkey) == key) - { - - block_id = muda::atomic_add(block_counter.data(), 1); - - valueTable(hashkey) = block_id; - block_id2key(block_id) = key; - break; - } - - else - { - hashkey += 127; - if(hashkey >= tablesize) - hashkey = hashkey % tablesize; - } - } - }); -} - -template -MUDA_HOST void SPGrid::Grid_build_topology() -{ - muda::Launch().apply( - [tablesize = m_num_blocks, - keyTable = key.viewer(), - valueTable = value.viewer(), - block_id2key = block_offset.viewer(), - topology = topology_cache.viewer(), - num_block = block_counter.viewer()]() __device__ mutable - { - auto global_thread_id = blockDim.x * blockIdx.x + threadIdx.x; - if(global_thread_id > num_block) - { - return; - } - - unsigned int block_id = global_thread_id; - auto key = block_id2key(block_id); - - for(int i = -1; i < 2; i++) - { - for(int j = -1; j < 2; j++) - { - for(int k = -1; k < 2; k++) - { - - auto key_neibour = packed_add_morton(key, i, j, k); - auto hashkey_neibour = key_neibour % tablesize; - - while(true) - { - - auto keytable_value = keyTable(hashkey_neibour); - if(keytable_value == key_neibour) - { - topology(27 * block_id - + encode_linear(i + 1, j + 1, k + 1, 3, 3, 3)); - break; - } - else - { - if(keytable_value == 0xffffffffffffffff) - { - auto block_id_neibour = - muda::atomic_add(num_block.data(), 1); - - valueTable(hashkey_neibour) = block_id_neibour; - block_id2key(block_id_neibour) = key_neibour; - } - else - { - hashkey_neibour += 127; - if(hashkey_neibour > tablesize) - { - hashkey_neibour = hashkey_neibour % 127; - } - } - } - } - } - } - } - }); -} - - -} // namespace SparseGrid - - -// #include "details/spgrid.inl" \ No newline at end of file diff --git a/src/muda/ext/spgrid/spgrid_layout.h b/src/muda/ext/spgrid/spgrid_layout.h deleted file mode 100644 index e5700ff9..00000000 --- a/src/muda/ext/spgrid/spgrid_layout.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once -#include -#include "StructType.hpp" -#include "StructReflect.hpp" -namespace SparseGrid{ - - -template -struct StructSOA{}; - -template -struct StructReflect{}; - - -template -class SPGridLayout{ - - public: - - static constexpr size_t Block_size = nx * ny * nz; - static constexpr size_t cell_memory = StructSOA::offset_all() ; - static constexpr size_t Block_memory = cell_memory * Block_size; - static constexpr size_t num_T = Block_memory / sizeof(int); - - StructSOA soa_info; - StructReflect reflect_info; - -}; - -template -constexpr static unsigned int compute_offset() -requires SparseGrid::ScalarType || SparseGrid::VectorType || - SparseGrid::MatrixType -{ - if constexpr (SparseGrid::is_scalar_v){ - return sizeof(typename ChannelType::type); - } - else if constexpr (SparseGrid::is_vector_v){ - return sizeof(typename ChannelType::type) * ChannelType::size; - } - else if constexpr (SparseGrid::is_matrix_v){ - return sizeof(typename ChannelType::type) * ChannelType::rows * ChannelType::cols; - } -}; - - - - - - - - - - -}; \ No newline at end of file diff --git a/src/muda/ext/spgrid/struct_reflect.h b/src/muda/ext/spgrid/struct_reflect.h deleted file mode 100644 index 58381730..00000000 --- a/src/muda/ext/spgrid/struct_reflect.h +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once -#include "Macro.hpp" -#include -#include -#include "StructType.hpp" -#include "SPGridLayout.hpp" - -#define MUDA_SPGRID_MAKE_MEMBER_TYPE(m) \ - using member_type_##m = std::_Remove_cvref_t< \ - decltype(std::declval().m)>; - -#define MUDA_SOA_MEMBER_OFFSET(m)\ -SparseGrid::compute_offset() - - -#define MUDA_SPGRID_STRUCT(S , ...)\ - MUDA_SPGRID_SOA_IMPL(S , __VA_ARGS__)\ - MUDA_SPGRID_REFLECT_STRUCT_IMPL(S , __VA_ARGS__) - - - - -#define MUDA_SPGRID_REFLECT_STRUCT_IMPL(S, ...) \ - template<> \ - class SparseGrid::StructReflect { \ - private: \ - using this_type = S; \ - public: \ - MUDA_MAP(MUDA_SPGRID_MAKE_MEMBER_TYPE, __VA_ARGS__) \ - static constexpr size_t _member_index(std::string_view name) noexcept { \ - constexpr const std::string_view member_names[]{ \ - MUDA_MAP_LIST(MUDA_STRINGIFY, __VA_ARGS__) \ - }; \ - return std::find(std::begin(member_names), \ - std::end(member_names), \ - name) - \ - std::begin(member_names); \ - } \ - static constexpr std::string_view _member_name(size_t index) noexcept { \ - constexpr const std::string_view _member_names[]{ \ - MUDA_MAP_LIST(MUDA_STRINGIFY, __VA_ARGS__) \ - }; \ - return _member_names[index]; \ - } \ - }; - -#define MUDA_SPGRID_SOA_IMPL(S , ...)\ - template<> \ - class SparseGrid::StructSOA{\ - private:\ - using this_type = S;\ - MUDA_MAP(MUDA_SPGRID_MAKE_MEMBER_TYPE, __VA_ARGS__)\ - constexpr static unsigned int SOA_offset[]{\ - MUDA_MAP_LIST(MUDA_SOA_MEMBER_OFFSET, __VA_ARGS__) \ - }; \ - public:\ - static constexpr size_t SOA_Channel_count = sizeof(SOA_offset) / sizeof(SOA_offset[0]);\ - static constexpr unsigned int offset_all(){\ - constexpr unsigned int total_offset = [](){\ - unsigned int sum = 0;\ - for(size_t i = 0 ; i < sizeof(SOA_offset) / sizeof(SOA_offset[0]) ; i++){\ - sum += SOA_offset[i];\ - }\ - return sum;}();\ - return total_offset;};\ - }; - \ No newline at end of file diff --git a/src/muda/ext/spgrid/struct_type.h b/src/muda/ext/spgrid/struct_type.h deleted file mode 100644 index 46d3554f..00000000 --- a/src/muda/ext/spgrid/struct_type.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once -#include -#include -#include - -namespace SparseGrid{ - -template -struct Scalar{ - using type = T; - - T value; -}; - -template -struct Vector{ - using type = T; - static constexpr size_t size = N; - - T value[N]; -}; - -template -struct Matrix{ - using type = T; - static constexpr size_t rows = row; - static constexpr size_t cols = col; - - T value[row*col]; -}; - -// Type traits for Scalar -template -struct is_scalar : std::false_type {}; - -template -struct is_scalar> : std::true_type {}; - -template -inline constexpr bool is_scalar_v = is_scalar::value; - -// Type traits for Vector -template -struct is_vector : std::false_type {}; - -template -struct is_vector> : std::true_type {}; - -template -inline constexpr bool is_vector_v = is_vector::value; - -// Type traits for Matrix -template -struct is_matrix : std::false_type {}; - -template -struct is_matrix> : std::true_type {}; - -template -inline constexpr bool is_matrix_v = is_matrix::value; - -template -concept ScalarType = is_scalar_v; - -template -concept VectorType = is_vector_v; - -template -concept MatrixType = is_matrix_v; - -template -struct underlying_type { - using type = T; // 默认情况 -}; - -template -struct underlying_type> { - using type = T; -}; - -template -struct underlying_type> { - using type = T; -}; - -template -struct underlying_type> { - using type = T; -}; - -template -using underlying_type_t = typename underlying_type::type; - -} - - - diff --git a/src/muda/ext/spgrid/utils.h b/src/muda/ext/spgrid/utils.h index 98c7d986..de56be4b 100644 --- a/src/muda/ext/spgrid/utils.h +++ b/src/muda/ext/spgrid/utils.h @@ -1,87 +1,94 @@ #pragma once -#include +#include -static uint64_t expand_bits(uint32_t v) { +namespace muda::spgrid +{ +static uint64_t expand_bits(uint32_t v) +{ uint64_t x = v; - x = (x | (x << 32)) & 0x1f00000000ffff; - x = (x | (x << 16)) & 0x1f0000ff0000ff; - x = (x | (x << 8)) & 0x100f00f00f00f00f; - x = (x | (x << 4)) & 0x10c30c30c30c30c3; - x = (x | (x << 2)) & 0x1249249249249249; + x = (x | (x << 32)) & 0x1f00000000ffff; + x = (x | (x << 16)) & 0x1f0000ff0000ff; + x = (x | (x << 8)) & 0x100f00f00f00f00f; + x = (x | (x << 4)) & 0x10c30c30c30c30c3; + x = (x | (x << 2)) & 0x1249249249249249; return x; } -static uint32_t compact_bits(uint64_t x) { +static uint32_t compact_bits(uint64_t x) +{ x = x & 0x1249249249249249; - x = (x | (x >> 2)) & 0x10c30c30c30c30c3; - x = (x | (x >> 4)) & 0x100f00f00f00f00f; - x = (x | (x >> 8)) & 0x1f0000ff0000ff; + x = (x | (x >> 2)) & 0x10c30c30c30c30c3; + x = (x | (x >> 4)) & 0x100f00f00f00f00f; + x = (x | (x >> 8)) & 0x1f0000ff0000ff; x = (x | (x >> 16)) & 0x1f00000000ffff; x = (x | (x >> 32)) & 0x1fffff; return (uint32_t)x; } -// 将3D坐标编码为Morton码 -static uint64_t encode_morton(int x, int y, int z) { +static uint64_t encode_morton(int x, int y, int z) +{ return expand_bits(x) | (expand_bits(y) << 1) | (expand_bits(z) << 2); } -// 将Morton码解码为3D坐标 -static void decode_morton(uint64_t morton, int* x, int* y, int* z) { +static void decode_morton(uint64_t morton, int* x, int* y, int* z) +{ *x = compact_bits(morton); *y = compact_bits(morton >> 1); *z = compact_bits(morton >> 2); } -// 对Morton码进行偏移,返回新的Morton码 -static uint64_t packed_add_morton(uint64_t data, int x, int y, int z) { - // 解码原始Morton码 +static uint64_t packed_add_morton(uint64_t data, int x, int y, int z) +{ + // Decode the original Morton code int orig_x, orig_y, orig_z; decode_morton(data, &orig_x, &orig_y, &orig_z); - - // 应用偏移 + + // Apply the offset int new_x = orig_x + x; int new_y = orig_y + y; int new_z = orig_z + z; - - // 边界检查(假设坐标范围为非负数) - if (new_x < 0) new_x = 0; - if (new_y < 0) new_y = 0; - if (new_z < 0) new_z = 0; - - // 重新编码为Morton码 + + // Boundary check (assuming non-negative coordinate range) + if(new_x < 0) + new_x = 0; + if(new_y < 0) + new_y = 0; + if(new_z < 0) + new_z = 0; + + // Re-encode as Morton code return encode_morton(new_x, new_y, new_z); } -// 对线性编码进行偏移,返回新的线性编码 -// 假设线性编码是按照某种3D空间划分规则(如体素网格)进行的 -// 这里假设是在一个固定大小的3D网格中进行线性编码 -template -static uint64_t packed_add_linear(int id, int x, int y, int z) { - - +// Apply an offset to a linear encoding and return the new linear encoding +// Assume the linear encoding is based on some 3D space partitioning rule (e.g., voxel grid) +// Here, assume it is within a fixed-size 3D grid +template +static uint64_t packed_add_linear(int id, int x, int y, int z) +{ constexpr int GRID_SIZE_X = nx; constexpr int GRID_SIZE_Y = ny; constexpr int GRID_SIZE_Z = nz; - - // 从线性ID解码出3D坐标 - int orig_z = id / (GRID_SIZE_X * GRID_SIZE_Y); + + // Decode the 3D coordinates from the linear ID + int orig_z = id / (GRID_SIZE_X * GRID_SIZE_Y); int remaining = id % (GRID_SIZE_X * GRID_SIZE_Y); - int orig_y = remaining / GRID_SIZE_X; - int orig_x = remaining % GRID_SIZE_X; - - // 应用偏移 + int orig_y = remaining / GRID_SIZE_X; + int orig_x = remaining % GRID_SIZE_X; + + // Apply the offset int new_x = orig_x + x; int new_y = orig_y + y; int new_z = orig_z + z; - - // 边界检查和环绕处理 + + // Boundary check and wrap-around handling new_x = ((new_x % GRID_SIZE_X) + GRID_SIZE_X) % GRID_SIZE_X; new_y = ((new_y % GRID_SIZE_Y) + GRID_SIZE_Y) % GRID_SIZE_Y; new_z = ((new_z % GRID_SIZE_Z) + GRID_SIZE_Z) % GRID_SIZE_Z; - - // 重新编码为线性ID + + // Re-encode as a linear ID return new_z * (GRID_SIZE_X * GRID_SIZE_Y) + new_y * GRID_SIZE_X + new_x; } -int encode_linear(int x , int y , int z , int nx , int ny , int nz); \ No newline at end of file +int encode_linear(int x, int y, int z, int nx, int ny, int nz); +} // namespace muda::spgrid diff --git a/src/muda/launch/details/launch.inl b/src/muda/launch/details/launch.inl index 1283d345..4d2c56e9 100644 --- a/src/muda/launch/details/launch.inl +++ b/src/muda/launch/details/launch.inl @@ -48,7 +48,7 @@ namespace details else if constexpr(std::is_invocable_v || std::is_invocable_v) { - static_assert("You should use `ParallelFor()` instead of `Launch()` for better semantics"); + static_assert(always_false_v, "You should use `ParallelFor()` instead of `Launch()` for better semantics"); } else { diff --git a/src/muda/launch/details/memory.inl b/src/muda/launch/details/memory.inl index c9f7db19..60c579bc 100644 --- a/src/muda/launch/details/memory.inl +++ b/src/muda/launch/details/memory.inl @@ -192,7 +192,7 @@ MUDA_INLINE MUDA_HOST Memory& Memory::set( [&] { checkCudaErrors(cudaMemset2DAsync( - data, (int)value, width_bytes, height, pitch, stream())); + data, pitch, (int)value, width_bytes, height, stream())); }, [&] { @@ -210,7 +210,7 @@ MUDA_INLINE MUDA_HOST Memory& Memory::set( else { checkCudaErrors( - cudaMemset2DAsync(data, (int)value, width_bytes, height, pitch, stream())); + cudaMemset2DAsync(data, pitch, (int)value, width_bytes, height, stream())); } return *this; } @@ -233,7 +233,7 @@ MUDA_INLINE MUDA_HOST Memory& Memory::alloc(cudaPitchedPtr* pitched_ptr, return alloc_3d(pitched_ptr, extent, async); } -MUDA_INLINE MUDA_HOST Memory& muda::Memory::free(cudaPitchedPtr pitched_ptr, bool async) +MUDA_INLINE MUDA_HOST Memory& Memory::free(cudaPitchedPtr pitched_ptr, bool async) { return free(pitched_ptr.ptr, async); } diff --git a/src/muda/launch/details/parallel_for.inl b/src/muda/launch/details/parallel_for.inl index 528afb50..98685cfd 100644 --- a/src/muda/launch/details/parallel_for.inl +++ b/src/muda/launch/details/parallel_for.inl @@ -127,7 +127,7 @@ MUDA_HOST MUDA_NODISCARD auto ParallelFor::as_node_parms(int count, F&& f) { using CallableType = raw_type_t; - check_input(count); + // check_input(count); auto parms = std::make_shared>(std::forward(f), count); if(m_grid_dim <= 0) // dynamic grid dim diff --git a/src/muda/launch/parallel_for.h b/src/muda/launch/parallel_for.h index 87007cf2..83161f39 100644 --- a/src/muda/launch/parallel_for.h +++ b/src/muda/launch/parallel_for.h @@ -82,10 +82,10 @@ class ParallelForDetails private: template - friend MUDA_GLOBAL void details::parallel_for_kernel(ParallelForCallable f); + friend MUDA_GLOBAL void details::parallel_for_kernel(details::ParallelForCallable f); template - friend MUDA_GLOBAL void details::grid_stride_loop_kernel(ParallelForCallable f); + friend MUDA_GLOBAL void details::grid_stride_loop_kernel(details::ParallelForCallable f); MUDA_DEVICE ParallelForDetails(ParallelForType type, int i, int total_num) MUDA_NOEXCEPT : m_type(type), @@ -169,6 +169,7 @@ class ParallelFor : public LaunchBase m_block_dim(blockDim), m_shared_mem_size(shared_mem_size) { + // std::cout << "[DEBUG]" << "blockDim: " << blockDim << std::endl; } @@ -234,4 +235,4 @@ class ParallelFor : public LaunchBase }; } // namespace muda -#include "details/parallel_for.inl" \ No newline at end of file +#include "details/parallel_for.inl" diff --git a/src/muda/launch/stream.h b/src/muda/launch/stream.h index ffc23d45..d23c2435 100644 --- a/src/muda/launch/stream.h +++ b/src/muda/launch/stream.h @@ -77,7 +77,7 @@ class Stream std::byte* workspace(size_t byte_size); private: - Stream(nullptr_t) + Stream(std::nullptr_t) : m_handle(nullptr) { } diff --git a/src/muda/logger/details/logger.inl b/src/muda/logger/details/logger.inl index 4499cee6..30e814e3 100644 --- a/src/muda/logger/details/logger.inl +++ b/src/muda/logger/details/logger.inl @@ -193,13 +193,13 @@ MUDA_INLINE void Logger::upload() m_h_offset = {}; m_offset = {m_h_offset}; - m_viewer.m_offset = m_offset.data(); + m_viewer.m_offset = m_offset.data(); m_viewer.m_meta_data_id = m_meta_data_id.data(); - m_viewer.m_meta_data_id_size = m_meta_data_id.size(); + m_viewer.m_meta_data_id_size = static_cast(m_meta_data_id.size()); m_viewer.m_meta_data = m_meta_data.data(); - m_viewer.m_meta_data_size = m_meta_data.size(); + m_viewer.m_meta_data_size = static_cast(m_meta_data.size()); m_viewer.m_buffer = m_buffer.data(); - m_viewer.m_buffer_size = m_buffer.size(); + m_viewer.m_buffer_size = static_cast(m_buffer.size()); if(m_log_viewer_ptr) { diff --git a/src/muda/syntax_sugar.h b/src/muda/syntax_sugar.h index 67f75648..5201c244 100644 --- a/src/muda/syntax_sugar.h +++ b/src/muda/syntax_sugar.h @@ -31,4 +31,12 @@ // } #define $node(name) create_node(name) << [&] -#define $kernel_name() kernel_name(__FUNCTION__) \ No newline at end of file +// usage: +// ParallelFor() +// .$kernel_name() +#define $kernel_name() kernel_name(__FUNCTION__) + +// usage: +// ParallelFor() +// .$file_line() +#define $file_line() file_line(__FILE__, __LINE__) diff --git a/src/muda/viewer/dense/dense_1d.h b/src/muda/viewer/dense/dense_1d.h index f7148950..09c4d848 100644 --- a/src/muda/viewer/dense/dense_1d.h +++ b/src/muda/viewer/dense/dense_1d.h @@ -58,7 +58,7 @@ class Dense1DT : public ViewerBase : m_data(other.data()) , m_dim(other.dim()) { - static_assert(OtherIsConst, "Only non-const viewer can be convert to const viewer"); // TODO: failed at CUDA 13 + static_assert(!OtherIsConst, "Only non-const viewer can be convert to const viewer"); // TODO: failed at CUDA 13 } MUDA_GENERIC auto as_const() const MUDA_NOEXCEPT diff --git a/src/muda/viewer/dense/dense_2d.h b/src/muda/viewer/dense/dense_2d.h index 81f010a2..56bd3f85 100644 --- a/src/muda/viewer/dense/dense_2d.h +++ b/src/muda/viewer/dense/dense_2d.h @@ -54,12 +54,6 @@ class Dense2DBase : public ViewerBase // TODO return ConstViewer{m_data, m_offset, m_dim, m_pitch_bytes}; } - MUDA_GENERIC operator ConstViewer() const MUDA_NOEXCEPT - { - return as_const(); - } - - MUDA_GENERIC auto_const_t& operator()(int x, int y) MUDA_NOEXCEPT { check(); diff --git a/src/muda/viewer/dense/dense_3d.h b/src/muda/viewer/dense/dense_3d.h index 867f582a..3dd478e6 100644 --- a/src/muda/viewer/dense/dense_3d.h +++ b/src/muda/viewer/dense/dense_3d.h @@ -57,11 +57,6 @@ class Dense3DBase : public ViewerBase return ConstViewer{m_data, m_offset, m_dim, m_pitch_bytes, m_pitch_bytes_area}; } - MUDA_GENERIC operator ConstViewer() const MUDA_NOEXCEPT - { - return as_const(); - } - MUDA_GENERIC auto_const_t& operator()(int x, int y, int z) MUDA_NOEXCEPT { check(); diff --git a/test/BUILD.bazel b/test/BUILD.bazel new file mode 100644 index 00000000..3f0a34e9 --- /dev/null +++ b/test/BUILD.bazel @@ -0,0 +1,75 @@ +load("@rules_cuda//cuda:defs.bzl", "cuda_test") + +cuda_test( + name = "muda_unit_test", + srcs = glob([ + "unit_test/**/*.cu", + "unit_test/**/*.cpp", + ]), + copts = [ + "--expt-relaxed-constexpr", + "--extended-lambda", + "-std=c++20", + ], + rdc = True, + deps = [ + "//:muda", + "//third_party:catch2", + "@eigen", + ], +) + +cuda_test( + name = "muda_eigen_test", + srcs = glob([ + "eigen_test/**/*.cu", + "eigen_test/**/*.cpp", + ]), + hdrs = glob( + [ + "eigen_test/**/*.h", + "eigen_test/**/*.hpp", + ], + allow_empty = True, + ), + copts = [ + "--expt-relaxed-constexpr", + "--extended-lambda", + "-std=c++20", + ], + rdc = True, + deps = [ + "//:muda", + "//third_party:catch2", + "@eigen", + ], +) + +cuda_test( + name = "muda_linear_system_test", + srcs = glob([ + "linear_system_test/**/*.cu", + "linear_system_test/**/*.cpp", + ]), + hdrs = glob( + [ + "linear_system_test/**/*.h", + "linear_system_test/**/*.hpp", + ], + allow_empty = True, + ), + copts = [ + "--expt-relaxed-constexpr", + "--extended-lambda", + "-std=c++20", + ], + rdc = True, + deps = [ + "//:muda", + "//third_party:catch2", + "@eigen", + "@cuda//:cublas", + "@cuda//:cusolver", + "@cuda//:cusparse", + ], +) diff --git a/test/data/unit-tests/edge-edge/data_0_0.csv b/test/data/unit-tests/edge-edge/data_0_0.csv deleted file mode 100644 index 412907d6..00000000 --- a/test/data/unit-tests/edge-edge/data_0_0.csv +++ /dev/null @@ -1,432 +0,0 @@ --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --8388609,8388608,1,1,-1,1,0 --8388609,8388608,1,1,1,1,0 --1,1,-2,1,0,1,0 -1,1,-2,1,0,1,0 --8388609,8388608,2,1,-1,1,0 --8388609,8388608,2,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --8388609,8388608,1,1,-1,1,0 --8388609,8388608,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --8388609,8388608,1,1,-1,1,0 --8388609,8388608,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --8388609,8388608,1,1,-1,1,0 --8388609,8388608,1,1,1,1,0 --1,1,-1,8388608,0,1,0 -1,1,-1,8388608,0,1,0 --8388609,8388608,1,8388608,-1,1,0 --8388609,8388608,1,8388608,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --8388609,8388608,1,1,-1,1,0 --8388609,8388608,1,1,1,1,0 --1,1,0,1,0,1,0 -1,1,0,1,0,1,0 --8388609,8388608,0,1,-1,1,0 --8388609,8388608,0,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --8388609,8388608,1,1,-1,1,0 --8388609,8388608,1,1,1,1,0 --1,1,1,8388608,0,1,0 -1,1,1,8388608,0,1,0 --8388609,8388608,-1,8388608,-1,1,0 --8388609,8388608,-1,8388608,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --8388609,8388608,1,1,-1,1,0 --8388609,8388608,1,1,1,1,0 --1,1,1,1,0,1,0 -1,1,1,1,0,1,0 --8388609,8388608,-1,1,-1,1,0 --8388609,8388608,-1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --1,1,1,1,-1,1,0 --1,1,1,1,1,1,0 --1,1,-2,1,0,1,0 -1,1,-2,1,0,1,0 --1,1,2,1,-1,1,0 --1,1,2,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --1,1,1,1,-1,1,0 --1,1,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --1,1,1,1,-1,1,0 --1,1,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --1,1,1,1,-1,1,0 --1,1,1,1,1,1,0 --1,1,-1,8388608,0,1,0 -1,1,-1,8388608,0,1,0 --1,1,1,8388608,-1,1,0 --1,1,1,8388608,1,1,0 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 --1,1,1,1,-1,1,1 --1,1,1,1,1,1,1 --1,1,0,1,0,1,1 -1,1,0,1,0,1,1 --1,1,0,1,-1,1,1 --1,1,0,1,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 --1,1,1,1,-1,1,1 --1,1,1,1,1,1,1 --1,1,1,8388608,0,1,1 -1,1,1,8388608,0,1,1 --1,1,-1,8388608,-1,1,1 --1,1,-1,8388608,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 --1,1,1,1,-1,1,1 --1,1,1,1,1,1,1 --1,1,1,1,0,1,1 -1,1,1,1,0,1,1 --1,1,-1,1,-1,1,1 --1,1,-1,1,1,1,1 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --8388607,8388608,1,1,-1,1,0 --8388607,8388608,1,1,1,1,0 --1,1,-2,1,0,1,0 -1,1,-2,1,0,1,0 --8388607,8388608,2,1,-1,1,0 --8388607,8388608,2,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --8388607,8388608,1,1,-1,1,0 --8388607,8388608,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --8388607,8388608,1,1,-1,1,0 --8388607,8388608,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --8388607,8388608,1,1,-1,1,0 --8388607,8388608,1,1,1,1,0 --1,1,-1,8388608,0,1,0 -1,1,-1,8388608,0,1,0 --8388607,8388608,1,8388608,-1,1,0 --8388607,8388608,1,8388608,1,1,0 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 --8388607,8388608,1,1,-1,1,1 --8388607,8388608,1,1,1,1,1 --1,1,0,1,0,1,1 -1,1,0,1,0,1,1 --8388607,8388608,0,1,-1,1,1 --8388607,8388608,0,1,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 --8388607,8388608,1,1,-1,1,1 --8388607,8388608,1,1,1,1,1 --1,1,1,8388608,0,1,1 -1,1,1,8388608,0,1,1 --8388607,8388608,-1,8388608,-1,1,1 --8388607,8388608,-1,8388608,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 --8388607,8388608,1,1,-1,1,1 --8388607,8388608,1,1,1,1,1 --1,1,1,1,0,1,1 -1,1,1,1,0,1,1 --8388607,8388608,-1,1,-1,1,1 --8388607,8388608,-1,1,1,1,1 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --1,2,1,1,-1,1,0 --1,2,1,1,1,1,0 --1,1,-2,1,0,1,0 -1,1,-2,1,0,1,0 --1,2,2,1,-1,1,0 --1,2,2,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --1,2,1,1,-1,1,0 --1,2,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --1,2,1,1,-1,1,0 --1,2,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 --1,2,1,1,-1,1,0 --1,2,1,1,1,1,0 --1,1,-1,8388608,0,1,0 -1,1,-1,8388608,0,1,0 --1,2,1,8388608,-1,1,0 --1,2,1,8388608,1,1,0 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 --1,2,1,1,-1,1,1 --1,2,1,1,1,1,1 --1,1,0,1,0,1,1 -1,1,0,1,0,1,1 --1,2,0,1,-1,1,1 --1,2,0,1,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 --1,2,1,1,-1,1,1 --1,2,1,1,1,1,1 --1,1,1,8388608,0,1,1 -1,1,1,8388608,0,1,1 --1,2,-1,8388608,-1,1,1 --1,2,-1,8388608,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 --1,2,1,1,-1,1,1 --1,2,1,1,1,1,1 --1,1,1,1,0,1,1 -1,1,1,1,0,1,1 --1,2,-1,1,-1,1,1 --1,2,-1,1,1,1,1 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -0,1,1,1,-1,1,0 -0,1,1,1,1,1,0 --1,1,-2,1,0,1,0 -1,1,-2,1,0,1,0 -0,1,2,1,-1,1,0 -0,1,2,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -0,1,1,1,-1,1,0 -0,1,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -0,1,1,1,-1,1,0 -0,1,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -0,1,1,1,-1,1,0 -0,1,1,1,1,1,0 --1,1,-1,8388608,0,1,0 -1,1,-1,8388608,0,1,0 -0,1,1,8388608,-1,1,0 -0,1,1,8388608,1,1,0 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,1,1,1 --1,1,0,1,0,1,1 -1,1,0,1,0,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,1,1,1 --1,1,1,8388608,0,1,1 -1,1,1,8388608,0,1,1 -0,1,-1,8388608,-1,1,1 -0,1,-1,8388608,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,1,1,1 --1,1,1,1,0,1,1 -1,1,1,1,0,1,1 -0,1,-1,1,-1,1,1 -0,1,-1,1,1,1,1 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -1,2,1,1,-1,1,0 -1,2,1,1,1,1,0 --1,1,-2,1,0,1,0 -1,1,-2,1,0,1,0 -1,2,2,1,-1,1,0 -1,2,2,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -1,2,1,1,-1,1,0 -1,2,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -1,2,1,1,-1,1,0 -1,2,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -1,2,1,1,-1,1,0 -1,2,1,1,1,1,0 --1,1,-1,8388608,0,1,0 -1,1,-1,8388608,0,1,0 -1,2,1,8388608,-1,1,0 -1,2,1,8388608,1,1,0 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -1,2,1,1,-1,1,1 -1,2,1,1,1,1,1 --1,1,0,1,0,1,1 -1,1,0,1,0,1,1 -1,2,0,1,-1,1,1 -1,2,0,1,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -1,2,1,1,-1,1,1 -1,2,1,1,1,1,1 --1,1,1,8388608,0,1,1 -1,1,1,8388608,0,1,1 -1,2,-1,8388608,-1,1,1 -1,2,-1,8388608,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -1,2,1,1,-1,1,1 -1,2,1,1,1,1,1 --1,1,1,1,0,1,1 -1,1,1,1,0,1,1 -1,2,-1,1,-1,1,1 -1,2,-1,1,1,1,1 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -8388607,8388608,1,1,-1,1,0 -8388607,8388608,1,1,1,1,0 --1,1,-2,1,0,1,0 -1,1,-2,1,0,1,0 -8388607,8388608,2,1,-1,1,0 -8388607,8388608,2,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -8388607,8388608,1,1,-1,1,0 -8388607,8388608,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -8388607,8388608,1,1,-1,1,0 -8388607,8388608,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -8388607,8388608,1,1,-1,1,0 -8388607,8388608,1,1,1,1,0 --1,1,-1,8388608,0,1,0 -1,1,-1,8388608,0,1,0 -8388607,8388608,1,8388608,-1,1,0 -8388607,8388608,1,8388608,1,1,0 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -8388607,8388608,1,1,-1,1,1 -8388607,8388608,1,1,1,1,1 --1,1,0,1,0,1,1 -1,1,0,1,0,1,1 -8388607,8388608,0,1,-1,1,1 -8388607,8388608,0,1,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -8388607,8388608,1,1,-1,1,1 -8388607,8388608,1,1,1,1,1 --1,1,1,8388608,0,1,1 -1,1,1,8388608,0,1,1 -8388607,8388608,-1,8388608,-1,1,1 -8388607,8388608,-1,8388608,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -8388607,8388608,1,1,-1,1,1 -8388607,8388608,1,1,1,1,1 --1,1,1,1,0,1,1 -1,1,1,1,0,1,1 -8388607,8388608,-1,1,-1,1,1 -8388607,8388608,-1,1,1,1,1 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -1,1,1,1,-1,1,0 -1,1,1,1,1,1,0 --1,1,-2,1,0,1,0 -1,1,-2,1,0,1,0 -1,1,2,1,-1,1,0 -1,1,2,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -1,1,1,1,-1,1,0 -1,1,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -1,1,1,1,-1,1,0 -1,1,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -1,1,1,1,-1,1,0 -1,1,1,1,1,1,0 --1,1,-1,8388608,0,1,0 -1,1,-1,8388608,0,1,0 -1,1,1,8388608,-1,1,0 -1,1,1,8388608,1,1,0 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -1,1,1,1,-1,1,1 -1,1,1,1,1,1,1 --1,1,0,1,0,1,1 -1,1,0,1,0,1,1 -1,1,0,1,-1,1,1 -1,1,0,1,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -1,1,1,1,-1,1,1 -1,1,1,1,1,1,1 --1,1,1,8388608,0,1,1 -1,1,1,8388608,0,1,1 -1,1,-1,8388608,-1,1,1 -1,1,-1,8388608,1,1,1 --1,1,-1,1,0,1,1 -1,1,-1,1,0,1,1 -1,1,1,1,-1,1,1 -1,1,1,1,1,1,1 --1,1,1,1,0,1,1 -1,1,1,1,0,1,1 -1,1,-1,1,-1,1,1 -1,1,-1,1,1,1,1 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -8388609,8388608,1,1,-1,1,0 -8388609,8388608,1,1,1,1,0 --1,1,-2,1,0,1,0 -1,1,-2,1,0,1,0 -8388609,8388608,2,1,-1,1,0 -8388609,8388608,2,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -8388609,8388608,1,1,-1,1,0 -8388609,8388608,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -8388609,8388608,1,1,-1,1,0 -8388609,8388608,1,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -8388609,8388608,1,1,-1,1,0 -8388609,8388608,1,1,1,1,0 --1,1,-1,8388608,0,1,0 -1,1,-1,8388608,0,1,0 -8388609,8388608,1,8388608,-1,1,0 -8388609,8388608,1,8388608,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -8388609,8388608,1,1,-1,1,0 -8388609,8388608,1,1,1,1,0 --1,1,0,1,0,1,0 -1,1,0,1,0,1,0 -8388609,8388608,0,1,-1,1,0 -8388609,8388608,0,1,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -8388609,8388608,1,1,-1,1,0 -8388609,8388608,1,1,1,1,0 --1,1,1,8388608,0,1,0 -1,1,1,8388608,0,1,0 -8388609,8388608,-1,8388608,-1,1,0 -8388609,8388608,-1,8388608,1,1,0 --1,1,-1,1,0,1,0 -1,1,-1,1,0,1,0 -8388609,8388608,1,1,-1,1,0 -8388609,8388608,1,1,1,1,0 --1,1,1,1,0,1,0 -1,1,1,1,0,1,0 -8388609,8388608,-1,1,-1,1,0 -8388609,8388608,-1,1,1,1,0 diff --git a/test/data/unit-tests/edge-edge/data_0_1.csv b/test/data/unit-tests/edge-edge/data_0_1.csv deleted file mode 100644 index 1d9e2dc8..00000000 --- a/test/data/unit-tests/edge-edge/data_0_1.csv +++ /dev/null @@ -1,160 +0,0 @@ -630931718559537,1125899906842624,-1883075781177795,9007199254740992,1516325040864701,2251799813685248,1 --7924231328300005,18014398509481984,4782339053462229,9007199254740992,-2937858706527785,9007199254740992,1 -2015731967753339,2251799813685248,955714021420697,36028797018963968,-2410794740436875,9007199254740992,1 --4379107904994181,18014398509481984,-4457799507687379,18014398509481984,-7236462922748393,9007199254740992,1 --5392439634816291,9007199254740992,7339373708915809,9007199254740992,2660484627376881,4503599627370496,1 -1148837541168653,4503599627370496,-50374270631273,1125899906842624,3848980609244285,36028797018963968,1 --2457738059856849,4503599627370496,4607533419367713,9007199254740992,3290407237148491,9007199254740992,1 --1675891062974391,9007199254740992,6410004128761653,9007199254740992,1,1,1 --8134024460437121,36028797018963968,-4352781894146971,72057594037927936,-1885810793852133,9007199254740992,1 -4949711024943679,72057594037927936,3725386322209299,18014398509481984,2273143121302417,288230376151711744,1 --4558698002367079,36028797018963968,2596883018765971,9007199254740992,-4511705574452925,1152921504606846976,1 -6216528627342865,18014398509481984,-6255211358980957,1152921504606846976,2310367986890693,36028797018963968,1 --1547572991996429,9007199254740992,5481036615709713,18014398509481984,-2148755174850729,9007199254740992,1 -4268989740778261,288230376151711744,3022216742809079,36028797018963968,-1120368043167569,9007199254740992,1 -1823016523007803,9007199254740992,-1508029487414507,9007199254740992,-6083611483400799,18014398509481984,1 --1,1,3693116319156199,9007199254740992,-4527013866698337,9007199254740992,1 -5924986797630843,4611686018427387904,6400800928357971,288230376151711744,-3064483511349437,144115188075855872,1 --6208512167304697,288230376151711744,-4305132244958929,576460752303423488,1389745544847939,72057594037927936,1 -5729576407264429,288230376151711744,6704326429741271,288230376151711744,-7456563399492847,576460752303423488,1 --8998151794829277,18014398509481984,-8972333948853881,36028797018963968,3518809029533323,18014398509481984,1 -2325217248657045,288230376151711744,-8769014859367901,576460752303423488,-737095052412447,36028797018963968,1 --3111916371134769,144115188075855872,-4820412998313013,2305843009213693952,-6837417736119775,288230376151711744,1 --784524009384037,9007199254740992,-3736147697106029,72057594037927936,3489821833819041,288230376151711744,1 -1,1,2350660839953561,4503599627370496,-8078625005573407,18014398509481984,1 -714787437888239,4503599627370496,716488521787047,4503599627370496,-6622075992619591,288230376151711744,1 -1246777239268147,18014398509481984,-7749065792545587,144115188075855872,7431964693777601,144115188075855872,1 --7195013621063255,72057594037927936,-2251998718362777,36028797018963968,8739218414669925,72057594037927936,1 -4108712247609749,4503599627370496,5661159243835893,9007199254740992,-1,1,1 -6332310309896271,72057594037927936,-1431577159392061,18014398509481984,1466391534239835,18014398509481984,1 -5044880729428737,36028797018963968,-1590030002711141,72057594037927936,-2216824895030645,18014398509481984,1 -8260422153568123,36028797018963968,163897539010871,9007199254740992,-8472602232048025,72057594037927936,1 --1925127026073159,9007199254740992,-608115358625893,2251799813685248,8410804651972809,18014398509481984,1 -985724035629475,4503599627370496,3368535220639455,9007199254740992,-8695187949952497,72057594037927936,1 --7541260937879369,18014398509481984,281004934981665,562949953421312,2409228858143147,4503599627370496,1 -382587937121321,1125899906842624,-2343032539588949,9007199254740992,5119534145494599,36028797018963968,1 --4212611995400579,9007199254740992,5380878232625567,9007199254740992,5738486727253639,9007199254740992,1 --6082301828310603,18014398509481984,-23422428005245,1125899906842624,8796183947751851,18014398509481984,1 --5825703016935887,72057594037927936,3019599349066583,18014398509481984,1019501537618945,2251799813685248,1 --4894136406366971,9007199254740992,4099494304813381,9007199254740992,723589280114789,1125899906842624,1 -1400423030758937,2251799813685248,2531737357911851,18014398509481984,-1,1,1 --8280284658912587,2305843009213693952,-2654679171390037,9007199254740992,-1408643626407379,4503599627370496,1 -3546498150648667,18014398509481984,-3317219071418291,36028797018963968,1309467910915059,9007199254740992,1 --2467859640679855,9007199254740992,-226817811846427,1125899906842624,599826345630589,9007199254740992,1 --4872014738474293,144115188075855872,-1,1,-2397908501296813,9007199254740992,1 -6176624027851313,18014398509481984,3441495795792193,9007199254740992,924622304802185,4503599627370496,1 --7603239808843557,36028797018963968,-2922718166345607,18014398509481984,-29138235987457,281474976710656,1 -4237509212854077,9007199254740992,7900443139434549,9007199254740992,4479156028197141,18014398509481984,1 -6902050687643567,72057594037927936,6763283356585799,18014398509481984,3370359418835797,36028797018963968,1 -6076328334267829,18014398509481984,972213855386051,2251799813685248,-848611874714233,2251799813685248,1 --2383849939340777,4503599627370496,-5308616495164811,9007199254740992,6783598762161559,18014398509481984,1 -8349139400727697,18014398509481984,-1007596928646345,18014398509481984,-3856820626742415,9007199254740992,1 --8999394856046531,288230376151711744,3467042434664921,36028797018963968,5161752020774815,144115188075855872,1 -7284578790951045,36028797018963968,3051851742453251,4503599627370496,8178071104277367,36028797018963968,1 --5616463325923219,9007199254740992,-2753869966623983,4503599627370496,8445351654769087,288230376151711744,1 --1052970027758395,1125899906842624,-6780167013282923,9007199254740992,2952767013398037,9007199254740992,1 --4297525982017327,4503599627370496,-1,1,8524859868048769,36028797018963968,1 --2274788987173881,18014398509481984,-1962054077658081,18014398509481984,3399898108483073,36028797018963968,1 -7579473909088135,72057594037927936,-3975196353342147,144115188075855872,-3090945635884089,36028797018963968,1 -6877512999988005,144115188075855872,-6962264835087777,576460752303423488,5830495714976839,288230376151711744,1 -1,1,-5050586263720343,18014398509481984,-1928078451967155,2251799813685248,1 --2932752537734279,36028797018963968,3446040470281657,144115188075855872,1940940856727295,18014398509481984,1 -7705242887396859,576460752303423488,-1292874086619221,36028797018963968,2933371137384231,36028797018963968,1 --6303288418905435,72057594037927936,-5187121797221867,576460752303423488,3141281078506233,36028797018963968,1 --6819830398657455,18014398509481984,2527584944986015,36028797018963968,6712185552345733,18014398509481984,1 -676201007232619,4503599627370496,8475737070874657,72057594037927936,6302728169543643,72057594037927936,1 -6149994386572989,36028797018963968,5129699318251231,36028797018963968,6201202523182167,72057594037927936,1 --5379452573640407,36028797018963968,618293452911073,4503599627370496,8393667542615111,72057594037927936,1 -814261019144203,1125899906842624,3480772735188209,36028797018963968,7540562442731427,576460752303423488,1 -6097070282434975,36028797018963968,2104938957467223,18014398509481984,1186743638067701,9007199254740992,1 --8546787034909585,72057594037927936,-4462594808989087,4611686018427387904,132640891945239,2251799813685248,1 -5826694932022159,9007199254740992,3202226374973729,72057594037927936,5261431085203523,144115188075855872,1 --1,1,9007179588387215,72057594037927936,8499110658538529,36028797018963968,1 -24062668057541,1125899906842624,680638389999123,2251799813685248,-2489081748631453,4503599627370496,1 --256854435418935,4503599627370496,-3483259098415107,4503599627370496,1974995755337855,4503599627370496,1 --589851793830127,4503599627370496,1565831496147003,2251799813685248,-1474018019014969,4503599627370496,1 --3376497368728059,144115188075855872,3688701573581663,9007199254740992,-8218809471768445,18014398509481984,1 -207646918539701,2251799813685248,-3962410828048277,9007199254740992,4246585588198527,4503599627370496,1 --884190669588565,9007199254740992,4002061624307637,4503599627370496,833525488413741,4503599627370496,1 -3040764937467851,72057594037927936,2496101026229225,18014398509481984,1581749299162799,2251799813685248,1 --6647541446100177,73786976294838206464,-6564346256092691,9007199254740992,6609236564792453,9007199254740992,1 -2078225189487685,4503599627370496,1145336419066715,4503599627370496,0,1,1 --8271053419365621,9007199254740992,548641212458489,2251799813685248,0,1,1 -1566680680178119,4503599627370496,6895566630027,17592186044416,0,1,1 --2840668274962213,4503599627370496,-2754115588559285,9007199254740992,0,1,1 --3280605421692965,9007199254740992,-629557278313333,18014398509481984,0,1,1 --8271053419365621,9007199254740992,548641212458489,2251799813685248,0,1,1 -1566680680178119,4503599627370496,6895566630027,17592186044416,0,1,1 --2840668274962213,4503599627370496,-2754115588559285,9007199254740992,0,1,1 -0,1,690766756505727,4503599627370496,-155823525141361,562949953421312,1 -0,1,-4372716335337965,9007199254740992,1379275415080163,4503599627370496,1 -0,1,-4314503522985993,9007199254740992,-928544001530115,1125899906842624,1 -0,1,-3659262643011625,4503599627370496,1676464309922169,4503599627370496,1 -0,1,-2067250842071405,2251799813685248,-941263827469897,4503599627370496,1 -0,1,-4372716335337965,9007199254740992,1379275415080163,4503599627370496,1 -0,1,-4314503522985993,9007199254740992,-928544001530115,1125899906842624,1 -0,1,-3659262643011625,4503599627370496,1676464309922169,4503599627370496,1 -0,1,1793111821696423,4503599627370496,2385749793108903,4503599627370496,1 -0,1,4362755880452047,4503599627370496,-2794474723072799,4503599627370496,1 -0,1,-379475386348099,1125899906842624,1474438595508733,2251799813685248,1 -0,1,4131034501044815,4503599627370496,-571984201388143,4503599627370496,1 -0,1,450747591734295,2251799813685248,383273266867911,9007199254740992,1 -0,1,4362755880452047,4503599627370496,-2794474723072799,4503599627370496,1 -0,1,-379475386348099,1125899906842624,1474438595508733,2251799813685248,1 -0,1,4131034501044815,4503599627370496,-571984201388143,4503599627370496,1 --4072854301503611,9007199254740992,0,1,171586128263197,1125899906842624,1 -1322512832619939,2251799813685248,0,1,1629929818789075,2251799813685248,1 -1823653727368501,2251799813685248,0,1,432724315935519,4503599627370496,1 --16718023892585,4503599627370496,0,1,3689735742175127,4503599627370496,1 -3692565232187985,9007199254740992,0,1,8289165071890723,18014398509481984,1 -1322512832619939,2251799813685248,0,1,1629929818789075,2251799813685248,1 -1823653727368501,2251799813685248,0,1,432724315935519,4503599627370496,1 --16718023892585,4503599627370496,0,1,3689735742175127,4503599627370496,1 --26562548215889,9007199254740992,0,1,-5796898156392575,9007199254740992,1 -414732974223973,1125899906842624,0,1,-941012343500721,2251799813685248,1 -464360872037547,2251799813685248,0,1,2049590743175215,4503599627370496,1 -2019882341128741,4503599627370496,0,1,-136518190561363,9007199254740992,1 -1379631254818217,2251799813685248,0,1,8700093339928167,9007199254740992,1 -414732974223973,1125899906842624,0,1,-941012343500721,2251799813685248,1 -464360872037547,2251799813685248,0,1,2049590743175215,4503599627370496,1 -2019882341128741,4503599627370496,0,1,-136518190561363,9007199254740992,1 -3773396532514757,2251799813685248,962543065421531,1125899906842624,1943140005432973,1125899906842624,0 -2007302201557827,2251799813685248,0,1,4631119003707381,4503599627370496,0 --1486442864480211,4503599627370496,0,1,716359696455437,1125899906842624,0 -1516937395488587,2251799813685248,0,1,3679302675211421,4503599627370496,0 -1181736460379537,562949953421312,2539384791501597,2251799813685248,2274621560727939,1125899906842624,0 -2007302201557827,2251799813685248,0,1,4631119003707381,4503599627370496,0 --1486442864480211,4503599627370496,0,1,716359696455437,1125899906842624,0 -1516937395488587,2251799813685248,0,1,3679302675211421,4503599627370496,0 --381764944180845,4503599627370496,1131892571638503,4503599627370496,8793529327188823,4503599627370496,0 --270662484749397,2251799813685248,0,1,5343442425477035,4503599627370496,0 --4225073193813341,9007199254740992,0,1,3913579857956547,4503599627370496,0 --1309147400850771,9007199254740992,0,1,-1518741513489043,4503599627370496,0 -565943965320563,9007199254740992,825176239758589,2251799813685248,1428130039473601,562949953421312,0 --270662484749397,2251799813685248,0,1,5343442425477035,4503599627370496,0 --4225073193813341,9007199254740992,0,1,3913579857956547,4503599627370496,0 --1309147400850771,9007199254740992,0,1,-1518741513489043,4503599627370496,0 -3690683712551249,2251799813685248,4454883755272035,4503599627370496,4071234846125449,2251799813685248,0 -4829790060302679,4503599627370496,0,1,7338918872884587,4503599627370496,0 -624442763145179,2251799813685248,0,1,-3134262808560945,9007199254740992,0 --1151448886292089,2251799813685248,0,1,2971826707045817,4503599627370496,0 -5426065602678261,2251799813685248,1578316625295089,1125899906842624,2653480295783079,1125899906842624,0 -4829790060302679,4503599627370496,0,1,7338918872884587,4503599627370496,0 -624442763145179,2251799813685248,0,1,-3134262808560945,9007199254740992,0 --1151448886292089,2251799813685248,0,1,2971826707045817,4503599627370496,0 -6947497827196269,4503599627370496,527389833805649,2251799813685248,2375857316880809,1125899906842624,0 -5161938583858563,4503599627370496,0,1,5896580060800465,4503599627370496,0 -936339322611505,2251799813685248,0,1,-916840792884153,9007199254740992,0 --8121567107724555,9007199254740992,0,1,823111227136315,1125899906842624,0 -5132414997526479,2251799813685248,1919431350264685,2251799813685248,2729659899012409,1125899906842624,0 -5161938583858563,4503599627370496,0,1,5896580060800465,4503599627370496,0 -936339322611505,2251799813685248,0,1,-916840792884153,9007199254740992,0 --8121567107724555,9007199254740992,0,1,823111227136315,1125899906842624,0 -3525679829814573,9007199254740992,7562378010278883,9007199254740992,6816669381980019,4503599627370496,0 -0,1,2537446479890327,4503599627370496,2980288908307741,2251799813685248,0 -0,1,1730070786624251,4503599627370496,2529837230193087,4503599627370496,0 -0,1,-8044828734073205,9007199254740992,-8079308463106093,9007199254740992,0 -74013039888033,70368744177664,7984191366544169,9007199254740992,2579494457201683,1125899906842624,0 -0,1,2537446479890327,4503599627370496,2980288908307741,2251799813685248,0 -0,1,1730070786624251,4503599627370496,2529837230193087,4503599627370496,0 -0,1,-8044828734073205,9007199254740992,-8079308463106093,9007199254740992,0 diff --git a/test/data/unit-tests/vertex-face/data_0_0.csv b/test/data/unit-tests/vertex-face/data_0_0.csv deleted file mode 100644 index 515ccd22..00000000 --- a/test/data/unit-tests/vertex-face/data_0_0.csv +++ /dev/null @@ -1,1000 +0,0 @@ -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 --1,1,1,2,1,1,0 -1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 -1,1,1,2,1,1,0 --1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 --1,1,4194305,8388608,1,1,0 -1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 -1,1,4194305,8388608,1,1,0 --1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 --1,1,1,1,1,1,0 -1,1,1,1,1,1,0 -0,1,1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,-1,8388608,0 -1,1,1,1,1,1,0 --1,1,1,1,1,1,0 -0,1,1,1,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,2,1,-1,8388608,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,2,1,-1,8388608,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 --1,1,1,2,1,1,0 -1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 -1,1,1,2,1,1,0 --1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 --1,1,4194305,8388608,1,1,0 -1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 -1,1,4194305,8388608,1,1,0 --1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 --1,1,1,1,1,1,0 -1,1,1,1,1,1,0 -0,1,1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,0,1,0 -1,1,1,1,1,1,0 --1,1,1,1,1,1,0 -0,1,1,1,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,2,1,0,1,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,2,1,0,1,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 --1,1,1,2,1,1,0 -1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 -1,1,1,2,1,1,0 --1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 --1,1,4194305,8388608,1,1,0 -1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 -1,1,4194305,8388608,1,1,0 --1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 --1,1,1,1,1,1,0 -1,1,1,1,1,1,0 -0,1,1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,2,1,1,8388608,0 -1,1,1,1,1,1,0 --1,1,1,1,1,1,0 -0,1,1,1,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,2,1,1,8388608,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,2,1,1,8388608,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,-1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,-1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,-1,8388608,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,-1,8388608,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,-1,8388608,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,-1,8388608,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,-1,8388608,0 --1,1,1,2,1,1,0 -1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,-1,8388608,0 -1,1,1,2,1,1,0 --1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,-1,8388608,0 --1,1,4194305,8388608,1,1,0 -1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,-1,8388608,0 -1,1,4194305,8388608,1,1,0 --1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,-1,8388608,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,-1,8388608,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,-1,8388608,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,-1,8388608,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,1,2,1,1,0 -1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,1,2,1,1,0 --1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,4194305,8388608,1,1,0 -1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,4194305,8388608,1,1,0 --1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,1,8388608,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,1,8388608,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,1,8388608,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,1,8388608,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,1,8388608,0 --1,1,1,2,1,1,0 -1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,1,8388608,0 -1,1,1,2,1,1,0 --1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,1,8388608,0 --1,1,4194305,8388608,1,1,0 -1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,1,8388608,0 -1,1,4194305,8388608,1,1,0 --1,1,4194305,8388608,1,1,0 -0,1,4194305,8388608,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,1,8388608,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,1,8388608,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,1,8388608,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,1,8388608,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,-1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,-1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,-1,8388608,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,-1,8388608,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,-1,8388608,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,-1,8388608,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,-1,8388608,0 --1,1,1,2,1,1,0 -1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,-1,8388608,0 -1,1,1,2,1,1,0 --1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,-1,8388608,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,-1,8388608,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,-1,8388608,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,-1,8388608,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,-1,8388608,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,-1,8388608,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,0,1,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,0,1,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,0,1,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,0,1,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,0,1,0 --1,1,1,2,1,1,0 -1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,0,1,0 -1,1,1,2,1,1,0 --1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,0,1,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,0,1,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,0,1,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,0,1,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,0,1,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,0,1,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,1,8388608,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,1,8388608,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,1,8388608,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,1,8388608,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,1,8388608,0 --1,1,1,2,1,1,0 -1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194305,8388608,1,8388608,0 -1,1,1,2,1,1,0 --1,1,1,2,1,1,0 -0,1,1,2,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,1,8388608,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,1,8388608,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,1,8388608,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,1,8388608,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,1,8388608,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 diff --git a/test/data/unit-tests/vertex-face/data_0_1.csv b/test/data/unit-tests/vertex-face/data_0_1.csv deleted file mode 100644 index a2532832..00000000 --- a/test/data/unit-tests/vertex-face/data_0_1.csv +++ /dev/null @@ -1,1000 +0,0 @@ -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194305,8388608,1,8388608,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,-1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,-1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,-1,8388608,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,-1,8388608,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,-1,8388608,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,-1,8388608,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,-1,8388608,1 --1,1,1,2,1,1,1 -1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,-1,8388608,1 -1,1,1,2,1,1,1 --1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,-1,8388608,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,-1,8388608,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,-1,8388608,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,-1,8388608,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,-1,8388608,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,-1,8388608,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,0,1,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,0,1,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,0,1,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,0,1,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,0,1,1 --1,1,1,2,1,1,1 -1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,0,1,1 -1,1,1,2,1,1,1 --1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,0,1,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,0,1,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,0,1,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,0,1,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,0,1,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,0,1,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,1,8388608,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,1,8388608,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,1,8388608,0 --1,1,4194303,8388608,1,1,0 -1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,2,1,8388608,0 -1,1,4194303,8388608,1,1,0 --1,1,4194303,8388608,1,1,0 -0,1,4194303,8388608,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,1,8388608,1 --1,1,1,2,1,1,1 -1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,1,8388608,1 -1,1,1,2,1,1,1 --1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,1,8388608,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,1,8388608,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,1,8388608,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,1,8388608,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,1,8388608,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,2,1,8388608,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,-1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,-1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,-1,8388608,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,-1,8388608,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,-1,8388608,1 --1,1,4194303,8388608,1,1,1 -1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,-1,8388608,1 -1,1,4194303,8388608,1,1,1 --1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,-1,8388608,1 --1,1,1,2,1,1,1 -1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,-1,8388608,1 -1,1,1,2,1,1,1 --1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,-1,8388608,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,-1,8388608,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,-1,8388608,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,-1,8388608,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,-1,8388608,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,-1,8388608,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,0,1,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,0,1,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,0,1,1 --1,1,4194303,8388608,1,1,1 -1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,0,1,1 -1,1,4194303,8388608,1,1,1 --1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,0,1,1 --1,1,1,2,1,1,1 -1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,0,1,1 -1,1,1,2,1,1,1 --1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,0,1,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,0,1,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,0,1,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,0,1,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,0,1,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,0,1,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,1,8388608,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,4194303,8388608,1,8388608,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,1,8388608,1 --1,1,4194303,8388608,1,1,1 -1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,1,8388608,1 -1,1,4194303,8388608,1,1,1 --1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,1,8388608,1 --1,1,1,2,1,1,1 -1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,1,8388608,1 -1,1,1,2,1,1,1 --1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,1,8388608,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,1,8388608,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,1,8388608,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,1,8388608,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,1,8388608,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,4194303,8388608,1,8388608,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,0,1,-1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,0,1,-1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 --1,1,4194303,8388608,1,1,1 -1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 -1,1,4194303,8388608,1,1,1 --1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 --1,1,1,2,1,1,1 -1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 -1,1,1,2,1,1,1 --1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,-1,8388608,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,0,1,0,1,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,0,1,0,1,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 --1,1,4194303,8388608,1,1,1 -1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 -1,1,4194303,8388608,1,1,1 --1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 --1,1,1,2,1,1,1 -1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 -1,1,1,2,1,1,1 --1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 --1,1,2,1,1,1,1 -1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,0,1,1 -1,1,2,1,1,1,1 --1,1,2,1,1,1,1 -0,1,2,1,-1,1,1 -0,1,1,1,0,1,0 --1,1,0,1,1,1,0 -1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,0,1,1,8388608,0 --1,1,-1,1,1,1,0 -1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,0 -1,1,0,1,1,1,0 --1,1,0,1,1,1,0 -0,1,0,1,-1,1,0 -0,1,0,1,1,8388608,0 -1,1,-1,1,1,1,0 --1,1,-1,1,1,1,0 -0,1,-1,1,-1,1,0 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,1,8388608,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,1,8388608,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,1,8388608,1 --1,1,4194303,8388608,1,1,1 -1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,1,8388608,1 -1,1,4194303,8388608,1,1,1 --1,1,4194303,8388608,1,1,1 -0,1,4194303,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,1,8388608,1 --1,1,1,2,1,1,1 -1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,1,8388608,1 -1,1,1,2,1,1,1 --1,1,1,2,1,1,1 -0,1,1,2,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,1,8388608,1 --1,1,4194305,8388608,1,1,1 -1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,1,8388608,1 -1,1,4194305,8388608,1,1,1 --1,1,4194305,8388608,1,1,1 -0,1,4194305,8388608,-1,1,1 -0,1,1,1,0,1,1 --1,1,0,1,1,1,1 -1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,1,8388608,1 --1,1,1,1,1,1,1 -1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 -0,1,1,1,0,1,1 -1,1,0,1,1,1,1 --1,1,0,1,1,1,1 -0,1,0,1,-1,1,1 -0,1,0,1,1,8388608,1 -1,1,1,1,1,1,1 --1,1,1,1,1,1,1 -0,1,1,1,-1,1,1 diff --git a/test/eigen_test/CMakeLists.txt b/test/eigen_test/CMakeLists.txt index 056dfef7..ea278c2c 100644 --- a/test/eigen_test/CMakeLists.txt +++ b/test/eigen_test/CMakeLists.txt @@ -1,12 +1,15 @@ # check eigen validation in cuda find_package(Eigen3 REQUIRED) file(GLOB_RECURSE SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/*.cu" "${CMAKE_CURRENT_SOURCE_DIR}/*.h") -add_executable(muda_eigen_test ${SOURCE}) +add_executable(muda_eigen_test) +target_sources(muda_eigen_test PRIVATE ${SOURCE} ${MUDA_HEADER_FILES}) target_compile_features(muda_eigen_test PRIVATE cxx_std_20) set_target_properties(muda_eigen_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON) target_include_directories(muda_eigen_test PRIVATE "${PROJECT_SOURCE_DIR}/test" - "${PROJECT_SOURCE_DIR}/external") + "${PROJECT_SOURCE_DIR}/third_party") target_link_libraries(muda_eigen_test PRIVATE muda Eigen3::Eigen) source_group(TREE "${PROJECT_SOURCE_DIR}/test" PREFIX "test" FILES ${SOURCE}) source_group(TREE "${PROJECT_SOURCE_DIR}/src" PREFIX "src" FILES ${MUDA_HEADER_FILES}) + +add_test(NAME muda_eigen_test COMMAND muda_eigen_test) diff --git a/test/linear_system_test/CMakeLists.txt b/test/linear_system_test/CMakeLists.txt index 72b10279..bbe5fd7b 100644 --- a/test/linear_system_test/CMakeLists.txt +++ b/test/linear_system_test/CMakeLists.txt @@ -4,12 +4,15 @@ file(GLOB_RECURSE SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/*.cu" "${CMAKE_CURRENT_SOURCE_DIR}/*.h") -add_executable(muda_linear_sysytem_test ${SOURCE}) -target_compile_features(muda_linear_sysytem_test PRIVATE cxx_std_20) -set_target_properties(muda_linear_sysytem_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON) -target_include_directories(muda_linear_sysytem_test PRIVATE +add_executable(muda_linear_system_test) +target_sources(muda_linear_system_test PRIVATE ${SOURCE} ${MUDA_HEADER_FILES}) +target_compile_features(muda_linear_system_test PRIVATE cxx_std_20) +set_target_properties(muda_linear_system_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON) +target_include_directories(muda_linear_system_test PRIVATE "${PROJECT_SOURCE_DIR}/test" - "${PROJECT_SOURCE_DIR}/external") -target_link_libraries(muda_linear_sysytem_test PRIVATE muda cusparse cublas cusolver Eigen3::Eigen) + "${PROJECT_SOURCE_DIR}/third_party") +target_link_libraries(muda_linear_system_test PRIVATE muda cusparse cublas cusolver Eigen3::Eigen) source_group(TREE "${PROJECT_SOURCE_DIR}/test" PREFIX "test" FILES ${SOURCE}) -source_group(TREE "${PROJECT_SOURCE_DIR}/src" PREFIX "src" FILES ${MUDA_HEADER_FILES}) \ No newline at end of file +source_group(TREE "${PROJECT_SOURCE_DIR}/src" PREFIX "src" FILES ${MUDA_HEADER_FILES}) + +add_test(NAME muda_linear_system_test COMMAND muda_linear_system_test) diff --git a/test/spgrid_test/CMakeLists.txt b/test/spgrid_test/CMakeLists.txt index ecf9bf3d..61e36ccb 100644 --- a/test/spgrid_test/CMakeLists.txt +++ b/test/spgrid_test/CMakeLists.txt @@ -5,10 +5,13 @@ file(GLOB_RECURSE SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/*.cu" "${CMAKE_CURRENT_SOURCE_DIR}/*.h") -add_executable(muda_spgrid_test ${SOURCE}) +add_executable(muda_spgrid_test) +target_sources(muda_spgrid_test PRIVATE ${SOURCE} ${MUDA_HEADER_FILES}) target_compile_features(muda_spgrid_test PRIVATE cxx_std_20) set_target_properties(muda_spgrid_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON) target_include_directories(muda_spgrid_test PRIVATE "${PROJECT_SOURCE_DIR}/test" - "${PROJECT_SOURCE_DIR}/external") - target_link_libraries(muda_spgrid_test PRIVATE muda Eigen3::Eigen) \ No newline at end of file + "${PROJECT_SOURCE_DIR}/third_party") +target_link_libraries(muda_spgrid_test PRIVATE muda Eigen3::Eigen) + +add_test(NAME muda_spgrid_test COMMAND muda_spgrid_test) diff --git a/test/spgrid_test/spgrid_test.cu b/test/spgrid_test/spgrid_test.cu index d93d193b..8dfd0873 100644 --- a/test/spgrid_test/spgrid_test.cu +++ b/test/spgrid_test/spgrid_test.cu @@ -1,12 +1,9 @@ #include -#include +#include using namespace muda; -void spgrid_test() -{ - -} +void spgrid_test() {} TEST_CASE("spgrid_test", "[spgrid_test]") { diff --git a/test/unit_test/CMakeLists.txt b/test/unit_test/CMakeLists.txt index 92ff0694..79fb23a6 100644 --- a/test/unit_test/CMakeLists.txt +++ b/test/unit_test/CMakeLists.txt @@ -4,13 +4,16 @@ file(GLOB_RECURSE SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/*.cu" "${CMAKE_CURRENT_SOURCE_DIR}/*.h") -add_executable(muda_unit_test ${SOURCE}) +add_executable(muda_unit_test) +target_sources(muda_unit_test PRIVATE ${SOURCE} ${MUDA_HEADER_FILES}) target_compile_features(muda_unit_test PRIVATE cxx_std_20) set_target_properties(muda_unit_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON) target_include_directories(muda_unit_test PRIVATE "${PROJECT_SOURCE_DIR}/test" - "${PROJECT_SOURCE_DIR}/external") + "${PROJECT_SOURCE_DIR}/third_party") target_link_libraries(muda_unit_test PRIVATE muda cusparse cublas cusolver Eigen3::Eigen) target_compile_definitions(muda_unit_test PRIVATE "-DMUDA_TEST_DATA_DIR=R\"(${PROJECT_SOURCE_DIR}/test/data)\"") source_group(TREE "${PROJECT_SOURCE_DIR}/test" PREFIX "test" FILES ${SOURCE}) -source_group(TREE "${PROJECT_SOURCE_DIR}/src" PREFIX "src" FILES ${MUDA_HEADER_FILES}) \ No newline at end of file +source_group(TREE "${PROJECT_SOURCE_DIR}/src" PREFIX "src" FILES ${MUDA_HEADER_FILES}) + +add_test(NAME muda_unit_test COMMAND muda_unit_test) diff --git a/test/unit_test/buffer_test.cu b/test/unit_test/buffer_test.cu index ba7e404b..365679a4 100644 --- a/test/unit_test/buffer_test.cu +++ b/test/unit_test/buffer_test.cu @@ -347,9 +347,4 @@ TEST_CASE("buffer_3d_test", "[buffer]") REQUIRE(dense3d(98, 99, 99) == 3); REQUIRE(dense3d(99, 98, 99) == 3); REQUIRE(dense3d(99, 99, 99) == 3); -} - -TEST_CASE("buffer_view_test", "[buffer]") -{ - -} +} \ No newline at end of file diff --git a/test/unit_test/distance_test.cu b/test/unit_test/distance_test.cu deleted file mode 100644 index e1b80fe2..00000000 --- a/test/unit_test/distance_test.cu +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include -#include - -using namespace muda; - -void distance_test() -{ - -} - -TEST_CASE("distance_test", "[geo]") -{ - distance_test(); -} diff --git a/test/unit_test/field_test.cu b/test/unit_test/field_test.cu index cd7b432d..83e31472 100644 --- a/test/unit_test/field_test.cu +++ b/test/unit_test/field_test.cu @@ -78,7 +78,6 @@ void field_test2(FieldEntryLayout layout) { Field field; auto& particle = field["particle"]; - float dt = 0.01f; // build the field auto builder = particle.AoSoA(); diff --git a/test/unit_test/lbvh_test.cu b/test/unit_test/lbvh_test.cu index 48b74a87..cee86fad 100644 --- a/test/unit_test/lbvh_test.cu +++ b/test/unit_test/lbvh_test.cu @@ -1,213 +1 @@ -#include -#include -#include - -#include -#include -#include -#include - - - -using namespace muda; - -struct AABBGetter -{ - __device__ __host__ lbvh::AABB operator()(const float4 f) const noexcept - { - lbvh::AABB retval; - retval.upper = f; - retval.lower = f; - return retval; - } -}; - -struct DistanceCalculator -{ - __device__ __host__ float operator()(const float4 point, const float4 object) const noexcept - { - return (point.x - object.x) * (point.x - object.x) - + (point.y - object.y) * (point.y - object.y) - + (point.z - object.z) * (point.z - object.z); - } -}; -struct MyAABB -{ - public: - MyAABB() = default; - MyAABB(const MyAABB& other) = default; - MyAABB(MyAABB&& other) = default; - MyAABB& operator=(const MyAABB& other) = default; - MyAABB& operator=(MyAABB&& other) = default; - - int a; -}; -void lbvh_test() -{ - constexpr std::size_t N = 10; - std::vector ps(N); - - std::mt19937 mt(123456789); - std::uniform_real_distribution uni(0.0, 1.0); - - for(auto& p : ps) - { - p.x = uni(mt); - p.y = uni(mt); - p.z = uni(mt); - } - - lbvh::BVH bvh; - - //cub::detail::value_t>>; - - - bvh.objects() = ps; - bvh.build(); - - std::cout << "testing query_device:overlap ...\n"; - thrust::for_each( - thrust::device, - thrust::make_counting_iterator(0), - thrust::make_counting_iterator(N), - [bvh = bvh.viewer().name("bvh")] __device__(std::size_t idx) mutable - { - unsigned int buffer[10]; - const auto self = bvh.object(idx); - const float dr = 0.1f; - for(std::size_t i = 1; i < 10; ++i) - { - uint32_t current_idx = 0; - for(unsigned int j = 0; j < 10; ++j) - { - buffer[j] = 0xFFFFFFFF; - } - - - const float r = dr * i; - lbvh::AABB query_box; - query_box.lower = make_float4(self.x - r, self.y - r, self.z - r, 0); - query_box.upper = make_float4(self.x + r, self.y + r, self.z + r, 0); - const auto num_found = bvh.query(lbvh::overlaps(query_box), - [&] __device__(uint32_t obj_idx) mutable - { - if(current_idx < 10) - { - buffer[current_idx++] = obj_idx; - } - }); - - for(unsigned int j = 0; j < 10; ++j) - { - const auto jdx = buffer[j]; - if(j >= num_found) - { - assert(jdx == 0xFFFFFFFF); - continue; - } - else - { - assert(jdx != 0xFFFFFFFF); - assert(jdx < bvh.num_objects()); - } - const auto other = bvh.object(jdx); - assert(fabsf(self.x - other.x) < r); // check coordinates - assert(fabsf(self.y - other.y) < r); // are in the range - assert(fabsf(self.z - other.z) < r); // of query box - } - } - return; - }); - - std::cout << "testing query_device:nearest_neighbor ...\n"; - thrust::for_each(thrust::device, - thrust::make_counting_iterator(0), - thrust::make_counting_iterator(N), - [bvh = bvh.viewer()] __device__(const unsigned int idx) mutable - { - const auto self = bvh.object(idx); - const auto nest = - bvh.query(lbvh::nearest(self), DistanceCalculator()); - assert(nest.first != 0xFFFFFFFF); - const auto other = bvh.object(nest.first); - // of course, the nearest object is itself. - assert(nest.second == 0.0f); - assert(self.x == other.x); - assert(self.y == other.y); - assert(self.z == other.z); - return; - }); - - thrust::device_vector random_points(N); - thrust::transform(thrust::make_counting_iterator(0), - thrust::make_counting_iterator(N), - random_points.begin(), - [] __device__ __host__(const unsigned int idx) - { - thrust::default_random_engine rand; - thrust::uniform_real_distribution uni(0.0f, 1.0f); - rand.discard(idx); - const float x = uni(rand); - const float y = uni(rand); - const float z = uni(rand); - return make_float4(x, y, z, 0); - }); - - thrust::for_each(random_points.begin(), - random_points.end(), - [bvh = bvh.viewer()] __device__(const float4 pos) mutable - { - const auto calc = DistanceCalculator(); - const auto nest = bvh.query(lbvh::nearest(pos), calc); - assert(nest.first != 0xFFFFFFFF); - - for(unsigned int i = 0; i < bvh.num_objects(); ++i) - { - const auto dist = calc(bvh.object(i), pos); - if(i == nest.first) - { - assert(dist == nest.second); - } - else - { - assert(dist >= nest.second); - } - } - return; - }); - - std::cout << "testing query_host:overlap ...\n"; - { - for(std::size_t i = 0; i < 10; ++i) - { - const auto self = bvh.host_objects()[i]; - const float dr = 0.1f; - for(unsigned int cnt = 1; cnt < 10; ++cnt) - { - const float r = dr * cnt; - lbvh::AABB query_box; - query_box.lower = make_float4(self.x - r, self.y - r, self.z - r, 0); - query_box.upper = make_float4(self.x + r, self.y + r, self.z + r, 0); - - std::vector buffer; - const auto num_found = - lbvh::query(bvh, lbvh::overlaps(query_box), std::back_inserter(buffer)); - - for(unsigned int jdx : buffer) - { - assert(jdx < bvh.host_objects().size()); - - const auto other = bvh.host_objects()[jdx]; - assert(fabsf(self.x - other.x) < r); // check coordinates - assert(fabsf(self.y - other.y) < r); // are in the range - assert(fabsf(self.z - other.z) < r); // of query box - } - } - } - } -} - -TEST_CASE("lbvh_test", "[geo]") -{ - lbvh_test(); -} +// TODO: impl new LBVH \ No newline at end of file diff --git a/test/unit_test/spatial_hash_test.cu b/test/unit_test/spatial_hash_test.cu index 395bfef4..3fda99c6 100644 --- a/test/unit_test/spatial_hash_test.cu +++ b/test/unit_test/spatial_hash_test.cu @@ -1,7 +1,7 @@ #include #include #include -#include +#include using namespace muda; using namespace muda::spatial_hash; diff --git a/test/unit_test/thrust_test.cu b/test/unit_test/thrust_test.cu index 0f88721a..3e54fe4a 100644 --- a/test/unit_test/thrust_test.cu +++ b/test/unit_test/thrust_test.cu @@ -35,7 +35,15 @@ void thrust_test() for_each(nosync_policy, make_counting_iterator(0), make_counting_iterator(N), - [buffer = make_dense_1d(ptr_n.first.get(), N).name("buffer")] __device__(int i) mutable + [buffer = make_dense_1d( +#if CUDA_VERSION < 13000 + ptr_n.first.get() +#else + ptr_n.first +#endif + , + N) + .name("buffer")] __device__(int i) mutable { buffer(i) = i; some_work(); diff --git a/test/unit_test/type_traits_test.cu b/test/unit_test/type_traits_test.cu index 8eff225f..0791981c 100644 --- a/test/unit_test/type_traits_test.cu +++ b/test/unit_test/type_traits_test.cu @@ -20,7 +20,7 @@ bool is_invocable_result() void type_traits_test() { - auto c1 = [] __device__() {}; + [[maybe_unused]] auto c1 = [] __device__() {}; // warning: std::is_invocable_v can't detect lambda in host // the `std::is_invocable_v` is always `true` @@ -31,8 +31,8 @@ void type_traits_test() REQUIRE(is_invocable_result() == true); REQUIRE(is_invocable_result() == false); - auto c2 = [] __device__(const ParallelForDetails& f) {}; - auto c3 = [] __device__(int f) {}; + [[maybe_unused]] auto c2 = [] __device__(const ParallelForDetails& f) {}; + [[maybe_unused]] auto c3 = [] __device__(int f) {}; REQUIRE(is_invocable_result() == false); REQUIRE(is_invocable_result() == true); diff --git a/third_party/BUILD.bazel b/third_party/BUILD.bazel new file mode 100644 index 00000000..b57b88fd --- /dev/null +++ b/third_party/BUILD.bazel @@ -0,0 +1,11 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") + +package(default_visibility = ["//visibility:public"]) + +cc_library( + name = "catch2", + hdrs = glob([ + "catch2/**/*.hpp", + ]), + includes = ["."], +) diff --git a/external/catch2/catch.hpp b/third_party/catch2/catch.hpp similarity index 100% rename from external/catch2/catch.hpp rename to third_party/catch2/catch.hpp diff --git a/external/catch2/catch_reporter_automake.hpp b/third_party/catch2/catch_reporter_automake.hpp similarity index 100% rename from external/catch2/catch_reporter_automake.hpp rename to third_party/catch2/catch_reporter_automake.hpp diff --git a/external/catch2/catch_reporter_sonarqube.hpp b/third_party/catch2/catch_reporter_sonarqube.hpp similarity index 100% rename from external/catch2/catch_reporter_sonarqube.hpp rename to third_party/catch2/catch_reporter_sonarqube.hpp diff --git a/external/catch2/catch_reporter_tap.hpp b/third_party/catch2/catch_reporter_tap.hpp similarity index 100% rename from external/catch2/catch_reporter_tap.hpp rename to third_party/catch2/catch_reporter_tap.hpp diff --git a/external/catch2/catch_reporter_teamcity.hpp b/third_party/catch2/catch_reporter_teamcity.hpp similarity index 100% rename from external/catch2/catch_reporter_teamcity.hpp rename to third_party/catch2/catch_reporter_teamcity.hpp