diff --git a/.github/workflows/build-master.yml b/.github/workflows/build-master.yml index 34c4774f33..ffd2a0bd0e 100644 --- a/.github/workflows/build-master.yml +++ b/.github/workflows/build-master.yml @@ -6,20 +6,21 @@ on: env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - TESTBLACKLIST: "(testCompressedVolWriter|testLongvol|testLinearStructure)" - CONFIG_GLOBAL: -DBUILD_EXAMPLES=true -DBUILD_TESTING=true -DDGTAL_RANDOMIZED_TESTING_THRESHOLD=100 - CONFIG_LINUX: -DWITH_MAGICK=true -DWITH_GMP=true -DWITH_FFTW3=true -DWARNING_AS_ERROR=ON -DWITH_HDF5=true -DWITH_QGLVIEWER=true -DWITH_CAIRO=true -DWITH_ITK=false -DDGTAL_ENABLE_FLOATING_POINT_EXCEPTIONS=true - CONFIG_MAC: -DWITH_EIGEN=true -DWITH_GMP=true - + BUILD_TYPE: Debug + TESTBLACKLIST: "(testLinearStructure|testIntegerConverter)" + CONFIG_GLOBAL: -DBUILD_EXAMPLES=true -DBUILD_TESTING=true -DDGTAL_RANDOMIZED_TESTING_THRESHOLD=10 -DWITH_EIGEN=true + CONFIG_LINUX: -DWITH_OPENMP=true -DWITH_GMP=true -DWITH_FFTW3=true -DWARNING_AS_ERROR=ON -DWITH_HDF5=true -DWITH_QGLVIEWER=true -DWITH_CAIRO=true -DWITH_ITK=true -DDGTAL_ENABLE_FLOATING_POINT_EXCEPTIONS=true -DBUILD_POLYSCOPE_EXAMPLES=true + CONFIG_MAC: -DWITH_GMP=true -DBUILD_POLYSCOPE_EXAMPLES=true + CONFIG_WINDOWS: -DWITH_OPENMP=true -DENABLE_CONAN=true #-DWITH_FFTW3=true #-DWITH_CAIRO=true #-DWITH_ITK=true -DWITH_GMP=true jobs: build: runs-on: ${{ matrix.os }} strategy: - fail-fast: true + fail-fast: false matrix: - os: [ubuntu-latest, macOS-latest] + os: [ubuntu-latest, macOS-latest, windows-latest] + BUILD_TYPE: [Debug,Release] steps: - uses: actions/checkout@v3 @@ -30,11 +31,28 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install zsh libqglviewer-dev-qt5 libboost-dev ninja-build libhdf5-serial-dev libcairo2-dev libgmp-dev libgraphicsmagick++1-dev libfftw3-dev libinsighttoolkit4-dev + sudo apt-get install zsh libqglviewer-dev-qt5 libboost-dev ninja-build libhdf5-serial-dev libboost-dev libcairo2-dev libgmp-dev libfftw3-dev libinsighttoolkit4-dev xorg-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev - name: Install macOS deps if: matrix.os == 'macOS-latest' - run: brew install boost ninja gmp + run: brew install boost ninja gmp libomp + + - name: Install conan + if: matrix.os == 'windows-latest' + id: conan + uses: turtlebrowser/get-conan@main + with: + version: 1.57.0 + + - name: Create conan default profile + if: matrix.os == 'windows-latest' + run: conan profile new default --detect + + - uses: actions/cache@v3 + if: matrix.os == 'windows-latest' + with: + path: ~/.conan + key: ${{ runner.os }}-conan-${{ matrix.BUILD_TYPE }} - name: Get white list of tests run: | @@ -48,26 +66,34 @@ jobs: if: matrix.os == 'ubuntu-latest' shell: bash working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CONFIG_GLOBAL $CONFIG_LINUX -DDGTAL_RANDOMIZED_TESTING_WHITELIST="${{ steps.whitelist.outputs.WHITELIST }}" -G Ninja + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} $CONFIG_GLOBAL $CONFIG_LINUX -DDGTAL_RANDOMIZED_TESTING_WHITELIST="${{ steps.whitelist.outputs.WHITELIST }}" -G Ninja - name: Configure CMake (macOS) if: matrix.os == 'macOS-latest' shell: bash working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CONFIG_GLOBAL $CONFIG_MAC -DDGTAL_RANDOMIZED_TESTING_WHITELIST="${{ steps.whitelist.outputs.WHITELIST }}" -G Ninja + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} $CONFIG_GLOBAL $CONFIG_MAC -DDGTAL_RANDOMIZED_TESTING_WHITELIST="${{ steps.whitelist.outputs.WHITELIST }}" + + - name: Configure CMake (windows) + if: matrix.os == 'windows-latest' + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} $CONFIG_GLOBAL $CONFIG_WINDOWS -DDGTAL_RANDOMIZED_TESTING_WHITELIST="${{ steps.whitelist.outputs.WHITELIST }}" - name: Build working-directory: ${{runner.workspace}}/build shell: bash # Execute the build. You can specify a specific target with "--target " - run: cmake --build . --config $BUILD_TYPE + run: cmake --build . --config ${{ matrix.BUILD_TYPE }} --parallel 3 - name: Test working-directory: ${{runner.workspace}}/build + if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' shell: bash run: | - echo ctest -C $BUILD_TYPE --output-on-failure -E $TESTBLACKLIST - ctest -C $BUILD_TYPE --output-on-failure -E $TESTBLACKLIST + echo ctest -C ${{ matrix.BUILD_TYPE }} --output-on-failure -E $TESTBLACKLIST + ctest -C $${{ matrix.BUILD_TYPE }} --output-on-failure -E $TESTBLACKLIST + - name: DGtalTools (linux only, we check this PR against DGtalTools master) if: matrix.os == 'ubuntu-latest' @@ -81,3 +107,31 @@ jobs: echo cmake .. -DDGTAL_DIR=${{runner.workspace}}/build -DDGTALTOOLS_RANDOMIZED_BUILD_THRESHOLD=25 -G Ninja cmake .. -DDGtal_DIR=${{runner.workspace}}/build -DDGTALTOOLS_RANDOMIZED_BUILD_THRESHOLD=25 -G Ninja ninja + + # Documentatin (build, check and deploy) + Documentation: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up + run: | + sudo apt-get update + sudo apt-get install libboost-dev graphviz texlive doxygen + + - name: Building pages + run: | + mkdir build + cd build + cmake .. + wget --no-check-certificate -O "${{runner.workspace}}/DGtal/build/DGtalTools-tagfile" http://dgtal.org/doc/tags/DGtalTools-tagfile; + make doc > buildDoc.log + + - name: Checking doc + run: | + pwd + export BUILD_DIR=${{runner.workspace}}/DGtal/build + export SRC_DIR=${{runner.workspace}}/DGtal/ + .github/workflows/checkDoxygenDocumentation.sh + #&& .github/workflows/check_src_file_tag.sh diff --git a/.github/workflows/buildAndDocumentation-PR.yml b/.github/workflows/buildAndDocumentation-PR.yml index aaf84edb8f..9dc242ed0b 100644 --- a/.github/workflows/buildAndDocumentation-PR.yml +++ b/.github/workflows/buildAndDocumentation-PR.yml @@ -6,20 +6,21 @@ on: env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - TESTBLACKLIST: "(testLinearStructure)" - CONFIG_GLOBAL: -DBUILD_EXAMPLES=true -DBUILD_TESTING=true -DDGTAL_RANDOMIZED_TESTING_THRESHOLD=10 -DWITH_OPENMP=true - CONFIG_LINUX: -DWITH_GMP=true -DWITH_FFTW3=true -DWARNING_AS_ERROR=ON -DWITH_HDF5=true -DWITH_QGLVIEWER=true -DWITH_CAIRO=true -DWITH_EIGEN=true -DWITH_ITK=true -DDGTAL_ENABLE_FLOATING_POINT_EXCEPTIONS=true - CONFIG_MAC: -DWITH_EIGEN=true -DWITH_GMP=true - + BUILD_TYPE: Debug + TESTBLACKLIST: "(testLinearStructure|testIntegerConverter)" + CONFIG_GLOBAL: -DBUILD_EXAMPLES=true -DBUILD_TESTING=true -DDGTAL_RANDOMIZED_TESTING_THRESHOLD=10 -DWITH_EIGEN=true + CONFIG_LINUX: -DWITH_OPENMP=true -DWITH_GMP=true -DWITH_FFTW3=true -DWARNING_AS_ERROR=ON -DWITH_HDF5=true -DWITH_QGLVIEWER=true -DWITH_CAIRO=true -DWITH_ITK=true -DDGTAL_ENABLE_FLOATING_POINT_EXCEPTIONS=true -DBUILD_POLYSCOPE_EXAMPLES=true + CONFIG_MAC: -DWITH_GMP=true -DBUILD_POLYSCOPE_EXAMPLES=true + CONFIG_WINDOWS: -DWITH_OPENMP=true -DENABLE_CONAN=true #-DWITH_FFTW3=true #-DWITH_CAIRO=true #-DWITH_ITK=true -DWITH_GMP=true jobs: build: runs-on: ${{ matrix.os }} strategy: - fail-fast: true + fail-fast: false matrix: - os: [ubuntu-latest, macOS-latest] + os: [ubuntu-latest, macOS-latest, windows-latest] + BUILD_TYPE: [Debug,Release] steps: - uses: actions/checkout@v3 @@ -30,12 +31,28 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install zsh libqglviewer-dev-qt5 libboost-dev ninja-build libhdf5-serial-dev libboost-dev libcairo2-dev libgmp-dev libfftw3-dev libinsighttoolkit4-dev + sudo apt-get install zsh libqglviewer-dev-qt5 libboost-dev ninja-build libhdf5-serial-dev libboost-dev libcairo2-dev libgmp-dev libfftw3-dev libinsighttoolkit4-dev xorg-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev - name: Install macOS deps if: matrix.os == 'macOS-latest' run: brew install boost ninja gmp libomp + - name: Install conan + if: matrix.os == 'windows-latest' + id: conan + uses: turtlebrowser/get-conan@main + with: + version: 1.57.0 + + - name: Create conan default profile + if: matrix.os == 'windows-latest' + run: conan profile new default --detect + + - uses: actions/cache@v3 + if: matrix.os == 'windows-latest' + with: + path: ~/.conan + key: ${{ runner.os }}-conan-${{ matrix.BUILD_TYPE }} - name: Get white list of tests run: | @@ -49,26 +66,33 @@ jobs: if: matrix.os == 'ubuntu-latest' shell: bash working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CONFIG_GLOBAL $CONFIG_LINUX -DDGTAL_RANDOMIZED_TESTING_WHITELIST="${{ steps.whitelist.outputs.WHITELIST }}" -G Ninja + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} $CONFIG_GLOBAL $CONFIG_LINUX -DDGTAL_RANDOMIZED_TESTING_WHITELIST="${{ steps.whitelist.outputs.WHITELIST }}" -G Ninja - name: Configure CMake (macOS) if: matrix.os == 'macOS-latest' shell: bash working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CONFIG_GLOBAL $CONFIG_MAC -DDGTAL_RANDOMIZED_TESTING_WHITELIST="${{ steps.whitelist.outputs.WHITELIST }}" + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} $CONFIG_GLOBAL $CONFIG_MAC -DDGTAL_RANDOMIZED_TESTING_WHITELIST="${{ steps.whitelist.outputs.WHITELIST }}" + + - name: Configure CMake (windows) + if: matrix.os == 'windows-latest' + shell: bash + working-directory: ${{runner.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} $CONFIG_GLOBAL $CONFIG_WINDOWS -DDGTAL_RANDOMIZED_TESTING_WHITELIST="${{ steps.whitelist.outputs.WHITELIST }}" - name: Build working-directory: ${{runner.workspace}}/build shell: bash # Execute the build. You can specify a specific target with "--target " - run: cmake --build . --config $BUILD_TYPE + run: cmake --build . --config ${{ matrix.BUILD_TYPE }} --parallel 3 - name: Test working-directory: ${{runner.workspace}}/build + if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' shell: bash run: | - echo ctest -C $BUILD_TYPE --output-on-failure -E $TESTBLACKLIST - ctest -C $BUILD_TYPE --output-on-failure -E $TESTBLACKLIST + echo ctest -C ${{ matrix.BUILD_TYPE }} --output-on-failure -E $TESTBLACKLIST + ctest -C $${{ matrix.BUILD_TYPE }} --output-on-failure -E $TESTBLACKLIST - name: DGtalTools (linux only, we check this PR against DGtalTools master) @@ -89,7 +113,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up run: | diff --git a/.github/workflows/welcome.yml b/.github/workflows/welcome.yml.back similarity index 100% rename from .github/workflows/welcome.yml rename to .github/workflows/welcome.yml.back diff --git a/CMakeLists.txt b/CMakeLists.txt index aadafb400d..fc95b2d15e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,6 @@ # Project definition # ----------------------------------------------------------------------------- cmake_minimum_required (VERSION 3.11) -cmake_policy(SET CMP0048 OLD) # project() doesn't have VERSION cmake_policy(SET CMP0057 NEW) # the new interpretation of IN_LIST is by default not set (at least until 3.21.1). project (DGtal) @@ -16,8 +15,13 @@ endif() # ----------------------------------------------------------------------------- # Define variables and cmake parameters, and display some information # ----------------------------------------------------------------------------- +list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) +list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/deps) + + + set(DGtal_VERSION_MAJOR 1) set(DGtal_VERSION_MINOR 4) set(DGtal_VERSION_PATCH beta) @@ -125,11 +129,6 @@ endif() message(STATUS "-------------------------------------------------------------------------------") endif() -# ----------------------------------------------------------------------------- -# Code coverage -# ----------------------------------------------------------------------------- -include(CheckCoverage) - # ----------------------------------------------------------------------------- # Custom command/targets depending on the cmake generator # ----------------------------------------------------------------------------- diff --git a/ChangeLog.md b/ChangeLog.md index 9580bd2b1d..fa3c7dcde0 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,10 +1,15 @@ # DGtal 1.4beta ## New features / critical changes - + - *General* - - Major update: C++17 is now required for DGtal. (David Coeurjolly, + - Major update: C++17 is now required for DGtal. (David Coeurjolly, [#1682](https://github.com/DGtal-team/DGtal/pull/1682)) + - Mandatory dependencies and some optional ones can be setup by + conan.io, especially on windows, new `ENABLE_CONAN` cmake + option to activate this. (David Coeurjolly, + [#1689](https://github.com/DGtal-team/DGtal/pull/1689)) + ## Changes - *IO* @@ -16,6 +21,9 @@ - *Github* - New `/builddoc` and `/fullbuild` commands on PR comments (David Coeurjolly, [#1683](https://github.com/DGtal-team/DGtal/pull/1683)) + - Continuous integration on windows is now performed by Github + Action instead of Appeveyor (David Coeurjolly, + [#1689](https://github.com/DGtal-team/DGtal/pull/1689)) ## Bug fixes @@ -27,7 +35,11 @@ - Removing unnecessary includes to speed-up compilation (David Coeurjolly, [#1680](https://github.com/DGtal-team/DGtal/pull/1680)) - Upgrading pybind11 to v2.9 or python binding (David Coeurjolly, - [#1685](https://github.com/DGtal-team/DGtal/pull/1685)) + [#1685](https://github.com/DGtal-team/DGtal/pull/1685)) + - Many warning fixed (due to c++17 upgrade. (David Coeurjolly, + [#1691](https://github.com/DGtal-team/DGtal/pull/1691)) + - WITH_COVERAGE option removed. (David Coeurjolly, + [#1691](https://github.com/DGtal-team/DGtal/pull/1691)) - *Topology package* - Fix KhalimskySpaceND to get it work with BigInteger (Tristan Roussillon, diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 2390095420..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,89 +0,0 @@ -version: 1.0.{build} - -environment: - BOOST_ROOT: "C:\\Libraries\\boost_1_63_0" - matrix: - - VS_GEN: Visual Studio 14 2015 - CONFIG: RelWithDebInfo - CONFIGQGL: Release - QGLDIR: C:\Libraries - B_NAME: Win32 - BOOST_LIBRARYDIR: "C:\\Libraries\\boost_1_63_0\\lib32-msvc-14.0" - QTDIR: "C:\\Qt\\5.6.3\\msvc2015" - # - VS_GEN: Visual Studio 14 2015 Win64 - # CONFIG: Release - # B_NAME: Win64 - -cache: - - C:\Libraries\libqglviewer - -matrix: - fast_finish: true - - -# Operating system (build VM template) -os: Visual Studio 2015 -branches: - except: - - coverity_scan -skip_tags: true -#platform: ARM -# - x86 -# - x64 -# - ARM - -# scripts that are called at very beginning, before repo cloning -init: - # Print environment info - - set - - msbuild /version - - cmake --version - - set PATH=%QTDIR%\bin;%PATH% - - set CACHEOK=FALSE - -# scripts that run after cloning repository -install: - -before_build: - - # install zlib - - cmd: mkdir c:\zlib - - appveyor DownloadFile "https://ipol-geometry.loria.fr/Sites/zlib-1.2.11.zip" -FileName zlib.zip - - 7z x zlib.zip -oC:\zlib - - cmd: cd C:\zlib - - cmd: mkdir C:\zlib-install - - cmd: mkdir C:\zlib-build - - cmd: cd C:\zlib-build - - cmd: dir C:\zlib - - cmake -G"%VS_GEN%" -DCMAKE_BUILD_TYPE=%CONFIG% -DCMAKE_INSTALL_PREFIX:PATH=c:\zlib-install C:\zlib\zlib-1.2.11 - - msbuild zlib.sln /m - - cmd: msbuild INSTALL.vcxproj - - - #install QGLViewer: - - IF EXIST %QGLDIR%\libqglviewer SET CACHEOK=TRUE - - IF %CACHEOK%==FALSE git clone --depth 1 https://github.com/kerautret/libQGLViewer.git %QGLDIR%\libqglviewer - - IF %CACHEOK%==FALSE cd %QGLDIR%\libqglviewer\QGLViewer - - IF %CACHEOK%==FALSE qmake -t vclib QGLViewer.pro -spec win32-msvc2013 -o qglviewer.vcxproj - - IF %CACHEOK%==FALSE msbuild /m /p:Configuration=%CONFIGQGL% /p:Platform=%B_NAME% qglviewer.vcxproj - - cd %APPVEYOR_BUILD_FOLDER% - - cmake -Wno-dev -G"%VS_GEN%" -DCMAKE_BUILD_TYPE=%CONFIG% -DDGTAL_RANDOMIZED_TESTING_THRESHOLD=33 -DWITH_QGLVIEWER:BOOL=ON -DQGLVIEWER_INCLUDE_DIR=%QGLDIR%\libQGLViewer -DQGLVIEWER_LIBRARIES=%QGLDIR%\libQGLViewer\QGLViewer\QGLViewer2.lib -DWITH_QT5:BOOL=ON -DBUILD_EXAMPLES:BOOL=ON -DBUILD_TESTING:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=FALSE -DZLIB_LIBRARY=c:/zlib-install/lib/zlibd.lib -DZLIB_INCLUDE_DIR=c:/zlib-install/include/ -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% . - - -# - cmake -Wno-dev -G"%VS_GEN%" -DCMAKE_BUILD_TYPE=%CONFIG% -DGDCM_BUILD_TESTING:BOOL=ON -DGDCM_BUILD_APPLICATIONS:BOOL=ON -DGDCM_BUILD_SHARED_LIBS:BOOL=ON -DGDCM_ALLOW_INSOURCE_BUILD:BOOL=ON -DBUILDNAME:STRING=%COMPUTERNAME%-%B_NAME% -DGDCM_WRAP_CSHARP:BOOL=ON -DGDCM_WRAP_JAVA:BOOL=ON -DGDCM_WRAP_PYTHON:BOOL=ON -DGDCM_USE_PVRG:BOOL=ON . - -build_script: - - echo %CONFIG% - # NUMBER_OF_PROCESSORS=2 - # msbuild /m => parallel - #- msbuild gdcm.sln /m /p:Configuration=%config% /toolsversion:14.0 /p:Platform=x64 /p:PlatformToolset=v140 - # Do not run Test=Update/Configure, only Start/Build/Test/Submit (TODO: Coverage) - - - msbuild /m /p:Configuration=%CONFIG% /p:Platform=%B_NAME% DGtal.sln - -# - ctest -D ExperimentalStart -C %CONFIG% - # - ctest -D ExperimentalBuild -j2 -C %CONFIG% - # - ctest -D ExperimentalTest -j2 -C %CONFIG% - -test: off -deploy: off diff --git a/cmake/CheckCoverage.cmake b/cmake/CheckCoverage.cmake deleted file mode 100644 index 7e33894a37..0000000000 --- a/cmake/CheckCoverage.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# ----------------------------------------------------------------------------- -# Coverage brute-froce discovery -# ----------------------------------------------------------------------------- -add_custom_target(lcov) -option(WITH_COVERAGE "Enable lcov code coverage." OFF) -if (WITH_COVERAGE) - message(STATUS "Code coverage enabled") - message(STATUS "-------------------------------------------------------------------------------") - set(DGTAL_PATTERN "*/src/DGtal/*") - add_custom_command(TARGET lcov - COMMAND mkdir -p coverage - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - add_custom_command(TARGET lcov - COMMAND lcov --directory . --capture --output-file ./coverage/stap_all.info --no-checksum - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) - add_custom_command(TARGET lcov - COMMAND lcov --directory . --extract ./coverage/stap_all.info ${DGTAL_PATTERN} --output-file ./coverage/stap.info - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - ) -endif() diff --git a/cmake/CheckDGtalDependencies.cmake b/cmake/CheckDGtalDependencies.cmake index fda67edf0f..315fb37da3 100644 --- a/cmake/CheckDGtalDependencies.cmake +++ b/cmake/CheckDGtalDependencies.cmake @@ -5,6 +5,50 @@ message(STATUS "-------------------------------------------------------------------------------") message(STATUS "DGtal required dependencies: ") + +# ----------------------------------------------------------------------------- +# Mandatory and optional deps via conan +# ----------------------------------------------------------------------------- +option(ENABLE_CONAN "Enable conan for deps discovery (used for windows CI for instance) features." OFF) + + +if (ENABLE_CONAN) + message(STATUS "Conan enabled for deps") + + if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") + message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") + file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/0.18.1/conan.cmake" + "${CMAKE_BINARY_DIR}/conan.cmake" + TLS_VERIFY ON) + endif() + + include(${CMAKE_BINARY_DIR}/conan.cmake) + + conan_cmake_configure(REQUIRES zlib/1.2.13 + boost/1.81.0 + gmp/6.2.1 + fftw/3.3.9 + cairo/1.17.6 + libpng/1.6.39 #Explicit fix deps (compat issues) + expat/2.5.0 + openssl/1.1.1s + libiconv/1.17 + OPTIONS boost:header_only=True + gmp:enable_cxx=True + GENERATORS cmake_find_package) + + conan_cmake_autodetect(settings) + conan_cmake_install(PATH_OR_REFERENCE . + BUILD missing + REMOTE conancenter + SETTINGS ${settings}) + + set(FFTW3_DIR ${CONAN_FFTW_ROOT}) + message(STATUS "Setting FFTW3_DIR to ${CONAN_FFTW_ROOT}") +else() + message(STATUS "Conan disabled") +endif() + # ----------------------------------------------------------------------------- # Looking for boost # ----------------------------------------------------------------------------- diff --git a/cmake/CheckDGtalOptionalDependencies.cmake b/cmake/CheckDGtalOptionalDependencies.cmake index caac239b2a..fb7569cb35 100644 --- a/cmake/CheckDGtalOptionalDependencies.cmake +++ b/cmake/CheckDGtalOptionalDependencies.cmake @@ -19,7 +19,7 @@ option(WITH_ITK "With Insight Toolkit ITK." OFF) option(WITH_CAIRO "With CairoGraphics." OFF) option(WITH_HDF5 "With HDF5." OFF) option(WITH_QGLVIEWER "With LibQGLViewer for 3D visualization (Qt5 required)." OFF) -option(WITH_PATATE "With Patate library for geometry OFF (Eigen required)." processing) +option(WITH_PATATE "With Patate library for geometry processing (Eigen required)." OFF) option(WITH_FFTW3 "With FFTW3 discrete Fourier Transform library." OFF) #---------------------------------- @@ -184,9 +184,9 @@ if(WITH_CAIRO) find_package(Cairo REQUIRED) if(CAIRO_FOUND) target_compile_definitions(DGtal PUBLIC -DWITH_CAIRO) - target_include_directories(DGtal PUBLIC ${CAIRO_INCLUDE_DIRS}) - target_link_libraries(DGtal PUBLIC ${CAIRO_LIBRAIRIES}) - set(DGtalLibDependencies ${DGtalLibDependencies} ${CAIRO_LIBRAIRIES}) + target_include_directories(DGtal PUBLIC ${CAIRO_INCLUDE_DIRS} ${cairo_INCLUDE_DIRS}) + target_link_libraries(DGtal PUBLIC ${CAIRO_LIBRARIES} ${cairo_LIBRARIES}) + set(DGtalLibDependencies ${DGtalLibDependencies} ${CAIRO_LIBRARIES} ${cairo_LIBRARIES}) message(STATUS "cairo found") set(CAIRO_FOUND_DGTAL 1) else() @@ -194,7 +194,7 @@ if(WITH_CAIRO) endif() else() unset(CAIRO_INCLUDE_DIRS) - unset(CAIRO_LIBRAIRIES) + unset(CAIRO_LIBRARIES) endif() # ----------------------------------------------------------------------------- @@ -381,7 +381,7 @@ if(WITH_FFTW3) if(FFTW3_FOUND) set(FFTW3_FOUND_DGTAL 1) target_compile_definitions(DGtal PUBLIC -DWITH_FFTW3) - target_include_directories(DGtal PUBLIC ${FFTW3_INCLUDES}) + target_include_directories(DGtal PUBLIC ${FFTW3_INCLUDES} ${FFTW3_INCLUDE_DIRS}) target_link_libraries(DGtal PUBLIC ${FFTW3_LIBRARIES} ${FFTW3_DEP_LIBRARIES}) set(DGtalLibDependencies ${DGtalLibDependencies} ${FFTW3_LIBRARIES} ${FFTW3_DEP_LIBRARIES}) message(STATUS "FFTW3 is found : ${FFTW3_LIBRARIES}.") diff --git a/cmake/Common.cmake b/cmake/Common.cmake index 0a0ecfadb0..405e470a12 100644 --- a/cmake/Common.cmake +++ b/cmake/Common.cmake @@ -28,7 +28,7 @@ endforeach() # ----------------------------------------------------------------------------- -# CPP11 +# CPP17 # ----------------------------------------------------------------------------- set(DGTAL_CMAKE_CXX_STANDARD_MIN_REQUIRED 17) if(NOT CMAKE_CXX_STANDARD) @@ -45,10 +45,11 @@ if(NOT CMAKE_CXX_STANDARD_REQUIRED) endif() # ----------------------------------------------------------------------------- -# Visual Studio : to distinguish between debug and release lib +# Visual Studio : to distinguish between debug and release lib and /bigobj flag # ----------------------------------------------------------------------------- if (MSVC) set(CMAKE_DEBUG_POSTFIX "d") + add_compile_options(/bigobj) endif() # ----------------------------------------------------------------------------- @@ -102,7 +103,7 @@ option(COLOR_WITH_ALPHA_ARITH "Consider alpha channel in color arithmetical oper option(DGTAL_NO_ESCAPED_CHAR_IN_TRACE "Avoid printing special color and font weight terminal escaped char in program output." OFF) option(DGTAL_CONFIG_HINTS "Provide HINTS to find_dependency in DGtalConfig.cmake. Projects consuming DGtal does not have to provide FOO_DIR to their project, where FOO is a DGtal dependency. Recommended to turn it off when deploying." ON) mark_as_advanced(DGTAL_CONFIG_HINTS) -option(NO_ADD_STBIMAGE_IMPLEMENT "To avoid duplicated linking errors (like LNK2005 in MSVC)" OFF) +option(NO_ADD_STBIMAGE_IMPLEMENT "To avoid duplicated linking errors (like LNK2005 in MSVC)" OFF) #------------------------------------------------------------------------------ # Some directories and files should also be cleaned when invoking 'make clean' #------------------------------------------------------------------------------ diff --git a/cmake/CpackCtest.cmake b/cmake/CpackCtest.cmake index 31d8136996..6576783fa9 100644 --- a/cmake/CpackCtest.cmake +++ b/cmake/CpackCtest.cmake @@ -1,3 +1,4 @@ + #------------------------------------------------------------------------------ # CPack Configurations #------------------------------------------------------------------------------ @@ -41,11 +42,15 @@ if (BUILD_TESTING) message(STATUS "Build test files ENABLED") ENABLE_TESTING() include(CTest) - if (CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 -Wall -Wextra -pedantic -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-long-long -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage") - endif() - if (CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 -Wall -Wextra -W -Wno-long-long -pedantic -fprofile-arcs -ftest-coverage") + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 -Wall \ + -Wno-unknown-pragmas -W -Wshadow -Wunused-variable \ + -Wunused-parameter -Wunused-function -Wno-deprecated-copy -Werror=type-limits -Wno-nonnull -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-delete-non-abstract-non-virtual-dtor -Wunused -Wno-long-long\ + -Wno-system-headers -Wno-deprecated -Wno-dtor-name -Woverloaded-virtual -Wwrite-strings") + endif() + if (CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -O0 -Wall -W -Wno-delete-non-abstract-non-virtual-dtor -Wno-unknown-pragmas\ + -Wno-long-long -pedantic") endif() add_subdirectory (${PROJECT_SOURCE_DIR}/tests) else() diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake index 10f2bdcaa1..4b95e4fab5 100644 --- a/cmake/FindCairo.cmake +++ b/cmake/FindCairo.cmake @@ -23,7 +23,7 @@ FIND_PATH(CAIRO_INCLUDE_DIRS cairo.h ) -find_library(CAIRO_LIBRAIRIES +find_library(CAIRO_LIBRARIES NAMES cairo PATHS /usr/lib /usr/local/lib @@ -34,6 +34,6 @@ find_library(CAIRO_LIBRAIRIES ) set(CAIRO_FOUND 0) -if(CAIRO_LIBRAIRIES AND CAIRO_INCLUDE_DIRS) +if(CAIRO_LIBRARIES AND CAIRO_INCLUDE_DIRS) set(CAIRO_FOUND 1) endif() diff --git a/cmake/deps/polyscope.cmake b/cmake/deps/polyscope.cmake index a335c9750f..f04fd8d798 100644 --- a/cmake/deps/polyscope.cmake +++ b/cmake/deps/polyscope.cmake @@ -4,10 +4,18 @@ endif() include(FetchContent) +set(CMAKE_CXX_FLAGS_DEBUG_OLD "${CMAKE_CXX_FLAGS_DEBUG}") + + FetchContent_Declare( polyscope GIT_REPOSITORY https://github.com/nmwsharp/polyscope.git GIT_TAG v1.2.0 GIT_SHALLOW TRUE ) + +set(CMAKE_CXX_FLAGS_DEBUG "-w") + FetchContent_MakeAvailable(polyscope) + +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_OLD}") diff --git a/examples/dec/exampleSurfaceATNormals.cpp b/examples/dec/exampleSurfaceATNormals.cpp index f9cf78943e..4dd433f996 100644 --- a/examples/dec/exampleSurfaceATNormals.cpp +++ b/examples/dec/exampleSurfaceATNormals.cpp @@ -50,9 +50,7 @@ int main( int argc, char** argv ) typedef Z3i::KSpace KSpace; typedef Shortcuts< KSpace > SH3; typedef ShortcutsGeometry< KSpace > SHG3; - typedef SH3::Surfel Surfel; typedef SH3::Cell Cell; - typedef SHG3::RealVector RealVector; const double alpha_at = 0.1; const double lambda_at = 0.01; @@ -112,6 +110,8 @@ int main( int argc, char** argv ) bool ok3 = SH3::saveVectorFieldOBJ( positions, at_normals, 0.05, SH3::Colors(), "output-vf-at-normals.obj", SH3::Color( 0, 0, 0 ), SH3::Color::Red ); + + ASSERT(ok1 && ok2 && ok3); //! [AT-surface-getV0] SH3::Scalars features( linels.size() ); at_solver.getOutputScalarFieldV0( features, linels.cbegin(), linels.cend(), @@ -135,6 +135,7 @@ int main( int argc, char** argv ) "output-features.obj", SH3::Color( 0, 0, 0 ), SH3::Color::Red ); + ASSERT(ok4); trace.endBlock(); return 0; } diff --git a/examples/geometry/curves/exampleRationalConvexity.cpp b/examples/geometry/curves/exampleRationalConvexity.cpp index e3019ff04f..44d1a2b635 100644 --- a/examples/geometry/curves/exampleRationalConvexity.cpp +++ b/examples/geometry/curves/exampleRationalConvexity.cpp @@ -120,7 +120,7 @@ int main( int argc, char** argv ) auto segment = dconv.makeRationalSimplex( { denominator, T2[i], T2[j] } ); if ( ! dconv.isFullySubconvex( segment, c_cover ) ) break; } - j = ( j + T2.size() - 1 ) % T2.size(); + j = (unsigned int)( j + T2.size() - 1 ) % T2.size(); if ( j != last_j ) { // display fully subconvex segments aBoard.setLineWidth( 2.5 ); diff --git a/examples/geometry/meshes/curvature-comparator-ii-cnc-3d.cpp b/examples/geometry/meshes/curvature-comparator-ii-cnc-3d.cpp index c0dee3a7cc..a307cef91c 100644 --- a/examples/geometry/meshes/curvature-comparator-ii-cnc-3d.cpp +++ b/examples/geometry/meshes/curvature-comparator-ii-cnc-3d.cpp @@ -136,7 +136,6 @@ int main( int argc, char* argv[] ) typedef SurfaceMesh< RealPoint, RealVector > SM; typedef CorrectedNormalCurrentComputer< RealPoint, RealVector > CNC; typedef Shortcuts< KSpace > SH; - typedef SH::DigitalSurface DigSurf; typedef ShortcutsGeometry< KSpace > SHG; //! [curvature-comparator-Typedefs] std::string poly = argv[ 1 ]; // polynomial diff --git a/examples/geometry/meshes/vol-curvature-measures-icnc-XY-3d.cpp b/examples/geometry/meshes/vol-curvature-measures-icnc-XY-3d.cpp index cbf9e7565d..84f1afde31 100644 --- a/examples/geometry/meshes/vol-curvature-measures-icnc-XY-3d.cpp +++ b/examples/geometry/meshes/vol-curvature-measures-icnc-XY-3d.cpp @@ -133,7 +133,6 @@ int main( int argc, char* argv[] ) using namespace DGtal::Z3i; typedef SurfaceMesh< RealPoint, RealVector > SM; typedef CorrectedNormalCurrentComputer< RealPoint, RealVector > CNC; - typedef SurfaceMeshReader< RealPoint, RealVector > SMR; typedef Shortcuts< KSpace > SH; typedef ShortcutsGeometry< KSpace > SHG; //! [curvature-measures-Typedefs] diff --git a/examples/geometry/volumes/exampleBoundedLatticePolytopeCount2D.cpp b/examples/geometry/volumes/exampleBoundedLatticePolytopeCount2D.cpp index 2c2d9e675a..363f773dd4 100644 --- a/examples/geometry/volumes/exampleBoundedLatticePolytopeCount2D.cpp +++ b/examples/geometry/volumes/exampleBoundedLatticePolytopeCount2D.cpp @@ -66,7 +66,6 @@ int main( int argc, char* argv[] ) int R = argc > 3 ? atoi( argv[ 3 ] ) : 200; // max diameter of shape typedef int64_t Integer; - typedef DGtal::SpaceND< 2, Integer > Space; typedef DGtal::ConvexityHelper< 2, Integer > Helper; typedef Helper::LatticePolytope Polytope; typedef Polytope::Point Point; diff --git a/examples/geometry/volumes/exampleBoundedLatticePolytopeCount3D.cpp b/examples/geometry/volumes/exampleBoundedLatticePolytopeCount3D.cpp index a84600b163..a4ba6fab87 100644 --- a/examples/geometry/volumes/exampleBoundedLatticePolytopeCount3D.cpp +++ b/examples/geometry/volumes/exampleBoundedLatticePolytopeCount3D.cpp @@ -66,7 +66,6 @@ int main( int argc, char* argv[] ) int R = argc > 3 ? atoi( argv[ 3 ] ) : 50; // max diameter of shape typedef int64_t Integer; - typedef DGtal::SpaceND< 3, Integer > Space; typedef DGtal::ConvexityHelper< 3, Integer > Helper; typedef Helper::LatticePolytope Polytope; typedef Polytope::Point Point; diff --git a/examples/geometry/volumes/exampleBoundedLatticePolytopeCount4D.cpp b/examples/geometry/volumes/exampleBoundedLatticePolytopeCount4D.cpp index 3bb1241772..a0ede4cf17 100644 --- a/examples/geometry/volumes/exampleBoundedLatticePolytopeCount4D.cpp +++ b/examples/geometry/volumes/exampleBoundedLatticePolytopeCount4D.cpp @@ -66,7 +66,6 @@ int main( int argc, char* argv[] ) int R = argc > 3 ? atoi( argv[ 3 ] ) : 50; // max diameter of shape typedef int64_t Integer; - typedef DGtal::SpaceND< 4, Integer > Space; typedef DGtal::ConvexityHelper< 4, Integer > Helper; typedef Helper::LatticePolytope Polytope; typedef Polytope::Point Point; diff --git a/examples/images/exampleArrayImageAdapter.cpp b/examples/images/exampleArrayImageAdapter.cpp index e7722eb3f0..dedbe4c35e 100644 --- a/examples/images/exampleArrayImageAdapter.cpp +++ b/examples/images/exampleArrayImageAdapter.cpp @@ -45,7 +45,6 @@ //! [include] /////////////////////////////////////////////////////////////////////////////// - using namespace std; using namespace DGtal; /////////////////////////////////////////////////////////////////////////////// diff --git a/examples/polyscope-examples/CMakeLists.txt b/examples/polyscope-examples/CMakeLists.txt index f220d8f9c6..64020d5ed8 100644 --- a/examples/polyscope-examples/CMakeLists.txt +++ b/examples/polyscope-examples/CMakeLists.txt @@ -1,3 +1,4 @@ + # ----------------------------------------------------------------------------- # Fetching polyscope (only if the WITH_POLYSCOPE_EXAMPLES Variable has been set to true) # ----------------------------------------------------------------------------- @@ -9,9 +10,6 @@ endif() if(BUILD_SHARED_LIBS) message(FATAL_ERROR "Polyscope examples require static build of the DGtal. Please set BUILD_SHARED_LIBS variable to OFF") endif() -if(NOT WITH_EIGEN) - message(FATAL_ERROR "Polyscope Polygonal Calculus examples require Eigen (WITH_EIGEN=true)") -endif() # Make sure the compiler can find include files. include_directories (${PROJECT_SOURCE_DIR}/src/) @@ -43,10 +41,15 @@ set(POLYSCOPE_SRCS tangency-reconstruction ) +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(MY_DEBUG_OPTIONS "-w") +endif() + foreach(FILE ${POLYSCOPE_SRCS}) #We should be using `DGtal_add_example(${FILE} polyscope)` to #enable the randomized testing but it does not work (polyscope headers are #not found properly). add_executable(${FILE} ${FILE}.cpp) target_link_libraries(${FILE} DGtal ${DGtalLibDependencies} polyscope Eigen3::Eigen) + target_compile_options(${FILE} PUBLIC "$<$:${MY_DEBUG_OPTIONS}>") endforeach() diff --git a/examples/polyscope-examples/SymmetricConvexExpander.h b/examples/polyscope-examples/SymmetricConvexExpander.h index 2c90844915..7dfe23db6c 100644 --- a/examples/polyscope-examples/SymmetricConvexExpander.h +++ b/examples/polyscope-examples/SymmetricConvexExpander.h @@ -175,7 +175,7 @@ namespace DGtal while ( ! finished() ) { const auto p = current().first; - const auto d = current().second; // current ring distance + //NOT USED const auto d = current().second; // current ring distance const auto sp = symmetric( p ); myPoints.insert( p ); myPoints.insert( sp ); diff --git a/examples/polyscope-examples/exampleBunnyHead.cpp b/examples/polyscope-examples/exampleBunnyHead.cpp index 839aae384a..cf9d4dc2a6 100644 --- a/examples/polyscope-examples/exampleBunnyHead.cpp +++ b/examples/polyscope-examples/exampleBunnyHead.cpp @@ -154,7 +154,6 @@ DenseMatrix HarmonicParametrization() //Visualization of the boundary edges std::vector pos; - size_t cpt=0; for(const auto v: B) pos.push_back(surfmesh.position(v)); polyscope::registerCurveNetworkLoop("Longest boundary", pos); @@ -262,7 +261,6 @@ void computeGeodesics() { PC calculus(surfmesh); GeodesicsInHeat GHM(calculus); - typedef PC::Vector Vector; std::vector X_0; auto nv = surfmesh.nbVertices(); diff --git a/examples/polyscope-examples/tangency-reconstruction.cpp b/examples/polyscope-examples/tangency-reconstruction.cpp index 931ea0bba3..862cfeed27 100644 --- a/examples/polyscope-examples/tangency-reconstruction.cpp +++ b/examples/polyscope-examples/tangency-reconstruction.cpp @@ -106,7 +106,7 @@ typedef std::vector< Index > Indices; typedef double Scalar; typedef std::vector< Scalar > Scalars; -Size pickPoint() +int pickPoint() { if ( order.size() != digital_points.size() ) { @@ -117,9 +117,9 @@ Size pickPoint() current = 0; } if ( current == order.size() ) current = 0; - return order[ current++ ]; + return static_cast(order[ current++ ]); } -Size pickOuterPoint() +int pickOuterPoint() { if ( outer_order.size() != outer_digital_points.size() ) { @@ -130,7 +130,7 @@ Size pickOuterPoint() outer_current = 0; } if ( outer_current == outer_order.size() ) outer_current = 0; - return outer_order[ outer_current++ ]; + return static_cast(outer_order[ outer_current++ ]); } // ---------------------------------------------------------------------- @@ -512,10 +512,8 @@ void updateReconstructionFromCells( Point x, Point y, void updateReconstructionFromTangentConeLines( int vertex_idx ) { - typedef QuickHull3D::IndexRange IndexRange; if ( digital_points.empty() ) return; if ( vertex_idx < 0 || vertex_idx >= digital_points.size() ) return; - typedef std::size_t Size; const auto p = digital_points[ vertex_idx ]; // trace.beginBlock( "Compute tangent cone" ); auto local_X_idx = TC.getCotangentPoints( p ); @@ -535,7 +533,6 @@ void updateReconstructionFromTangentConeTriangles( int vertex_idx ) typedef QuickHull3D::IndexRange IndexRange; if ( digital_points.empty() ) return; if ( vertex_idx < 0 || vertex_idx >= digital_points.size() ) return; - typedef std::size_t Size; const auto p = digital_points[ vertex_idx ]; // trace.beginBlock( "Compute tangent cone" ); auto local_X_idx = TC.getCotangentPoints( p ); @@ -656,8 +653,6 @@ void updateReconstructionFromLocalTangentDelaunayComplex( int vertex_idx) local_LS = DGtal::LatticeSetByIntervals< Space >( local_X.cbegin(), local_X.cend(), 0 ).starOfPoints(); typedef ConvexCellComplex< Point >::Index Index; - typedef ConvexCellComplex< Point >::VertexRange VertexRange; - typedef ConvexCellComplex< Point >::Cell Cell; ConvexCellComplex< Point > dcomplex; bool ok = CvxHelper::computeDelaunayCellComplex( dcomplex, local_X, false ); if ( ! ok ) @@ -671,7 +666,7 @@ void updateReconstructionFromLocalTangentDelaunayComplex( int vertex_idx) { auto Y = dcomplex.cellVertexPositions( c ); auto P = dconv.makePolytope( Y ); - if ( P.countUpTo( Y.size()+1 ) >= Y.size()+1 ) continue; + if ( P.countUpTo( (Integer)Y.size()+1 ) >= (Integer)Y.size()+1 ) continue; is_cell_tangent[ c ] = local_tangency ? dconv.isFullySubconvex( P, local_LS ) @@ -746,8 +741,6 @@ void updateOuterReconstructionFromLocalTangentDelaunayComplex( int vertex_idx) local_X.push_back( outer_TC.point( idx ) ); typedef ConvexCellComplex< Point >::Index Index; - typedef ConvexCellComplex< Point >::VertexRange VertexRange; - typedef ConvexCellComplex< Point >::Cell Cell; ConvexCellComplex< Point > dcomplex; bool ok = CvxHelper::computeDelaunayCellComplex( dcomplex, local_X, false ); if ( ! ok ) @@ -761,7 +754,7 @@ void updateOuterReconstructionFromLocalTangentDelaunayComplex( int vertex_idx) { auto Y = dcomplex.cellVertexPositions( c ); auto P = dconv.makePolytope( Y ); - if ( P.countUpTo( Y.size()+1 ) >= Y.size()+1 ) continue; + if ( P.countUpTo( (Integer)Y.size()+1 ) >= (Integer)Y.size()+1 ) continue; is_cell_tangent[ c ] = dconv.isFullySubconvex( P, outer_LS ); } else @@ -815,8 +808,6 @@ void computeLocalTangentDelaunayComplex( int vertex_idx) local_LS = DGtal::LatticeSetByIntervals< Space >( local_X.cbegin(), local_X.cend(), 0 ).starOfPoints(); typedef ConvexCellComplex< Point >::Index Index; - typedef ConvexCellComplex< Point >::VertexRange VertexRange; - typedef ConvexCellComplex< Point >::Cell Cell; ConvexCellComplex< Point > dcomplex; bool ok = CvxHelper::computeDelaunayCellComplex( dcomplex, local_X, false ); if ( ! ok ) @@ -830,7 +821,7 @@ void computeLocalTangentDelaunayComplex( int vertex_idx) { auto Y = dcomplex.cellVertexPositions( c ); auto P = dconv.makePolytope( Y ); - if ( P.countUpTo( Y.size()+1 ) >= Y.size()+1 ) continue; + if ( P.countUpTo( (Integer)Y.size()+1 ) >= (Integer)Y.size()+1 ) continue; is_cell_tangent[ c ] = local_tangency ? dconv.isFullySubconvex( P, local_LS ) @@ -907,8 +898,6 @@ void computeGlobalTangentDelaunayComplex() trace.beginBlock( "Compute global tangent Delaunay complex" ); typedef ConvexCellComplex< Point >::Index Index; - typedef ConvexCellComplex< Point >::VertexRange VertexRange; - typedef ConvexCellComplex< Point >::Cell Cell; ConvexCellComplex< Point > dcomplex; bool ok = CvxHelper::computeDelaunayCellComplex( dcomplex, digital_points, false ); if ( ! ok ) @@ -923,7 +912,7 @@ void computeGlobalTangentDelaunayComplex() { auto Y = dcomplex.cellVertexPositions( c ); auto P = dconv.makePolytope( Y ); - if ( P.countUpTo( Y.size()+1 ) >= Y.size()+1 ) continue; + if ( P.countUpTo( (Integer)Y.size()+1 ) >= (Integer)Y.size()+1 ) continue; is_cell_tangent[ c ] = dconv.isFullySubconvex( P, LS ); } @@ -1014,7 +1003,7 @@ void myCallback() bool goodSelection = false; auto selection = polyscope::pick::getSelection(); auto selectedSurface = static_cast(selection.first); - int idx = selection.second; + const auto idx = selection.second; // Only authorize selection on the input surface and the reconstruction auto surf = polyscope::getSurfaceMesh("Input surface"); @@ -1028,7 +1017,7 @@ void myCallback() std::ostringstream otext; otext << "Selected vertex = " << idx; ImGui::Text( "%s", otext.str().c_str() ); - vertex_idx = idx; + vertex_idx = (Integer)idx; } else vertex_idx = -1; } diff --git a/examples/tutorial-examples/shortcuts-geometry.cpp b/examples/tutorial-examples/shortcuts-geometry.cpp index 8bc2d2ade4..3afc5006c2 100644 --- a/examples/tutorial-examples/shortcuts-geometry.cpp +++ b/examples/tutorial-examples/shortcuts-geometry.cpp @@ -335,7 +335,7 @@ int main( int /* argc */, char** /* argv */ ) SH3::RealPoints positions( surfels.size() ); std::transform( surfels.cbegin(), surfels.cend(), positions.begin(), [&] (const SH3::SCell& c) { return embedder( c ); } ); - bool ok = SH3::saveOBJ( surface, SH3::RealVectors(), SH3::Colors(), + SH3::saveOBJ( surface, SH3::RealVectors(), SH3::Colors(), "goursat-primal.obj" ); // output principal curvatures and directions auto cmap = SH3::getColorMap( -0.5, 0.5, params ); @@ -348,6 +348,7 @@ int main( int /* argc */, char** /* argv */ ) bool ok_k2 = SH3::saveOBJ( surface, SH3::RealVectors(), colors, "goursat-primal-k2.obj" ); bool ok_d2 = SH3::saveVectorFieldOBJ( positions, d2, 0.05, colors, "goursat-primal-d2.obj", SH3::Color::Black ); + ASSERT(ok_k1 && ok_d1 && ok_k2 && ok_d2); //! [dgtal_shortcuts_ssec2_2_13s] } trace.endBlock(); diff --git a/src/BoostAddons/zlib.cpp b/src/BoostAddons/zlib.cpp index 0fec9da133..f03bb8362a 100644 --- a/src/BoostAddons/zlib.cpp +++ b/src/BoostAddons/zlib.cpp @@ -123,10 +123,10 @@ void zlib_base::after(const char*& src_begin, char*& dest_begin, bool compress) static_cast(next_in - src_begin) : static_cast(next_out - dest_begin); if (length > 0) - crc_ = crc_imp_ = crc32(crc_imp_, buf, length); + crc_ = crc_imp_ = static_cast(crc32(crc_imp_, buf, length)); } - total_in_ = s->total_in; - total_out_ = s->total_out; + total_in_ = static_cast(s->total_in); + total_out_ = static_cast(s->total_out); src_begin = const_cast(next_in); dest_begin = next_out; } diff --git a/src/DGtal/arithmetic/ClosedIntegerHalfPlane.h b/src/DGtal/arithmetic/ClosedIntegerHalfPlane.h index 132de1b525..e3c4d8fa1a 100644 --- a/src/DGtal/arithmetic/ClosedIntegerHalfPlane.h +++ b/src/DGtal/arithmetic/ClosedIntegerHalfPlane.h @@ -82,7 +82,7 @@ namespace DGtal /** * Destructor. */ - ~ClosedIntegerHalfPlane(); + ~ClosedIntegerHalfPlane() {}; /** * Default constructor. */ diff --git a/src/DGtal/arithmetic/ClosedIntegerHalfPlane.ih b/src/DGtal/arithmetic/ClosedIntegerHalfPlane.ih index 9599d7def8..c0963c8ae5 100644 --- a/src/DGtal/arithmetic/ClosedIntegerHalfPlane.ih +++ b/src/DGtal/arithmetic/ClosedIntegerHalfPlane.ih @@ -38,11 +38,6 @@ /////////////////////////////////////////////////////////////////////////////// // ----------------------- Standard services ------------------------------ -//----------------------------------------------------------------------------- -template -inline -DGtal::ClosedIntegerHalfPlane::~ClosedIntegerHalfPlane() -{} //----------------------------------------------------------------------------- template inline diff --git a/src/DGtal/arithmetic/LightSternBrocot.ih b/src/DGtal/arithmetic/LightSternBrocot.ih index 1f31542764..7491ea1261 100644 --- a/src/DGtal/arithmetic/LightSternBrocot.ih +++ b/src/DGtal/arithmetic/LightSternBrocot.ih @@ -89,7 +89,7 @@ Fraction( Integer aP, Integer aQ, Fraction ) while ( aQ != NumberTraits::ZERO ) { ic.getEuclideanDiv( _quot, _rem, aP, aQ ); - v = NumberTraits::castToInt64_t( _quot ); + v = (Quotient)NumberTraits::castToInt64_t( _quot ); if ( f.k() == j ) f = f.next( v ); else diff --git a/src/DGtal/base/LabelledMap.h b/src/DGtal/base/LabelledMap.h index c4b927faa1..55dc010888 100644 --- a/src/DGtal/base/LabelledMap.h +++ b/src/DGtal/base/LabelledMap.h @@ -182,7 +182,7 @@ namespace DGtal { data.nextBlock = 0; } inline - Data & insert( unsigned int idx, unsigned int size, const Data & v ) + Data & insert( size_t idx, size_t size, const Data & v ) { ASSERT( idx <= size ); if ( size < N ) @@ -244,7 +244,7 @@ namespace DGtal } inline - void erase( unsigned int idx, unsigned int size ) + void erase( size_t idx, size_t size ) { // std::cerr << "__FirstBlock::erase(" << idx << ")" // << " this=" << this @@ -303,7 +303,7 @@ namespace DGtal inline __AnyBlock() : next( 0 ) {} inline - Data & insert( unsigned int idx, unsigned int size, const Data & v ) + Data & insert( size_t idx, size_t size, const Data & v ) { ASSERT( idx <= size ); if ( idx >= M ) @@ -354,7 +354,7 @@ namespace DGtal } inline - __AnyBlock* erase( unsigned int idx, unsigned int size ) + __AnyBlock* erase( size_t idx, size_t size ) { // std::cerr << "__AnyBlock::erase(" << idx << "," << size << ")" // << " this=" << this diff --git a/src/DGtal/base/OneItemOutputIterator.h b/src/DGtal/base/OneItemOutputIterator.h index 38d3b6a3c5..84adfefe60 100644 --- a/src/DGtal/base/OneItemOutputIterator.h +++ b/src/DGtal/base/OneItemOutputIterator.h @@ -56,10 +56,17 @@ namespace DGtal * @tparam T at least a default constructible, copy constuctible and assignable type. */ template - class OneItemOutputIterator : - public std::iterator + class OneItemOutputIterator//: public std::iterator { + public: + using iterator_category = std::output_iterator_tag; + using value_type = void; + using difference_type = void; + using pointer = void; + using reference = void; + + BOOST_CONCEPT_ASSERT(( boost::DefaultConstructible )); BOOST_CONCEPT_ASSERT(( boost::CopyConstructible )); BOOST_CONCEPT_ASSERT(( boost::Assignable )); diff --git a/src/DGtal/base/OutputIteratorAdapter.h b/src/DGtal/base/OutputIteratorAdapter.h index 5b06296091..5828fba091 100644 --- a/src/DGtal/base/OutputIteratorAdapter.h +++ b/src/DGtal/base/OutputIteratorAdapter.h @@ -72,13 +72,20 @@ namespace DGtal * */ template - class OutputIteratorAdapter: - public std::iterator + class OutputIteratorAdapter { // ----------------------- Types definitions ------------------------------ public: + using iterator_category = std::output_iterator_tag; + using value_type = void; + using difference_type = void; + using pointer = void; + using reference = void; + + + typedef TIterator Iterator; BOOST_CONCEPT_ASSERT(( boost::ForwardIterator )); BOOST_CONCEPT_ASSERT(( concepts::CUnaryFunctortemplate identity<2, PRIMAL>(); @@ -606,6 +606,8 @@ namespace DGtal double n_oo_max = 1e-4, unsigned int iter_max = 10 ) { + (void)n_oo_max;//paramerter not used + bool ok = true; if ( verbose >= 1 ) { std::ostringstream sstr; @@ -619,7 +621,6 @@ namespace DGtal trace.info() << "---------- Iteration " << i << "/" << iter_max << " ---------------" << std::endl; solveOneAlternateStep( ); - auto norms_v = checkV0(); auto diffs_v = diffV0(); if ( verbose >= 1 ) { trace.info() << "Variation |v^k+1 - v^k|_oo = " << std::get<0>( diffs_v ) diff --git a/src/DGtal/dec/DiscreteExteriorCalculus.ih b/src/DGtal/dec/DiscreteExteriorCalculus.ih index 72a4c8d70e..4d8f392159 100644 --- a/src/DGtal/dec/DiscreteExteriorCalculus.ih +++ b/src/DGtal/dec/DiscreteExteriorCalculus.ih @@ -100,7 +100,7 @@ DGtal::DiscreteExteriorCalculus= 0 && cell_dim <= dimEmbedded, "wrong cell dimension" ); + ASSERT_MSG( cell_dim <= dimEmbedded, "wrong cell dimension" ); ASSERT_MSG( cell_dim != 0 || !property.flipped , "can't insert negative 0-cells" ); ASSERT_MSG( cell_dim != dimAmbient || !property.flipped , "can't insert negative n-cells" ); diff --git a/src/DGtal/dec/DiscreteExteriorCalculusFactory.ih b/src/DGtal/dec/DiscreteExteriorCalculusFactory.ih index e428157ef1..4f7c7ed054 100644 --- a/src/DGtal/dec/DiscreteExteriorCalculusFactory.ih +++ b/src/DGtal/dec/DiscreteExteriorCalculusFactory.ih @@ -253,7 +253,6 @@ DGtal::DiscreteExteriorCalculusFactory::createF Calculus calculus; // compute dimEmbedded-1 cells border std::map cell_to_measure; - double primal_measure_accum = 0., dual_measure_accum = 0.; typedef std::map CellsAccum; CellsAccum border_accum; @@ -267,7 +266,6 @@ DGtal::DiscreteExteriorCalculusFactory::createF const int orth_dir = calculus.myKSpace.sOrthDir( cell_signed ); const double measure = pow(h, dimEmbedded) * fabs( (*measure_it)[orth_dir] ); - primal_measure_accum += measure; ++measure_it; calculus.insertSCell(cell_signed, measure, 1.); @@ -310,7 +308,6 @@ DGtal::DiscreteExteriorCalculusFactory::createF { const double dual_measure = cell_to_measure.find( cell )->second; if(cell_to_measure.find( cell ) == cell_to_measure.end()) trace.warning() << "HOUUU" << std::endl; - dual_measure_accum += dual_measure; calculus.insertSCell(cell_signed, 1, dual_measure); continue; } @@ -326,8 +323,6 @@ DGtal::DiscreteExteriorCalculusFactory::createF calculus.insertSCell(cell_signed, 1, dual_size); } - //ASSERT( primal_measure_accum == dual_measure_accum ); - calculus.updateIndexes(); return calculus; diff --git a/src/DGtal/dec/GeodesicsInHeat.h b/src/DGtal/dec/GeodesicsInHeat.h index 07a4bfcd6e..b554cf39be 100644 --- a/src/DGtal/dec/GeodesicsInHeat.h +++ b/src/DGtal/dec/GeodesicsInHeat.h @@ -220,7 +220,7 @@ namespace DGtal auto surfmesh = myCalculus->getSurfaceMeshPtr(); // Heat, normalization and divergence per face - for(auto f=0; f< myCalculus->nbFaces(); ++f) + for(typename PolygonalCalculus::MySurfaceMesh::Index f=0; f< myCalculus->nbFaces(); ++f) { Vector faceHeat( myCalculus->degree(f)); cpt=0; @@ -236,7 +236,7 @@ namespace DGtal // div DenseMatrix oneForm = myCalculus->flat(f)*grad; - Vector divergenceFace = myCalculus->divergence( f, myLambda ) * oneForm; + Vector divergenceFace = myCalculus->divergence( f ) * oneForm; cpt=0; for(auto v: vertices) { diff --git a/src/DGtal/dec/KForm.ih b/src/DGtal/dec/KForm.ih index 45f3b49b86..9ebd6ab25a 100644 --- a/src/DGtal/dec/KForm.ih +++ b/src/DGtal/dec/KForm.ih @@ -117,7 +117,7 @@ template void DGtal::KForm::clear() { - myContainer.clear(); + myContainer.setZero(); } template diff --git a/src/DGtal/dec/PolygonalCalculus.h b/src/DGtal/dec/PolygonalCalculus.h index ffabd2596e..da8e62c74a 100644 --- a/src/DGtal/dec/PolygonalCalculus.h +++ b/src/DGtal/dec/PolygonalCalculus.h @@ -117,7 +117,7 @@ class PolygonalCalculus bool globalInternalCacheEnabled = false): mySurfaceMesh(&surf), myGlobalCacheEnabled(globalInternalCacheEnabled) { - myEmbedder =[&](Face f,Vertex v){ return mySurfaceMesh->position(v);}; + myEmbedder =[&](Face f,Vertex v){ (void)f; return mySurfaceMesh->position(v);}; myVertexNormalEmbedder = [&](Vertex v){ return toReal3dVector(computeVertexNormal(v));}; init(); }; @@ -149,7 +149,7 @@ class PolygonalCalculus mySurfaceMesh(&surf), myVertexNormalEmbedder(embedder), myGlobalCacheEnabled(globalInternalCacheEnabled) { - myEmbedder = [&](Face f,Vertex v){ return mySurfaceMesh->position(v); }; + myEmbedder = [&](Face f,Vertex v){(void)f; return mySurfaceMesh->position(v); }; init(); }; @@ -265,7 +265,7 @@ class PolygonalCalculus const auto nf = myFaceDegree[f]; DenseMatrix d = DenseMatrix::Zero(nf ,nf); - for(auto i=0; i < nf; ++i) + for(auto i=0u; i < nf; ++i) { d(i,i) = -1.; d(i, (i+1)%nf) = 1.; @@ -299,7 +299,7 @@ class PolygonalCalculus const auto nf = myFaceDegree[f]; DenseMatrix a = DenseMatrix::Zero(nf ,nf); - for(auto i=0; i < nf; ++i) + for(auto i=0u; i < nf; ++i) { a(i, (i+1)%nf) = 0.5; a(i,i) = 0.5; @@ -489,7 +489,6 @@ class PolygonalCalculus /// Divergence operator of a one-form. /// @param f the face - /// @param lambda the regularization parameter /// @return a degree x degree matrix /// /// @note The sign convention for the divergence and the Laplacian @@ -502,7 +501,7 @@ class PolygonalCalculus /// \langle \mathrm{d} u, v \rangle = - \langle u, \mathrm{div} v /// \rangle \f$. See also /// https://en.wikipedia.org/wiki/Laplace–Beltrami_operator - DenseMatrix divergence(const Face f, const double lambda=1.0) const + DenseMatrix divergence(const Face f) const { if (checkCache(DIVERGENCE_,f)) return myGlobalCache[DIVERGENCE_][f]; @@ -799,13 +798,13 @@ class PolygonalCalculus { SparseMatrix lapGlobal(mySurfaceMesh->nbVertices(), mySurfaceMesh->nbVertices()); std::vector triplets; - for( auto f = 0; f < mySurfaceMesh->nbFaces(); ++f ) + for( typename MySurfaceMesh::Index f = 0; f < mySurfaceMesh->nbFaces(); ++f ) { auto nf = myFaceDegree[f]; DenseMatrix Lap = this->laplaceBeltrami(f,lambda); const auto vertices = mySurfaceMesh->incidentVertices(f); - for(auto i=0; i < nf; ++i) - for(auto j=0; j < nf; ++j) + for(auto i=0u; i < nf; ++i) + for(auto j=0u; j < nf; ++j) { auto v = Lap(i,j); if (v!= 0.0) @@ -826,7 +825,7 @@ class PolygonalCalculus { SparseMatrix M(mySurfaceMesh->nbVertices(), mySurfaceMesh->nbVertices()); std::vector triplets; - for ( auto v = 0; v < mySurfaceMesh->nbVertices(); ++v ) + for ( typename MySurfaceMesh::Index v = 0; v < mySurfaceMesh->nbVertices(); ++v ) { auto faces = mySurfaceMesh->incidentFaces(v); auto varea = 0.0; @@ -874,7 +873,7 @@ class PolygonalCalculus SparseMatrix lapGlobal(2 * nv, 2 * nv); SparseMatrix local(2 * nv, 2 * nv); std::vector triplets; - for (auto f = 0; f < mySurfaceMesh->nbFaces(); f++) + for (typename MySurfaceMesh::Index f = 0; f < mySurfaceMesh->nbFaces(); f++) { auto nf = degree(f); DenseMatrix Lap = connectionLaplacian(f,lambda); @@ -905,7 +904,7 @@ class PolygonalCalculus auto nv = mySurfaceMesh->nbVertices(); SparseMatrix M(2 * nv, 2 * nv); std::vector triplets; - for (auto v = 0; v < mySurfaceMesh->nbVertices(); ++v) + for (typename MySurfaceMesh::Index v = 0; v < mySurfaceMesh->nbVertices(); ++v) { auto faces = mySurfaceMesh->incidentFaces(v); auto varea = 0.0; @@ -942,7 +941,7 @@ class PolygonalCalculus std::vector getOperatorCacheMatrix(const std::function &perFaceOperator) const { std::vector cache; - for(auto f=0; f < mySurfaceMesh->nbFaces(); ++f) + for( typename MySurfaceMesh::Index f=0; f < mySurfaceMesh->nbFaces(); ++f) cache.push_back(perFaceOperator(f)); return cache; } @@ -966,7 +965,7 @@ class PolygonalCalculus std::vector getOperatorCacheVector(const std::function &perFaceVectorOperator) const { std::vector cache; - for(auto f=0; f < mySurfaceMesh->nbFaces(); ++f) + for( typename MySurfaceMesh::Index f=0; f < mySurfaceMesh->nbFaces(); ++f) cache.push_back(perFaceVectorOperator(f)); return cache; } @@ -1072,7 +1071,7 @@ class PolygonalCalculus void updateFaceDegree() { myFaceDegree.resize(mySurfaceMesh->nbFaces()); - for(auto f = 0; f < mySurfaceMesh->nbFaces(); ++f) + for(typename MySurfaceMesh::Index f = 0; f < mySurfaceMesh->nbFaces(); ++f) { auto vertices = mySurfaceMesh->incidentVertices(f); auto nf = vertices.size(); diff --git a/src/DGtal/dec/VectorsInHeat.h b/src/DGtal/dec/VectorsInHeat.h index f0565635d7..8158a295d9 100644 --- a/src/DGtal/dec/VectorsInHeat.h +++ b/src/DGtal/dec/VectorsInHeat.h @@ -194,9 +194,9 @@ class VectorsInHeat **/ void clearSource() { - myVectorSource.clear(); - myScalarSource.clear(); - myDiracSource.clear(); + myVectorSource = Vector::Zero(2*myCalculus->nbVertices()); + myScalarSource = Vector::Zero(myCalculus->nbVertices()); + myDiracSource = Vector::Zero(myCalculus->nbVertices()); } /** @@ -258,7 +258,7 @@ class VectorsInHeat std::vector result(surfmesh->nbVertices()); - for (auto v = 0;vnbVertices();v++){ + for (typename PolygonalCalculus::MySurfaceMesh::Index v = 0;vnbVertices();v++){ Vector Y(2); Y(0) = vectorHeatDiffusion(2*v); Y(1) = vectorHeatDiffusion(2*v+1); diff --git a/src/DGtal/doc/moduleBuildDGtal.dox b/src/DGtal/doc/moduleBuildDGtal.dox index 325d947c3c..15ea99ef2b 100644 --- a/src/DGtal/doc/moduleBuildDGtal.dox +++ b/src/DGtal/doc/moduleBuildDGtal.dox @@ -46,7 +46,6 @@ To build DGtal in is full configuration, you may need these dependencies too: - \e insighttoolkit (ITK), - \e [HDF5](http://www.hdfgroup.org/HDF5/) - \e [CGAL](http://cgal.org) (build with Eigen enabled) -- \e [Eigen] (http://eigen.tuxfamily.org/index.php?title=Main_Page) If you want to generate the documentation, you would need: @@ -54,6 +53,10 @@ If you want to generate the documentation, you would need: - \e graphviz. +@note Since 1.4, some dependencies could be installed using +[conan.io](https://conan.io). Just install the conan binary (1.57) and +cmake will install all libraries (which may take some time for the first build). + \subsection linux Build on Linux-based distributions To build DGtal from the source archive, we use the CMake tool to @@ -150,13 +153,13 @@ tools with recent Visual Studio target. During the project generation, you would have to specify the path to @e boost headers (or paths needed for any optional dependency such as GMP, CGAL, Cairo...). -@note Do not forget to set @e BUILD_SHARED_LIBS cmake to false (static DGtal lib target). + +@note Do not forget to set @e BUILD_SHARED_LIBS cmake to false (static +DGtal lib target, default). -@advanced When working on DGtal within github, we have set up a Windows -container (using [appeveyor](http://www.appeveyor.com)) for continuous -integration. In the "appeveyor.yml" script, you would find information about -how we compile the DGtal library on this windows environnement. +@advanced When working on DGtal within github, we have set up a +Windows container for continuous integration. */ diff --git a/src/DGtal/geometry/curves/FreemanChain.h b/src/DGtal/geometry/curves/FreemanChain.h index 0edefe70e2..c6253232f0 100644 --- a/src/DGtal/geometry/curves/FreemanChain.h +++ b/src/DGtal/geometry/curves/FreemanChain.h @@ -138,10 +138,16 @@ namespace DGtal * storing the current coordinate. */ - class ConstIterator : public - std::iterator + class ConstIterator { - + public: + + using iterator_category = std::bidirectional_iterator_tag; + using value_type = Point; + using difference_type = int; + using pointer = Point*; + using reference = Point; + // ------------------------- Private data ----------------------- private: diff --git a/src/DGtal/geometry/curves/estimation/LambdaMST2D.ih b/src/DGtal/geometry/curves/estimation/LambdaMST2D.ih index 37af2b80ad..f691ca81fc 100644 --- a/src/DGtal/geometry/curves/estimation/LambdaMST2D.ih +++ b/src/DGtal/geometry/curves/estimation/LambdaMST2D.ih @@ -69,8 +69,8 @@ namespace DGtal { if ( DSS->isInDSS ( p ) ) { - unsigned int pos = std::distance ( DSS.begin(), std::find ( DSS.begin(), DSS.end(), p ) ) + 1; - unsigned int dssLen = std::distance ( DSS.begin(), DSS.end() ) + 1; + size_t pos = std::distance ( DSS.begin(), std::find ( DSS.begin(), DSS.end(), p ) ) + 1; + size_t dssLen = std::distance ( DSS.begin(), DSS.end() ) + 1; SegmentComputer comp ( *DSS ); partial = myFunctor ( comp, pos, dssLen ); tangent += partial; @@ -96,7 +96,7 @@ namespace DGtal typename TSegmentation::SegmentComputerIterator lastDSS = dssSegments->end(); for ( ; DSS != lastDSS; ++DSS ) { - unsigned int dssLen = std::distance ( DSS.begin(), DSS.end() ); + size_t dssLen = std::distance ( DSS.begin(), DSS.end() ); SegmentComputer comp ( *DSS ); for ( unsigned int i = 0; i < dssLen; i++ ) outValues[ std::distance ( itb, DSS.begin() ) + i ] += myFunctor ( comp, i + 1, dssLen + 1 ); diff --git a/src/DGtal/geometry/curves/estimation/LambdaMST3D.ih b/src/DGtal/geometry/curves/estimation/LambdaMST3D.ih index 8a2526c34b..0f58b373d8 100644 --- a/src/DGtal/geometry/curves/estimation/LambdaMST3D.ih +++ b/src/DGtal/geometry/curves/estimation/LambdaMST3D.ih @@ -76,9 +76,9 @@ namespace DGtal for ( auto it = begin ; it != end; ++it ) { // the returned type is signed but dssLen should never be negative - unsigned int dssLen = std::distance ( it->begin(), it->end() ) + 1; + const auto dssLen = std::distance ( it->begin(), it->end() ) + 1; prev = partial; - int pos = myDSSFilter. position ( *it, p ); + const auto pos = myDSSFilter. position ( *it, p ); partial = myFunctor ( *it, pos, dssLen ); if ( prev.first.cosineSimilarity ( partial.first ) > M_PI_2 ) partial.first = -partial.first; @@ -105,8 +105,8 @@ namespace DGtal if ( ! DSS->isInDSS ( *orphan ) && myDSSFilter.admissibility ( *DSS, *orphan ) ) { // the returned type is signed but dssLen should never be negative - unsigned int dssLen = std::distance ( DSS->begin ( ), DSS->end ( ) ) + 1; - int pos = myDSSFilter. position ( *DSS, *orphan ); + const auto dssLen = std::distance ( DSS->begin ( ), DSS->end ( ) ) + 1; + const auto pos = myDSSFilter. position ( *DSS, *orphan ); outValues.insert ( std::make_pair ( *orphan, myFunctor ( *DSS, pos, dssLen ) ) ); } } @@ -138,10 +138,10 @@ namespace DGtal if ( DSS->isInDSS ( p ) ) { // the returned type is signed but dssLen should never be negative - unsigned int dssLen = std::distance ( DSS.begin(), DSS.end() ) + 1; + const auto dssLen = std::distance ( DSS.begin(), DSS.end() ) + 1; prev = partial; // the returned type is signed but pos should never be negative - unsigned int pos = std::distance ( DSS.begin(), std::find ( DSS.begin ( ), DSS.end ( ), p ) ) + 1; + const auto pos = std::distance ( DSS.begin(), std::find ( DSS.begin ( ), DSS.end ( ), p ) ) + 1; partial = myFunctor ( *DSS, pos, dssLen ); if ( partial.first.norm() > 0. && prev.first.norm() > 0. && prev.first.cosineSimilarity ( partial.first ) > M_PI_2 ) partial.first = -partial.first; @@ -237,4 +237,4 @@ namespace DGtal *result++ = tangent.first; } } -} \ No newline at end of file +} diff --git a/src/DGtal/geometry/curves/parametric/EllipticHelix.h b/src/DGtal/geometry/curves/parametric/EllipticHelix.h index 0ceb68de92..49cb431a67 100755 --- a/src/DGtal/geometry/curves/parametric/EllipticHelix.h +++ b/src/DGtal/geometry/curves/parametric/EllipticHelix.h @@ -67,7 +67,7 @@ class EllipticHelix /** * Destructor. */ - ~EllipticHelix() {} + ~EllipticHelix() {}; /** * Constructor. * @param rr small radius of the helix diff --git a/src/DGtal/geometry/meshes/CorrectedNormalCurrentFormula.h b/src/DGtal/geometry/meshes/CorrectedNormalCurrentFormula.h index c31827d556..0c819c7a0f 100644 --- a/src/DGtal/geometry/meshes/CorrectedNormalCurrentFormula.h +++ b/src/DGtal/geometry/meshes/CorrectedNormalCurrentFormula.h @@ -290,6 +290,8 @@ namespace DGtal static Scalar mu1ConstantU( const RealPoints& pts, const RealVector& u ) { + (void)pts; //not used parameter + (void)u; return 0.0; } @@ -375,7 +377,7 @@ namespace DGtal avg_u /= l; Scalar mu2 = 0.0; const auto n = vu.size(); - for ( auto i = 0; i < n; ++i ) + for ( size_t i = 0; i < n; ++i ) { ST st( avg_u, vu[ i ], vu[ (i+1) % n ] ); mu2 += st.algebraicArea(); @@ -403,6 +405,10 @@ namespace DGtal const RealVector& ua, const RealVector& ub, const RealVector& uc, bool unit_u = false ) { + (void)a; //not used + (void)b; + (void)c; + // Using non unitary interpolated normals give // MU2=1/2*det( uA, uB, uC ) // When normals are unitary, it is the area of a spherical triangle. diff --git a/src/DGtal/geometry/surfaces/DigitalSurfaceConvolver.ih b/src/DGtal/geometry/surfaces/DigitalSurfaceConvolver.ih index 2e88c9a172..40181be6aa 100644 --- a/src/DGtal/geometry/surfaces/DigitalSurfaceConvolver.ih +++ b/src/DGtal/geometry/surfaces/DigitalSurfaceConvolver.ih @@ -318,8 +318,8 @@ DGtal::DigitalSurfaceConvolver< Functor, KernelFunctor, KSpace, DigitalKernel, d Dimension recount = 0; #endif - Quantity lastInnerMoments[ nbMoments ]; - Quantity lastOuterMoments[ nbMoments ]; + std::vector lastInnerMoments(nbMoments ); + std::vector lastOuterMoments(nbMoments ); CovarianceMatrix innerCovarianceMatrix, outerCovarianceMatrix; @@ -371,8 +371,8 @@ DGtal::DigitalSurfaceConvolver< Functor, KernelFunctor, KSpace, DigitalKernel, d Dimension recount = 0; #endif - Quantity lastInnerMoments[ nbMoments ]; - Quantity lastOuterMoments[ nbMoments ]; + std::vector lastInnerMoments( nbMoments ); + std::vector lastOuterMoments( nbMoments ); CovarianceMatrix innerCovarianceMatrix, outerCovarianceMatrix; CovarianceMatrix resultCovarianceMatrix; @@ -823,8 +823,8 @@ DGtal::DigitalSurfaceConvolver< Functor, KernelFunctor, KSpace, DigitalKernel, 2 Dimension recount = 0; #endif - Quantity lastInnerMoments[ nbMoments ]; - Quantity lastOuterMoments[ nbMoments ]; + std::vector lastInnerMoments( nbMoments ); + std::vector lastOuterMoments( nbMoments ); CovarianceMatrix innerCovarianceMatrix, outerCovarianceMatrix; @@ -876,8 +876,8 @@ DGtal::DigitalSurfaceConvolver< Functor, KernelFunctor, KSpace, DigitalKernel, 2 Dimension recount = 0; #endif - Quantity lastInnerMoments[ nbMoments ]; - Quantity lastOuterMoments[ nbMoments ]; + std::vector lastInnerMoments( nbMoments ); + std::vector lastOuterMoments( nbMoments ); CovarianceMatrix innerCovarianceMatrix, outerCovarianceMatrix; CovarianceMatrix resultCovarianceMatrix; @@ -1855,8 +1855,8 @@ DGtal::DigitalSurfaceConvolver< Functor, KernelFunctor, KSpace, DigitalKernel, 3 Dimension recount = 0; #endif - Quantity lastInnerMoments[ nbMoments ]; - Quantity lastOuterMoments[ nbMoments ]; + std::vector lastInnerMoments( nbMoments ); + std::vector lastOuterMoments( nbMoments ); CovarianceMatrix innerCovarianceMatrix, outerCovarianceMatrix; diff --git a/src/DGtal/geometry/surfaces/DigitalSurfaceRegularization.h b/src/DGtal/geometry/surfaces/DigitalSurfaceRegularization.h index a1d8adceed..635cb170d1 100644 --- a/src/DGtal/geometry/surfaces/DigitalSurfaceRegularization.h +++ b/src/DGtal/geometry/surfaces/DigitalSurfaceRegularization.h @@ -275,7 +275,7 @@ namespace DGtal const double epsilon = 0.0001) { return regularize(nbIters,dt,epsilon, - [](SHG3::RealPoint& p,SHG3::RealPoint& o,SHG3::RealVector& v){ p += v; }); + [](SHG3::RealPoint& p,SHG3::RealPoint& o,SHG3::RealVector& v){ (void)o; p += v; }); } diff --git a/src/DGtal/geometry/surfaces/DigitalSurfaceRegularization.ih b/src/DGtal/geometry/surfaces/DigitalSurfaceRegularization.ih index 6122228e87..735775cbdc 100644 --- a/src/DGtal/geometry/surfaces/DigitalSurfaceRegularization.ih +++ b/src/DGtal/geometry/surfaces/DigitalSurfaceRegularization.ih @@ -80,7 +80,7 @@ DGtal::DigitalSurfaceRegularization::attachNormalVectors(const std::function< { ASSERT_MSG(myInit, "The init() method must be called before setting the normals"); myNormals.resize( mySurfels.size()); - for(auto i=0; i< mySurfels.size();++i) + for(auto i=0u; i< mySurfels.size();++i) myNormals[i] = normalFunc( mySurfels[i] ); } /////////////////////////////////////////////////////////////////////////////// @@ -130,7 +130,7 @@ void DGtal::DigitalSurfaceRegularization::cacheInit() myAlignPointelsIdx.resize( mySurfels.size() * 4 ); myAlignPointels.resize( mySurfels.size() * 4 ); - for(int i = 0; i < mySurfels.size(); ++i) + for(size_t i = 0; i < mySurfels.size(); ++i) { auto pointelsAround = myDigitalSurface->facesAroundVertex(mySurfels[i],true); ASSERT(pointelsAround.size() == 4); @@ -146,7 +146,7 @@ void DGtal::DigitalSurfaceRegularization::cacheInit() // Precompute all relations for fairness energy myNbAdjacent.resize( myFaces.size() ); - for(auto faceId=0 ; faceId < myFaces.size(); ++faceId) + for(size_t faceId=0 ; faceId < myFaces.size(); ++faceId) { auto idx = myPointelIndex[ dsurf_pointels[ faceId ] ]; myFairnessPointelsIdx.push_back( idx ); @@ -217,7 +217,7 @@ DGtal::DigitalSurfaceRegularization::computeGradient() ASSERT_MSG(myNormals.size() != 0, "Some normal vectors must be attached to the digital surface before computing the gradient"); //data attachment term - for(int i = 0; i < myOriginalPositions.size(); ++i) + for(size_t i = 0; i < myOriginalPositions.size(); ++i) { const auto delta_d = myOriginalPositions[i] - myRegularizedPositions[i]; energy += myAlpha * delta_d.squaredNorm() ; @@ -228,7 +228,7 @@ DGtal::DigitalSurfaceRegularization::computeGradient() //align auto it = myAlignPointelsIdx.cbegin(); - for(int i = 0; i < mySurfels.size(); ++i) + for(size_t i = 0; i < mySurfels.size(); ++i) { const auto cell_p0 = *it++; const auto cell_p1 = *it++; @@ -249,7 +249,7 @@ DGtal::DigitalSurfaceRegularization::computeGradient() myGradientAlign[ cell_p2 ] += cos_a2 * myNormals[i]; myGradientAlign[ cell_p3 ] += cos_a3 * myNormals[i]; } - for(auto i=0; i < myOriginalPositions.size(); ++i) + for(auto i=0u; i < myOriginalPositions.size(); ++i) { ASSERT(myNumberAdjEdgesToPointel[i] >0); myGradient[i] += 2.0*myBeta * myGradientAlign[i] / (double)myNumberAdjEdgesToPointel[i]; @@ -259,7 +259,7 @@ DGtal::DigitalSurfaceRegularization::computeGradient() auto itP = myFairnessPointelsIdx.cbegin(); auto itNb = myNbAdjacent.cbegin(); SH3::RealPoint barycenter, phat ; - for(int faceId=0 ; faceId < myFaces.size(); ++faceId) + for(size_t faceId=0 ; faceId < myFaces.size(); ++faceId) { auto idx = *itP++; unsigned int nbAdj = *itNb++; @@ -289,7 +289,7 @@ DGtal::DigitalSurfaceRegularization::computeGradientLocalWeights() ASSERT_MSG(myNormals.size() != 0, "Some normal vectors must be attached to the digital surface before computing the gradient"); //data attachment term - for(int i = 0; i < myOriginalPositions.size(); ++i) + for(size_t i = 0; i < myOriginalPositions.size(); ++i) { const auto delta_d = myOriginalPositions[i] - myRegularizedPositions[i]; energy += (*myAlphas)[i] * delta_d.squaredNorm() ; @@ -300,7 +300,7 @@ DGtal::DigitalSurfaceRegularization::computeGradientLocalWeights() //align auto it = myAlignPointelsIdx.cbegin(); - for(int i = 0; i < mySurfels.size(); ++i) + for(size_t i = 0; i < mySurfels.size(); ++i) { const auto cell_p0 = *it++; const auto cell_p1 = *it++; @@ -323,7 +323,7 @@ DGtal::DigitalSurfaceRegularization::computeGradientLocalWeights() myGradientAlign[ cell_p2 ] += cos_a2 * myNormals[i]; myGradientAlign[ cell_p3 ] += cos_a3 * myNormals[i]; } - for(auto i=0; i < myOriginalPositions.size(); ++i) + for(size_t i=0; i < myOriginalPositions.size(); ++i) { ASSERT(myNumberAdjEdgesToPointel[i] >0); myGradient[i] += 2.0*(*myBetas)[i] * myGradientAlign[i] / (double)myNumberAdjEdgesToPointel[i]; @@ -333,7 +333,7 @@ DGtal::DigitalSurfaceRegularization::computeGradientLocalWeights() auto itP = myFairnessPointelsIdx.cbegin(); auto itNb = myNbAdjacent.cbegin(); SH3::RealPoint barycenter, phat ; - for(int faceId=0 ; faceId < myFaces.size(); ++faceId) + for(auto faceId=0u; faceId < myFaces.size(); ++faceId) { const auto idx = *itP++; const unsigned int nbAdj = *itNb++; @@ -365,7 +365,7 @@ DGtal::DigitalSurfaceRegularization::regularize(const unsigned int nbIters, double last_energy = 0.0; double mydt=dt; bool first_iter = true; - for(auto i = 0; i < nbIters; ++i) + for(unsigned int i = 0; i < nbIters; ++i) { if (myConstantCoeffs) energy = computeGradient(); @@ -395,10 +395,10 @@ DGtal::DigitalSurfaceRegularization::regularize(const unsigned int nbIters, //One step advection SHG3::RealVector v; - for(int i=0; i < myRegularizedPositions.size(); ++i) + for(size_t ii=0; ii < myRegularizedPositions.size(); ++ii) { - v = - mydt * myGradient[i] ; - advectionFunc( myRegularizedPositions[i], myOriginalPositions[i], v ); + v = - mydt * myGradient[ii] ; + advectionFunc( myRegularizedPositions[ii], myOriginalPositions[ii], v ); } } return energy; diff --git a/src/DGtal/geometry/surfaces/ShroudsRegularization.h b/src/DGtal/geometry/surfaces/ShroudsRegularization.h index f2b59eedcb..5baa9f7a34 100644 --- a/src/DGtal/geometry/surfaces/ShroudsRegularization.h +++ b/src/DGtal/geometry/surfaces/ShroudsRegularization.h @@ -310,6 +310,7 @@ namespace DGtal { double l2 = 0.0; int nb = 0; double r = 0.5; + (void)randomization; //parameter not used, avoiding warning do { std::tie( loo, l2 ) = reg == Regularization::SQUARED_CURVATURE diff --git a/src/DGtal/geometry/surfaces/ShroudsRegularization.ih b/src/DGtal/geometry/surfaces/ShroudsRegularization.ih index 782a8105d5..930a0898cd 100644 --- a/src/DGtal/geometry/surfaces/ShroudsRegularization.ih +++ b/src/DGtal/geometry/surfaces/ShroudsRegularization.ih @@ -99,7 +99,6 @@ energySquaredCurvature() double E = 0.0; for ( Vertex v = 0; v < myT.size(); ++v ) { - double area = 1.0; const auto s = myPtrIdxSurface->surfel( v ); const auto k = myPtrK->sOrthDir( s ); for ( Dimension i = 0; i < 3; ++i ) @@ -290,7 +289,9 @@ oneStepSquaredCurvatureMinimization const Scalar y_3 = c_1 * ( yn_2 - yp_2 ); const Scalar y_4 = get<0>( c ) * yn_2 - get<1>( c ) * y_2 + get<2>( c ) * yp_2; - + + (void)y_4; //not used FIXME: JOL + // We linearize Euler-Lagrange // EL = 24*x'^3*x''^3*y' // + x'''*( - 13*x'^4*x''*y' - 14*x'^2*x''*y'^3 - x''*y'^5 ) diff --git a/src/DGtal/geometry/surfaces/estimation/PlaneProbingNeighborhood.ih b/src/DGtal/geometry/surfaces/estimation/PlaneProbingNeighborhood.ih index b961ea035e..aae16af8ee 100644 --- a/src/DGtal/geometry/surfaces/estimation/PlaneProbingNeighborhood.ih +++ b/src/DGtal/geometry/surfaces/estimation/PlaneProbingNeighborhood.ih @@ -74,13 +74,13 @@ inline typename DGtal::PlaneProbingNeighborhood::PointOnProbingRay DGtal::PlaneProbingNeighborhood::closestPointInList (std::vector const& aPoints) const { - int N = aPoints.size(); + const auto N = aPoints.size(); if (N == 1) { return aPoints[0]; } PointOnProbingRay minPoint = aPoints[N-1]; - for (int k = 0; k < N-1; ++k) { + for (Dimension k = 0; k < (Dimension)((int)N-1); ++k) { if (isSmallest(relativePoint(minPoint), relativePoint(aPoints[k]))) { minPoint = aPoints[k]; } diff --git a/src/DGtal/geometry/tools/Hull2DHelpers.ih b/src/DGtal/geometry/tools/Hull2DHelpers.ih index 0618db0194..02d0402552 100644 --- a/src/DGtal/geometry/tools/Hull2DHelpers.ih +++ b/src/DGtal/geometry/tools/Hull2DHelpers.ih @@ -345,13 +345,13 @@ namespace DGtal } ForwardIterator myB; ForwardIterator myE; - unsigned int mySize; + size_t mySize; }; WrapIt aConvexHull(itb, ite); double resThickness = std::numeric_limits::max(); unsigned int i = 0; unsigned int j = 1; - unsigned int size = aConvexHull.mySize; + const auto size = aConvexHull.mySize; if(size<3) { if(size>0) diff --git a/src/DGtal/geometry/tools/MelkmanConvexHull.h b/src/DGtal/geometry/tools/MelkmanConvexHull.h index b95d63b804..8261994a96 100644 --- a/src/DGtal/geometry/tools/MelkmanConvexHull.h +++ b/src/DGtal/geometry/tools/MelkmanConvexHull.h @@ -191,7 +191,7 @@ namespace DGtal /** * @return the nomber of points constituing the convex hull. **/ - unsigned int size() const; + size_t size() const; /** * clear the current content of the convex hull. diff --git a/src/DGtal/geometry/tools/MelkmanConvexHull.ih b/src/DGtal/geometry/tools/MelkmanConvexHull.ih index 0ae7a3f6dc..2b35334231 100644 --- a/src/DGtal/geometry/tools/MelkmanConvexHull.ih +++ b/src/DGtal/geometry/tools/MelkmanConvexHull.ih @@ -176,7 +176,7 @@ DGtal::MelkmanConvexHull::operator[](unsigned int i // ---------------------------------------------------------------------------- template inline -unsigned int +size_t DGtal::MelkmanConvexHull::size() const { // by definition the first and last points of the deque are the same. diff --git a/src/DGtal/geometry/tools/QuickHullKernels.h b/src/DGtal/geometry/tools/QuickHullKernels.h index edbf328b0a..5abc586fdb 100644 --- a/src/DGtal/geometry/tools/QuickHullKernels.h +++ b/src/DGtal/geometry/tools/QuickHullKernels.h @@ -201,7 +201,7 @@ namespace DGtal typedef IntegerConverter< dim, InternalInteger > Inner; class HalfSpace { - friend class ConvexHullCommonKernel< dim, CoordinateInteger, InternalInteger >; + friend struct ConvexHullCommonKernel< dim, CoordinateInteger, InternalInteger >; InternalVector N; ///< the normal vector InternalScalar c; ///< the intercept HalfSpace( const InternalVector& aN, const InternalScalar aC ) @@ -260,7 +260,6 @@ namespace DGtal typedef DGtal::SimpleMatrix< InternalScalar, dimension, dimension > Matrix; Matrix A; InternalVector N; - InternalScalar c; for ( Dimension i = 1; i < dimension; i++ ) for ( Dimension j = 0; j < dimension; j++ ) A.setComponent( i-1, j, @@ -474,7 +473,7 @@ namespace DGtal void convertPointTo( const CoordinatePoint& p, OutputPoint& out_p ) const { for ( Dimension k = 0; k < dimension; k++ ) - out_p[ k ] = p[ k ]; + out_p[ k ] = static_cast(p[ k ]); } }; // template < Dimension dim > struct ConvexHullIntegralKernel { diff --git a/src/DGtal/geometry/volumes/BoundedLatticePolytope.ih b/src/DGtal/geometry/volumes/BoundedLatticePolytope.ih index 517e256443..1787964fc3 100644 --- a/src/DGtal/geometry/volumes/BoundedLatticePolytope.ih +++ b/src/DGtal/geometry/volumes/BoundedLatticePolytope.ih @@ -372,7 +372,7 @@ cut( const Vector& a, Integer b, bool large, bool valid_edge_constraint ) B.push_back( b ); I.push_back( large ); myValidEdgeConstraints = myValidEdgeConstraints && valid_edge_constraint; // a cut might invalidate an edge constraint - return A.size() - 1; + return (unsigned int)(A.size() - 1); } else { @@ -380,7 +380,7 @@ cut( const Vector& a, Integer b, bool large, bool valid_edge_constraint ) B[ k ] = std::min( B[ k ], b ); I[ k ] = large; myValidEdgeConstraints = myValidEdgeConstraints && valid_edge_constraint; // a cut might invalidate an edge constraint - return k; + return (unsigned int)k; } } //----------------------------------------------------------------------------- @@ -624,8 +624,8 @@ countWithin( Point lo, Point hi ) const Domain localD( lo, hi ); for ( auto&& p : localD ) { - auto I = C.intersectionIntervalAlongAxis( p, b ); - nb += I.second - I.first; + auto II = C.intersectionIntervalAlongAxis( p, b ); + nb += II.second - II.first; } return nb; } @@ -644,8 +644,8 @@ countUpTo( Integer max) const Domain localD( lo, hi ); for ( auto&& p : localD ) { - auto I = C.intersectionIntervalAlongAxis( p, a ); - nb += I.second - I.first; + auto II = C.intersectionIntervalAlongAxis( p, a ); + nb += II.second - II.first; if ( nb >= max ) return max; } return nb; @@ -676,10 +676,10 @@ getKPoints( std::vector& pts, const Point& alpha_shift ) const Domain localD( lo, hi ); for ( auto&& p : localD ) { - auto I = C.intersectionIntervalAlongAxis( p, a ); + auto II = C.intersectionIntervalAlongAxis( p, a ); Point q( 2*p - alpha_shift ); - q[ a ] = 2*I.first - alpha_shift[ a ]; - for ( Integer x = I.first; x < I.second; x++ ) + q[ a ] = 2*II.first - alpha_shift[ a ]; + for ( Integer x = II.first; x < II.second; x++ ) { pts.push_back( q ); q[ a ] += 2; @@ -713,10 +713,10 @@ insertKPoints( PointSet& pts_set, const Point& alpha_shift ) const Domain localD( lo, hi ); for ( auto&& p : localD ) { - auto I = C.intersectionIntervalAlongAxis( p, a ); + auto II = C.intersectionIntervalAlongAxis( p, a ); Point q( 2*p - alpha_shift ); - q[ a ] = 2*I.first - alpha_shift[ a ]; - for ( Integer x = I.first; x < I.second; x++ ) + q[ a ] = 2*II.first - alpha_shift[ a ]; + for ( Integer x = II.first; x < II.second; x++ ) { pts_set.insert( q ); q[ a ] += 2; @@ -750,9 +750,9 @@ getBoundaryPoints( std::vector& pts ) const Domain localD( lo, hi ); for ( auto&& p : localD ) { - auto I = C .interiorIntersectionIntervalAlongAxis( p, a ); + auto II = C .interiorIntersectionIntervalAlongAxis( p, a ); auto clI = clC.intersectionIntervalAlongAxis( p, a ); - auto nbI = I.second - I.first; + auto nbI = II.second - II.first; auto nbclI = clI.second - clI.first; if ( nbI == nbclI ) continue; if ( nbI > nbclI ) @@ -769,14 +769,14 @@ getBoundaryPoints( std::vector& pts ) const } else { - if ( clI.first < I.first ) + if ( clI.first < II.first ) { q[ a ] = clI.first; pts.push_back( q ); } - if ( clI.second > I.second ) + if ( clI.second > II.second ) { - q[ a ] = I.second; + q[ a ] = II.second; pts.push_back( q ); } } @@ -897,7 +897,7 @@ template unsigned int DGtal::BoundedLatticePolytope::nbHalfSpaces() const { - return A.size(); + return static_cast(A.size()); } //----------------------------------------------------------------------------- diff --git a/src/DGtal/geometry/volumes/BoundedLatticePolytopeCounter.ih b/src/DGtal/geometry/volumes/BoundedLatticePolytopeCounter.ih index ce53533f3a..c1ea23fd89 100644 --- a/src/DGtal/geometry/volumes/BoundedLatticePolytopeCounter.ih +++ b/src/DGtal/geometry/volumes/BoundedLatticePolytopeCounter.ih @@ -214,7 +214,6 @@ getPointsAlongAxis( PointRange& pts, Dimension a ) const Point hi = myUpper; hi[ a ] = lo[ a ]; Domain D( lo, hi ); - Integer nb = 0; for ( auto&& p : D ) { auto I = intersectionIntervalAlongAxis( p, a ); @@ -238,7 +237,7 @@ getInteriorPointsAlongAxis( PointRange& pts, Dimension a ) const Point hi = myUpper; hi[ a ] = lo[ a ]; Domain D( lo, hi ); - Integer nb = 0; + //Integer nb = 0; not used for ( auto&& p : D ) { auto I = interiorIntersectionIntervalAlongAxis( p, a ); @@ -317,13 +316,13 @@ getLatticeCells( Dimension a ) const auto s = std::min( I.second, J.second ); if ( f <= s ) { - Point q = p; q[ k ] += 1; - q_computed.push_back( q ); + Point qq = p; qq[ k ] += 1; + q_computed.push_back( qq ); I_computed.push_back( Interval( f, s ) ); } } // Add new columns to map Point -> column - for ( auto i = 0; i < q_computed.size(); ++i ) + for ( typename Point::Index i = 0; i < q_computed.size(); ++i ) { L[ q_computed[ i ] ] = I_computed[ i ]; } diff --git a/src/DGtal/geometry/volumes/BoundedRationalPolytope.ih b/src/DGtal/geometry/volumes/BoundedRationalPolytope.ih index 88ce33992b..225273d643 100644 --- a/src/DGtal/geometry/volumes/BoundedRationalPolytope.ih +++ b/src/DGtal/geometry/volumes/BoundedRationalPolytope.ih @@ -424,7 +424,7 @@ cut( const Vector& a, Integer b, bool large, bool valid_edge_constraint ) B.push_back( b ); I.push_back( large ); myValidEdgeConstraints = myValidEdgeConstraints && valid_edge_constraint; // a cut might invalidate an edge constraint - return A.size() - 1; + return static_cast(A.size() - 1); } else { @@ -432,7 +432,7 @@ cut( const Vector& a, Integer b, bool large, bool valid_edge_constraint ) B[ k ] = std::min( B[ k ], b ); I[ k ] = large; myValidEdgeConstraints = myValidEdgeConstraints && valid_edge_constraint; // a cut might invalidate an edge constraint - return k; + return static_cast(k); } } //----------------------------------------------------------------------------- diff --git a/src/DGtal/geometry/volumes/CellGeometry.ih b/src/DGtal/geometry/volumes/CellGeometry.ih index 32d7575293..9958b1b2e1 100644 --- a/src/DGtal/geometry/volumes/CellGeometry.ih +++ b/src/DGtal/geometry/volumes/CellGeometry.ih @@ -60,7 +60,6 @@ CellGeometry( const KSpace & K, myMinCellDim( min_cell_dim ), myMaxCellDim( max_cell_dim ), myVerbose( verbose ) { - ASSERT( 0 <= myMinCellDim ); ASSERT( myMinCellDim <= myMaxCellDim ); ASSERT( myMaxCellDim <= myK.dimension ); } @@ -71,7 +70,6 @@ DGtal::CellGeometry:: init( const KSpace & K, Dimension min_cell_dim, Dimension max_cell_dim, bool verbose ) { - ASSERT( 0 <= myMinCellDim ); ASSERT( myMinCellDim <= myMaxCellDim ); ASSERT( myMaxCellDim <= myK.dimension ); myK = K; @@ -143,7 +141,7 @@ addCellsTouchingSegment( const Point& a, const Point& b ) { const auto V = b - a; addCellsTouchingPoint( a ); - for ( Integer k = 0; k < dimension; k++ ) + for ( Dimension k = 0; k < dimension; k++ ) { const Integer n = ( V[ k ] >= 0 ) ? V[ k ] : -V[ k ]; const Integer d = ( V[ k ] >= 0 ) ? 1 : -1; @@ -306,7 +304,7 @@ typename DGtal::CellGeometry::Size DGtal::CellGeometry:: nbCells() const { - return myKPoints.size(); + return (DGtal::CellGeometry::Size)myKPoints.size(); } //----------------------------------------------------------------------------- template diff --git a/src/DGtal/geometry/volumes/ConvexCellComplex.h b/src/DGtal/geometry/volumes/ConvexCellComplex.h index c1dabbcaf4..eade6d619e 100644 --- a/src/DGtal/geometry/volumes/ConvexCellComplex.h +++ b/src/DGtal/geometry/volumes/ConvexCellComplex.h @@ -453,7 +453,7 @@ namespace DGtal } // Orient them consistently for ( Index c = 0; c < nbCells(); c++ ) { - const auto& c_vtcs = cellVertices( c ); + //const auto& c_vtcs = cellVertices( c ); //not used for ( auto f : cellFaces( c ) ) { if ( ! f.second ) continue; // process only 'true' faces const auto ov = faceComplementVertices( f ); diff --git a/src/DGtal/geometry/volumes/ConvexityHelper.ih b/src/DGtal/geometry/volumes/ConvexityHelper.ih index b2e0eb52ce..184e101a07 100644 --- a/src/DGtal/geometry/volumes/ConvexityHelper.ih +++ b/src/DGtal/geometry/volumes/ConvexityHelper.ih @@ -73,7 +73,6 @@ computeDegeneratedLatticePolytope typedef typename LatticePolytope::Domain Domain; typedef typename LatticePolytope::HalfSpace PolytopeHalfSpace; typedef QuickHull< LatticeConvexHullKernel > ConvexHull; - typedef typename ConvexHull::IndexRange IndexRange; typedef typename ConvexHull::HalfSpace ConvexHullHalfSpace; // input_points is a range of points with no duplicates, but which // seems to be not full dimensional. @@ -172,8 +171,8 @@ computeDegeneratedLatticePolytope for ( auto& H : HS ) { Vector N; Integer nu; - for ( Dimension i = 0; i < dim; ++i ) - N[ i ] = IntegerConverter< dimension, Integer >::cast( H.internalNormal()[ i ] ); + for ( Dimension ii = 0; ii < dim; ++ii ) + N[ ii ] = IntegerConverter< dimension, Integer >::cast( H.internalNormal()[ ii ] ); nu = IntegerConverter< dimension, Integer >::cast( H.internalIntercept() ); PHS.emplace_back( N, nu ); } @@ -191,11 +190,7 @@ DGtal::ConvexityHelper< dim, TInteger, TInternalInteger>:: computeDegeneratedConvexHullVertices ( PointRange& input_points ) { - typedef typename LatticePolytope::Domain Domain; - typedef typename LatticePolytope::HalfSpace PolytopeHalfSpace; typedef QuickHull< LatticeConvexHullKernel > ConvexHull; - typedef typename ConvexHull::IndexRange IndexRange; - typedef typename ConvexHull::HalfSpace ConvexHullHalfSpace; // input_points is a range of points with no duplicates, but which // seems to be not full dimensional. if ( input_points.size() <= 1 ) @@ -407,7 +402,6 @@ computeConvexHullVertices bool remove_duplicates ) { typedef QuickHull< LatticeConvexHullKernel > ConvexHull; - typedef typename ConvexHull::IndexRange IndexRange; PointRange positions; ConvexHull hull; hull.setInput( input_points, remove_duplicates ); @@ -432,7 +426,6 @@ DGtal::ConvexityHelper< dim, TInteger, TInternalInteger>::computeConvexHullBound { typedef TSurfaceMesh SurfaceMesh; typedef QuickHull< LatticeConvexHullKernel > ConvexHull; - typedef typename ConvexHull::IndexRange IndexRange; ConvexHull hull; hull.setInput( input_points, remove_duplicates ); bool ok = hull.computeConvexHull( ConvexHull::Status::VerticesCompleted ); @@ -455,7 +448,6 @@ DGtal::ConvexityHelper< dim, TInteger, TInternalInteger>::computeConvexHullBound bool remove_duplicates ) { typedef QuickHull< LatticeConvexHullKernel > ConvexHull; - typedef typename ConvexHull::IndexRange IndexRange; ConvexHull hull; hull.setInput( input_points, remove_duplicates ); bool ok = hull.computeConvexHull( ConvexHull::Status::VerticesCompleted ); @@ -480,7 +472,6 @@ DGtal::ConvexityHelper< dim, TInteger, TInternalInteger>::computeConvexHullCellC bool remove_duplicates ) { typedef QuickHull< LatticeConvexHullKernel > ConvexHull; - typedef typename ConvexHull::IndexRange IndexRange; typedef typename ConvexCellComplex< Point >::FaceRange FaceRange; ConvexHull hull; hull.setInput( input_points, remove_duplicates ); @@ -497,7 +488,7 @@ DGtal::ConvexityHelper< dim, TInteger, TInternalInteger>::computeConvexHullCellC cell_complex.cell_faces.push_back( all_faces ); // Vertices of this unique cell will be computed lazily on request. // Taking care of each face. - for ( const auto& vtcs : faces ) + for ( Index i = 0; i < faces.size(); i++ ) { // every inner face borders cell 0 cell_complex.true_face_cell.push_back( 0 ); @@ -686,7 +677,6 @@ DGtal::ConvexityHelper< dim, TInteger, TInternalInteger>::computeConvexHullBound { typedef TSurfaceMesh SurfaceMesh; typedef QuickHull< RealConvexHullKernel > ConvexHull; - typedef typename ConvexHull::IndexRange IndexRange; ConvexHull hull( precision ); hull.setInput( input_points, remove_duplicates ); bool ok = hull.computeConvexHull( ConvexHull::Status::VerticesCompleted ); @@ -711,7 +701,6 @@ DGtal::ConvexityHelper< dim, TInteger, TInternalInteger>::computeConvexHullBound bool remove_duplicates ) { typedef QuickHull< RealConvexHullKernel > ConvexHull; - typedef typename ConvexHull::IndexRange IndexRange; ConvexHull hull( precision ); hull.setInput( input_points, remove_duplicates ); bool ok = hull.computeConvexHull( ConvexHull::Status::VerticesCompleted ); @@ -737,7 +726,6 @@ DGtal::ConvexityHelper< dim, TInteger, TInternalInteger>::computeConvexHullCellC bool remove_duplicates ) { typedef QuickHull< RealConvexHullKernel > ConvexHull; - typedef typename ConvexHull::IndexRange IndexRange; typedef typename ConvexCellComplex< RealPoint >::FaceRange FaceRange; ConvexHull hull( precision ); hull.setInput( input_points, remove_duplicates ); @@ -754,7 +742,7 @@ DGtal::ConvexityHelper< dim, TInteger, TInternalInteger>::computeConvexHullCellC cell_complex.cell_faces.push_back( all_faces ); // Vertices of this unique cell will be computed lazily on request. // Taking care of each face. - for ( const auto& vtcs : faces ) + for ( Index i = 0; i < faces.size(); i++ ) { // every inner face borders cell 0 cell_complex.true_face_cell.push_back( 0 ); diff --git a/src/DGtal/geometry/volumes/DigitalConvexity.ih b/src/DGtal/geometry/volumes/DigitalConvexity.ih index 056a54f184..57723aa02c 100644 --- a/src/DGtal/geometry/volumes/DigitalConvexity.ih +++ b/src/DGtal/geometry/volumes/DigitalConvexity.ih @@ -175,8 +175,8 @@ displaySimplex( std::ostream& out, PointIterator itB, PointIterator itE ) if ( k != d+1 ) { out << "[SPLX INVALID]"; return; } Matrix M; for ( Dimension i = 0; i < d; ++i ) - for ( Dimension k = 0; k < d; ++k ) - M.setComponent( i, k, pts[ i ][ k ] - pts[ d ][ k ] ); + for ( Dimension kk = 0; kk < d; ++kk ) + M.setComponent( i, kk, pts[ i ][ kk ] - pts[ d ][ kk ] ); // A simplex has its vectors linearly independent. auto V = M.determinant(); out << "[SPLX V=" << V; @@ -249,7 +249,6 @@ DGtal::DigitalConvexity:: makeCellCover( PointIterator itB, PointIterator itE, Dimension i, Dimension k ) const { - ASSERT( 0 <= i ); ASSERT( i <= k ); ASSERT( k <= KSpace::dimension ); CellGeometry cgeom( myK, i, k, false ); @@ -264,7 +263,6 @@ DGtal::DigitalConvexity:: makeCellCover( const LatticePolytope& P, Dimension i, Dimension k ) const { - ASSERT( 0 <= i ); ASSERT( i <= k ); ASSERT( k <= KSpace::dimension ); CellGeometry cgeom( myK, i, k, false ); @@ -279,7 +277,6 @@ DGtal::DigitalConvexity:: makeCellCover( const RationalPolytope& P, Dimension i, Dimension k ) const { - ASSERT( 0 <= i ); ASSERT( i <= k ); ASSERT( k <= KSpace::dimension ); CellGeometry cgeom( myK, i, k, false ); @@ -333,7 +330,7 @@ is0Convex( const PointRange& X ) const { if ( X.empty() ) return true; const auto P = makePolytope( X ); - return P.count() == X.size(); + return P.count() == (DGtal::BoundedLatticePolytope>::Integer)X.size(); } //----------------------------------------------------------------------------- @@ -381,7 +378,7 @@ isFullyConvexFast( const PointRange& Z ) const LatticeSet C_Z( Z.cbegin(), Z.cend(), 0 ); const auto nb_cells = C_Z.starOfPoints().size(); const auto s = sizeStarCvxH( Z ); - return s == nb_cells; + return s == (Integer)nb_cells; } //----------------------------------------------------------------------------- @@ -413,8 +410,6 @@ DGtal::DigitalConvexity:: StarCvxH( const PointRange& X, Dimension axis ) const { PointRange cells; - typedef BoundedLatticePolytopeCounter Counter; - typedef typename Counter::Interval Interval; // Computes Minkowski sum of Z with hypercube PointRange Z = U( 0, X ); for ( Dimension k = 1; k < dimension; k++ ) @@ -476,8 +471,6 @@ DGtal::DigitalConvexity:: sizeStarCvxH( const PointRange& X ) const { PointRange cells; - typedef BoundedLatticePolytopeCounter Counter; - typedef typename Counter::Interval Interval; // Computes Minkowski sum of Z with hypercube PointRange Z = U( 0, X ); for ( Dimension k = 1; k < dimension; k++ ) @@ -560,9 +553,7 @@ typename DGtal::DigitalConvexity::PointRange DGtal::DigitalConvexity:: FC_direct( const PointRange& Z ) const { - typedef std::size_t Size; typedef typename LatticePolytope::Domain Domain; - typedef typename Counter::Interval Interval; PointRange cells; // Computes Minkowski sum of Z with hypercube PointRange X( Z ); @@ -579,7 +570,7 @@ FC_direct( const PointRange& Z ) const hi[ a ] = lo[ a ]; const Domain projD( lo, hi ); //< the projected domain of the polytope. const Point One = Point::diagonal( 1 ); - const Size size = projD.size(); + //const Size size = projD.size(); //not USED std::unordered_map< Point, Interval > cellP; Point q; for ( auto&& p : projD ) @@ -612,13 +603,13 @@ FC_direct( const PointRange& Z ) const auto s = std::min( I.second, J.second ); if ( f <= s ) { - Point q = p; q[ k ] += 1; - q_computed.push_back( q ); + Point qq = p; qq[ k ] += 1; + q_computed.push_back( qq ); I_computed.push_back( Interval( f, s ) ); } } // Add new columns to map Point -> column - for ( auto i = 0; i < q_computed.size(); ++i ) + for ( size_t i = 0; i < q_computed.size(); ++i ) { cellP[ q_computed[ i ] ] = I_computed[ i ]; } @@ -636,6 +627,7 @@ FC_direct( const PointRange& Z ) const << n << std::endl; std::vector< Interval > V( 1, I ); auto result = skelP.insert( std::make_pair( p, V ) ); + (void)result;//unused var; } // std::cout << "Extract skel" << std::endl; @@ -649,9 +641,9 @@ FC_direct( const PointRange& Z ) const if ( k == a ) continue; if ( ( p[ k ] & 0x1 ) != 0 ) continue; // if open along axis continue // if closed, check upper incident cells along direction k - Point q = p; q[ k ] -= 1; + Point qq = p; qq[ k ] -= 1; Point r = p; r[ k ] += 1; - auto itq = skelP.find( q ); + auto itq = skelP.find( qq ); if ( itq != skelP.end() ) { auto& W = itq->second; @@ -864,7 +856,6 @@ isFullySubconvex( const LatticePolytope& P, const LatticeSet& StarX ) const LatticePolytope Q = P + typename LatticePolytope::UnitSegment( 0 ); for ( Dimension k = 1; k < dimension; k++ ) Q = Q + typename LatticePolytope::UnitSegment( k ); - typedef BoundedLatticePolytopeCounter Counter; Counter C( Q ); const auto cells = C.getLatticeCells( StarX.axis() ); LatticeSet StarP( cells, StarX.axis() ); @@ -917,7 +908,7 @@ isFullySubconvex( const Point& a, const Point& b, const auto V = b - a; L_ab.insert( 2*a ); // addCellsTouchingPoint( a ); - for ( Integer k = 0; k < dimension; k++ ) + for ( Dimension k = 0; k < dimension; k++ ) { const Integer n = ( V[ k ] >= 0 ) ? V[ k ] : -V[ k ]; const Integer d = ( V[ k ] >= 0 ) ? 1 : -1; diff --git a/src/DGtal/geometry/volumes/TangencyComputer.h b/src/DGtal/geometry/volumes/TangencyComputer.h index f8c24196d5..9abf884b05 100644 --- a/src/DGtal/geometry/volumes/TangencyComputer.h +++ b/src/DGtal/geometry/volumes/TangencyComputer.h @@ -183,7 +183,7 @@ namespace DGtal /// @note Must be done before starting computations. void init( Index i ) { - ASSERT( 0 <= i && i < size() ); + ASSERT( i < size() ); myQ.push( std::make_tuple( i, i, 0.0 ) ); myAncestor[ i ] = i; myDistance[ i ] = 0.0; @@ -202,7 +202,7 @@ namespace DGtal for ( ; it != itE; ++it ) { const auto i = *it; - ASSERT( 0 <= i && i < size() ); + ASSERT( i < size() ); myQ.push( std::make_tuple( i, i, 0.0 ) ); } const auto elem = myQ.top(); @@ -248,7 +248,7 @@ namespace DGtal /// @return the point with index \a i. const Point& point( Index i ) const { - ASSERT( 0 <= i && i < size() ); + ASSERT( i < size() ); return myTgcyComputer->point( i ); } @@ -260,7 +260,7 @@ namespace DGtal /// called. Index ancestor( Index i ) const { - ASSERT( 0 <= i && i < size() ); + ASSERT( i < size() ); return myAncestor[ i ]; } @@ -272,7 +272,7 @@ namespace DGtal /// called. double distance( Index i ) const { - ASSERT( 0 <= i && i < size() ); + ASSERT( i < size() ); return myDistance[ i ]; } @@ -366,7 +366,7 @@ namespace DGtal }; /// ShortestPaths may access to datas of TangencyComputer. - friend class ShortestPaths; + friend struct ShortestPaths; // ------------------------- Standard services -------------------------------- public: diff --git a/src/DGtal/geometry/volumes/TangencyComputer.ih b/src/DGtal/geometry/volumes/TangencyComputer.ih index 443be37e90..9a2ab79075 100644 --- a/src/DGtal/geometry/volumes/TangencyComputer.ih +++ b/src/DGtal/geometry/volumes/TangencyComputer.ih @@ -182,7 +182,7 @@ getCotangentPoints( Index idx_a ) const const auto p = point( j ); const auto ap = p - a; Q.pop(); - for ( int i = 0; i < myTgcyComputer->myN.size(); i++ ) { + for ( size_t i = 0; i < myTgcyComputer->myN.size(); i++ ) { const auto & v = myTgcyComputer->myN[ i ]; if ( ap.dot( v ) < 0.0 ) continue; // going backward const Point q = p + v; @@ -314,11 +314,9 @@ expand() propagate( std::get<0>( elem ) ); Index current; double d; - int nb = 0; while ( ! finished() ) { elem = myQ.top(); - nb += 1; current = std::get<0>( elem ); d = std::get<2>( elem ); ASSERT( ( ! ( myVisited[ current ] && ( d < myDistance[ current ] ) ) ) diff --git a/src/DGtal/geometry/volumes/distance/PowerMap.ih b/src/DGtal/geometry/volumes/distance/PowerMap.ih index c7213fecfe..14172afac7 100644 --- a/src/DGtal/geometry/volumes/distance/PowerMap.ih +++ b/src/DGtal/geometry/volumes/distance/PowerMap.ih @@ -104,7 +104,7 @@ DGtal::PowerMap::computeOtherSteps ( const Dimension dim ) const //We run the 1D problems in // #pragma omp parallel for schedule(dynamic) - for (size_t i = 0; i < subRangePoints.size(); ++i) + for (int i = 0; i < (int)subRangePoints.size(); ++i) //MSCV needs signed computeOtherStep1D ( subRangePoints[i], dim); #else diff --git a/src/DGtal/geometry/volumes/distance/VoronoiMap.ih b/src/DGtal/geometry/volumes/distance/VoronoiMap.ih index f648d71c38..c52efc2cb0 100644 --- a/src/DGtal/geometry/volumes/distance/VoronoiMap.ih +++ b/src/DGtal/geometry/volumes/distance/VoronoiMap.ih @@ -95,7 +95,7 @@ DGtal::VoronoiMap::computeOtherSteps ( const Dimension dim ) //We run the 1D problems in // #pragma omp parallel for schedule(dynamic) - for (size_t i = 0; i < subRangePoints.size(); ++i) + for (int i = 0; i < static_cast(subRangePoints.size()); ++i) //MSVC requires signed type for openmp computeOtherStep1D ( subRangePoints[i], dim); #else diff --git a/src/DGtal/geometry/volumes/distance/VoronoiMapComplete.ih b/src/DGtal/geometry/volumes/distance/VoronoiMapComplete.ih index 1a35b63288..aa122da4d2 100644 --- a/src/DGtal/geometry/volumes/distance/VoronoiMapComplete.ih +++ b/src/DGtal/geometry/volumes/distance/VoronoiMapComplete.ih @@ -101,7 +101,7 @@ const Dimension dim ) const // We run the 1D problems in // #pragma omp parallel for schedule( dynamic ) - for ( size_t i = 0; i < subRangePoints.size(); ++i ) + for ( int i = 0; i < static_cast(subRangePoints.size()); ++i ) //MSVC requires signed type for openmp computeOtherStep1D( subRangePoints[ i ], dim ); #else diff --git a/src/DGtal/graph/DistanceBreadthFirstVisitor.h b/src/DGtal/graph/DistanceBreadthFirstVisitor.h index 30d1a316bf..3ae7db6cea 100644 --- a/src/DGtal/graph/DistanceBreadthFirstVisitor.h +++ b/src/DGtal/graph/DistanceBreadthFirstVisitor.h @@ -233,7 +233,6 @@ while ( ! visitor.finished() ) using Base::second; inline Node() = default; - inline Node( const Node & other ) = default; inline Node( const Vertex & v, Scalar d ) : std::pair< Vertex, Scalar >( v, d ) {} diff --git a/src/DGtal/helpers/Parameters.h b/src/DGtal/helpers/Parameters.h index 1961ee0ad6..836e04236e 100644 --- a/src/DGtal/helpers/Parameters.h +++ b/src/DGtal/helpers/Parameters.h @@ -55,7 +55,7 @@ namespace DGtal template struct ValueConverter { /// By default, it is impossible to do such conversions. - static Y cast( const X& value ) + static Y cast( const X& ) { ASSERT( false && "[ValueConverter::cast] there is no such generic type converter." ); diff --git a/src/DGtal/helpers/ShortcutsGeometry.h b/src/DGtal/helpers/ShortcutsGeometry.h index c42710a352..e40ede452e 100644 --- a/src/DGtal/helpers/ShortcutsGeometry.h +++ b/src/DGtal/helpers/ShortcutsGeometry.h @@ -49,10 +49,8 @@ #include "DGtal/geometry/surfaces/estimation/IntegralInvariantVolumeEstimator.h" #include "DGtal/geometry/surfaces/estimation/IntegralInvariantCovarianceEstimator.h" -#if defined(WITH_EIGEN) #include "DGtal/dec/DiscreteExteriorCalculusFactory.h" #include "DGtal/dec/ATSolver2D.h" -#endif // defined(WITH_EIGEN) ////////////////////////////////////////////////////////////////////////////// namespace DGtal @@ -1405,6 +1403,8 @@ namespace DGtal const Parameters& params = parametersATApproximation() | parametersGeometryEstimation() ) { + (void)surface; //param not used. FIXME: JOL + int verbose = params[ "verbose" ].as(); Scalar alpha_at = params[ "at-alpha" ].as(); Scalar lambda_at = params[ "at-lambda" ].as(); @@ -1469,6 +1469,8 @@ namespace DGtal const Parameters& params = parametersATApproximation() | parametersGeometryEstimation() ) { + (void)surface; //param not used FIXME: JOL + int verbose = params[ "verbose" ].as(); Scalar alpha_at = params[ "at-alpha" ].as(); Scalar lambda_at = params[ "at-lambda" ].as(); @@ -1526,6 +1528,8 @@ namespace DGtal const Parameters& params = parametersATApproximation() | parametersGeometryEstimation() ) { + (void)surface; //param not used FIXME: JOL + int verbose = params[ "verbose" ].as(); Scalar alpha_at = params[ "at-alpha" ].as(); Scalar lambda_at = params[ "at-lambda" ].as(); @@ -1593,6 +1597,8 @@ namespace DGtal const Parameters& params = parametersATApproximation() | parametersGeometryEstimation() ) { + (void)surface; //param not used FIXME: JOL + int verbose = params[ "verbose" ].as(); Scalar alpha_at = params[ "at-alpha" ].as(); Scalar lambda_at = params[ "at-lambda" ].as(); diff --git a/src/DGtal/images/ArrayImageIterator.h b/src/DGtal/images/ArrayImageIterator.h index 7f2f585a8e..f9a5f99cb1 100644 --- a/src/DGtal/images/ArrayImageIterator.h +++ b/src/DGtal/images/ArrayImageIterator.h @@ -77,7 +77,7 @@ namespace DGtal ArrayImageIterator, typename TIterableClass::Value, std::random_access_iterator_tag, - decltype( ((TIterableClass*)nullptr)->dereference( TIterableClass::Point::diagonal(0), typename TIterableClass::Point::Coordinate(0) ) ) + decltype( ((new TIterableClass))->dereference( TIterableClass::Point::diagonal(0), typename TIterableClass::Point::Coordinate(0) ) ) > { // ----------------------- Standard services ------------------------------ @@ -89,7 +89,7 @@ namespace DGtal using Domain = typename IterableClass::Domain; ///< Domain type. \todo or in template with default value ? using Point = typename Domain::Point; ///< Point type. using Linearizer = DGtal::Linearizer; ///< Linearizer type. \todo hard-coded, but must be later set as template. - using Reference = decltype( ((IterableClass*)nullptr)->dereference( Point::diagonal(0), typename Point::Coordinate(0) ) ); ///< Return type when dereferencing this iterator. + using Reference = decltype( ((new IterableClass)->dereference( Point::diagonal(0), typename Point::Coordinate(0) ) )); ///< Return type when dereferencing this iterator. /// Default constructor. ArrayImageIterator(); diff --git a/src/DGtal/images/ImageContainerByITKImage.ih b/src/DGtal/images/ImageContainerByITKImage.ih index 9fcd8240f5..18eed39012 100644 --- a/src/DGtal/images/ImageContainerByITKImage.ih +++ b/src/DGtal/images/ImageContainerByITKImage.ih @@ -101,8 +101,8 @@ namespace DGtal Point upperBound; for (Dimension k = 0; k < dimension; k++) { - lowerBound[k] = start[k]+myDomainShift[k]; - upperBound[k] = start[k]+size[k]+myDomainShift[k]-1; + lowerBound[k] = static_cast(start[k]+myDomainShift[k]); + upperBound[k] = static_cast(start[k]+size[k]+myDomainShift[k]-1); } myDomain = TDomain(lowerBound, upperBound); diff --git a/src/DGtal/images/SetValueIterator.h b/src/DGtal/images/SetValueIterator.h index caf79b40e3..e63a4255c0 100644 --- a/src/DGtal/images/SetValueIterator.h +++ b/src/DGtal/images/SetValueIterator.h @@ -64,12 +64,17 @@ namespace DGtal */ template - class SetValueIterator: - public std::iterator + class SetValueIterator { // ----------------------- Types definitions ------------------------------ public: + using iterator_category = std::output_iterator_tag; + using value_type = void; + using difference_type = void; + using pointer = void; + using reference = void; + typedef TImage Image; BOOST_CONCEPT_ASSERT(( concepts::CTrivialImage )); diff --git a/src/DGtal/images/TiledImage.h b/src/DGtal/images/TiledImage.h index 0843851103..6174f9dfe6 100644 --- a/src/DGtal/images/TiledImage.h +++ b/src/DGtal/images/TiledImage.h @@ -229,20 +229,19 @@ namespace DGtal * Specific TiledIterator on TiledImage. */ - class TiledIterator : public - std::iterator + class TiledIterator { friend class TiledImage; public: - - /*typedef std::bidirectional_iterator_tag iterator_category; // ??? - typedef Value value_type; - typedef ptrdiff_t difference_type; // ??? - typedef Value* pointer; - typedef Value& reference;*/ - + + using iterator_category = std::bidirectional_iterator_tag; + using value_type = Value; + using difference_type = ptrdiff_t; + using pointer = Value*; + using reference = Value&; + typedef typename ImageContainer::Range::/*Output*/Iterator TiledRangeIterator; typedef typename Domain::Iterator BlockCoordsIterator; diff --git a/src/DGtal/io/ITKIOTrait.h b/src/DGtal/io/ITKIOTrait.h index 94fcb48c1f..796ad9c4a1 100644 --- a/src/DGtal/io/ITKIOTrait.h +++ b/src/DGtal/io/ITKIOTrait.h @@ -42,28 +42,29 @@ namespace DGtal { - /** - * ITK images extensions handled by GenericReader and GenericWriter - **/ - const auto ITK_IO_IMAGE_EXT = {"nii", "gz" ,"mha", "mhd", "tiff", "nrrd", - "tif", "pic", "mnc"}; + /** + * ITK images extensions handled by GenericReader and GenericWriter + **/ + [[maybe_unused]] const auto ITK_IO_IMAGE_EXT = {"nii", "gz" ,"mha", "mhd", "tiff", "nrrd", + "tif", "pic", "mnc"}; -///////////////////////////////////////////////////////////////////////////// -// class ITKIOTrait -/** - * Description of class 'ITKIOTrait'

- * \brief Aim: Provide type trait for ITK reader and ITK writer - * @tparam Value is the value type of the DGtal image one wants to save or read using ITKWriter or ITKReader - */ -template -struct ITKIOTrait -{ - typedef Value ValueOut; // Associated ITK image value type - typedef functors::Cast DefaultWriteFunctor; // Default functor used by ITKWriter - typedef functors::Cast DefaultReadFunctor; // Default functor used by ITKReader + ///////////////////////////////////////////////////////////////////////////// + // class ITKIOTrait + /** + * Description of class 'ITKIOTrait'

\brief Aim: Provide type + * trait for ITK reader and ITK writer @tparam Value is the value + * type of the DGtal image one wants to save or read using ITKWriter + * or ITKReader + */ + template + struct ITKIOTrait + { + typedef Value ValueOut; // Associated ITK image value type + typedef functors::Cast DefaultWriteFunctor; // Default functor used by ITKWriter + typedef functors::Cast DefaultReadFunctor; // Default functor used by ITKReader -private: + private: /** * Constructor. @@ -74,16 +75,16 @@ struct ITKIOTrait ITKIOTrait& operator=(const ITKIOTrait& other); -}; // end of struct ITKIOTrait + }; // end of struct ITKIOTrait -// specialization -template <> -struct ITKIOTrait -{ - typedef unsigned char ValueOut; - typedef functors::Cast DefaultWriteFunctor; - typedef functors::Cast DefaultReadFunctor; -}; + // specialization + template <> + struct ITKIOTrait + { + typedef unsigned char ValueOut; + typedef functors::Cast DefaultWriteFunctor; + typedef functors::Cast DefaultReadFunctor; + }; } // namespace DGtal diff --git a/src/DGtal/io/readers/DicomReader.ih b/src/DGtal/io/readers/DicomReader.ih index c4269649e4..ac8b3ed02c 100644 --- a/src/DGtal/io/readers/DicomReader.ih +++ b/src/DGtal/io/readers/DicomReader.ih @@ -118,9 +118,9 @@ importDicomFiles_( const std::vector & filenames ) const typename ItkImage::SizeType& inputSize = itkImage->GetLargestPossibleRegion().GetSize(); - const unsigned int width = inputSize[0]; - const unsigned int height = inputSize[1]; - const unsigned int depth = inputSize[2]; + const auto width = inputSize[0]; + const auto height = inputSize[1]; + const auto depth = inputSize[2]; if ( !height || !width || !depth ) { trace.error() << "DicomReader: one dimension is null (w=" << width diff --git a/src/DGtal/io/readers/ITKDicomReader.ih b/src/DGtal/io/readers/ITKDicomReader.ih index 04764232f2..eeac9f7966 100644 --- a/src/DGtal/io/readers/ITKDicomReader.ih +++ b/src/DGtal/io/readers/ITKDicomReader.ih @@ -52,6 +52,9 @@ namespace DGtal { I ITKDicomReader::importDICOM( const std::vector & filenames, const TFunctor & aFunctor ) { + (void)ITK_IO_IMAGE_EXT; //To avoid compiler "not used" warning + //when building only this reader. + if ( filenames.empty() ) { trace.error() << "[ITKDicomReader] empty filenames vector passed."; diff --git a/src/DGtal/io/readers/ITKReader.ih b/src/DGtal/io/readers/ITKReader.ih index 61a2072cce..3b4be7cd81 100644 --- a/src/DGtal/io/readers/ITKReader.ih +++ b/src/DGtal/io/readers/ITKReader.ih @@ -148,7 +148,7 @@ namespace DGtal { ITKReader::getITKComponentType( const std::string & filename ) { typedef itk::ImageIOBase::IOComponentType IOComponentType; - IOComponentType componentType; + IOComponentType componentType=itk::ImageIOBase::IOComponentType::UCHAR; try { itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO( diff --git a/src/DGtal/io/readers/MeshReader.ih b/src/DGtal/io/readers/MeshReader.ih index c9501fb073..233e1bd03b 100644 --- a/src/DGtal/io/readers/MeshReader.ih +++ b/src/DGtal/io/readers/MeshReader.ih @@ -385,7 +385,7 @@ importOBJFile( const std::string & filename, DGtal::Mesh & mesh ) std::operator>>( lineinput, name ); std::string base = name.substr(0,name.find_last_of(".")); auto iSep = filename.find_last_of('/'); - if (iSep == -1) + if ((int)iSep == -1) { // special for windows. iSep = filename.find_last_of('\\'); } diff --git a/src/DGtal/io/readers/STBReader.ih b/src/DGtal/io/readers/STBReader.ih index c56a32a573..d5437d32bd 100644 --- a/src/DGtal/io/readers/STBReader.ih +++ b/src/DGtal/io/readers/STBReader.ih @@ -30,7 +30,16 @@ #pragma once #define STB_IMAGE_IMPLEMENTATION #endif //NO_ADD_STBIMAGE_IMPLEMENT +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +#pragma clang diagnostic ignored "-Wmissing-field-initializers" + #include +#pragma GCC diagnostic pop +#pragma clang diagnostic pop /////////////////////////////////////////////////////////////////////////////// // Interface - public : diff --git a/src/DGtal/io/readers/SurfaceMeshReader.ih b/src/DGtal/io/readers/SurfaceMeshReader.ih index a825e393f3..9109d3706a 100644 --- a/src/DGtal/io/readers/SurfaceMeshReader.ih +++ b/src/DGtal/io/readers/SurfaceMeshReader.ih @@ -139,13 +139,12 @@ readOBJ( std::istream & input, SurfaceMesh & smesh ) if ( ! normals.empty() ) { // Build face normal map std::vector< RealVector > faces_normals; - Index i = 0; for ( auto face_n_indices : faces_normals_idx ) { - RealVector n; - for ( auto k : face_n_indices ) n += normals[ k ]; - n /= face_n_indices.size(); - faces_normals.push_back( n ); + RealVector _n; + for ( auto k : face_n_indices ) _n += normals[ k ]; + _n /= face_n_indices.size(); + faces_normals.push_back( _n ); } bool ok_face_normals = smesh.setFaceNormals( faces_normals.begin(), faces_normals.end() ); diff --git a/src/DGtal/io/writers/ITKWriter.ih b/src/DGtal/io/writers/ITKWriter.ih index bd9455a461..250740d3ce 100644 --- a/src/DGtal/io/writers/ITKWriter.ih +++ b/src/DGtal/io/writers/ITKWriter.ih @@ -96,13 +96,11 @@ namespace DGtal { template bool ITKWriter< ImageContainerByITKImage, TFunctor >::exportITK(const std::string& filename, - const ImageContainerByITKImage& aImage, const TFunctor& aFunctor) + const ImageContainerByITKImage& aImage,[[maybe_unused]] const TFunctor& aFunctor) { + typedef typename Image::Domain Domain; - const Domain& domain = aImage.domain(); - typedef ConstImageAdapter AdaptedImage; - const functors::Identity identityFunctor{}; typedef ImageContainerByITKImage DGtalITKImage; typedef itk::ImageFileWriter ITKImageWriter; typename ITKImageWriter::Pointer writer = ITKImageWriter::New(); diff --git a/src/DGtal/io/writers/STBWriter.ih b/src/DGtal/io/writers/STBWriter.ih index 5b6dd9930b..a72dde29a6 100644 --- a/src/DGtal/io/writers/STBWriter.ih +++ b/src/DGtal/io/writers/STBWriter.ih @@ -30,8 +30,16 @@ #pragma once #define STB_IMAGE_WRITE_IMPLEMENTATION #endif //NO_ADD_STBIMAGE_IMPLEMENT +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +#pragma clang diagnostic ignored "-Wmissing-field-initializers" #include -#pragma GCC diagnostic warning "-Wdeprecated" +#pragma GCC diagnostic pop +#pragma clang diagnostic pop + /////////////////////////////////////////////////////////////////////////////// // Interface - public : @@ -46,7 +54,7 @@ DGtal::STBWriter::exportPNG(const std::string & filen const int w = anImage.domain().upperBound()[0] - anImage.domain().lowerBound()[0] +1 ; const int h = anImage.domain().upperBound()[1] - anImage.domain().lowerBound()[1] +1 ; const int comp=4; - unsigned char *data = (unsigned char*)malloc( sizeof(unsigned char)*w * h * comp); + unsigned char *data = (unsigned char*)malloc( w * h * comp ); unsigned int cpt=0; for(const auto &value: anImage) @@ -59,7 +67,7 @@ DGtal::STBWriter::exportPNG(const std::string & filen ++cpt; } const int error = stbi_write_png(filename.c_str(), w, h, comp, data, w*comp); - delete(data); + free(data); return error; } @@ -86,7 +94,7 @@ DGtal::STBWriter::exportBMP(const std::string & filen ++cpt; } const int error = stbi_write_bmp(filename.c_str(), w, h, comp, data); - delete(data); + free(data); return error; } @@ -114,7 +122,7 @@ DGtal::STBWriter::exportTGA(const std::string & filen ++cpt; } const int error = stbi_write_bmp(filename.c_str(), w, h, comp, data); - delete(data); + free(data); return error; } template @@ -141,7 +149,7 @@ DGtal::STBWriter::exportJPG(const std::string & filen ++cpt; } const int error = stbi_write_jpg(filename.c_str(), w, h, comp, data, quality); - delete(data); + free(data); return error; } // // diff --git a/src/DGtal/io/writers/SurfaceMeshWriter.ih b/src/DGtal/io/writers/SurfaceMeshWriter.ih index 9759d3b290..58df1f8801 100644 --- a/src/DGtal/io/writers/SurfaceMeshWriter.ih +++ b/src/DGtal/io/writers/SurfaceMeshWriter.ih @@ -168,11 +168,8 @@ writeEdgeLinesOBJ( std::string objfile, { typedef KhalimskySpaceND< 3, int > KSpace; typedef Shortcuts< KSpace > SH; - typedef typename SH::RealPoint RealPoint; typedef typename SH::RealPoints RealPoints; - typedef typename SH::RealVector RealVector; typedef typename SH::RealVectors RealVectors; - typedef typename SH::Colors Colors; typedef typename SurfaceMesh::Edge Edge; RealPoints positions; @@ -209,11 +206,8 @@ writeIsoLinesOBJ( std::string objfile, { typedef KhalimskySpaceND< 3, int > KSpace; typedef Shortcuts< KSpace > SH; - typedef typename SH::RealPoint RealPoint; typedef typename SH::RealPoints RealPoints; - typedef typename SH::RealVector RealVector; typedef typename SH::RealVectors RealVectors; - typedef typename SH::Colors Colors; RealPoints positions; RealVectors edge_vectors; @@ -253,12 +247,12 @@ writeIsoLinesOBJ( std::string objfile, trace.warning() << "[SurfaceMeshWriter::writeIsoLinesOBJ]" << " Weird iso-line on face " << f << std::endl; else { - for ( Size i = 0; i < crossings.size(); ++i ) - for ( Size j = i+1; j < crossings.size(); ++j ) + for ( Size ii = 0; ii < crossings.size(); ++ii ) + for ( Size j = ii+1; j < crossings.size(); ++j ) { - RealVector pq = crossings[ j ] - crossings[ i ]; + RealVector pq = crossings[ j ] - crossings[ii ]; if ( pq.squaredNorm() < 1e-8 ) continue; - positions.push_back( crossings[ i ] ); + positions.push_back( crossings[ ii ] ); edge_vectors.push_back( pq ); } } @@ -287,15 +281,11 @@ writeIsoLinesOBJ( std::string objfile, { typedef KhalimskySpaceND< 3, int > KSpace; typedef Shortcuts< KSpace > SH; - typedef typename SH::RealPoint RealPoint; typedef typename SH::RealPoints RealPoints; - typedef typename SH::RealVector RealVector; typedef typename SH::RealVectors RealVectors; - typedef typename SH::Colors Colors; RealPoints positions; RealVectors edge_vectors; - Scalar lengths = 0.0; Colors output_colors; // We have: (1-t)*v0 + t*v1 = v const auto t = [] ( Scalar v0, Scalar v1, Scalar v ) @@ -335,12 +325,12 @@ writeIsoLinesOBJ( std::string objfile, trace.warning() << "[SurfaceMeshWriter::writeIsoLinesOBJ]" << " Weird iso-line on face " << f << std::endl; else { - for ( Size i = 0; i < crossings.size(); ++i ) + for ( Size ii = 0; ii < crossings.size(); ++ii ) for ( Size j = i+1; j < crossings.size(); ++j ) { - RealVector pq = crossings[ j ] - crossings[ i ]; + RealVector pq = crossings[ j ] - crossings[ ii ]; if ( pq.squaredNorm() < 1e-8 ) continue; - positions.push_back( crossings[ i ] ); + positions.push_back( crossings[ ii ] ); edge_vectors.push_back( pq ); if ( ! diffuse_colors.empty() ) output_colors.push_back( diffuse_colors[ iso_i ] ); diff --git a/src/DGtal/kernel/BasicPointFunctors.h b/src/DGtal/kernel/BasicPointFunctors.h index 920f4705cd..684df29070 100755 --- a/src/DGtal/kernel/BasicPointFunctors.h +++ b/src/DGtal/kernel/BasicPointFunctors.h @@ -775,8 +775,8 @@ namespace functors * */ - FlipDomainAxis(const TDomain &aSourceDomain, const std::vector & axisFlipped): mySourceDomain(aSourceDomain), - myAxisFlipped(axisFlipped){ + FlipDomainAxis(const TDomain &aSourceDomain, const std::vector & axisFlipped): mySourceDomain(aSourceDomain), + myAxisFlipped(axisFlipped){ }; @@ -804,7 +804,7 @@ namespace functors private: TDomain mySourceDomain; - std::vector myAxisFlipped; + std::vector myAxisFlipped; }; diff --git a/src/DGtal/kernel/IntegerConverter.h b/src/DGtal/kernel/IntegerConverter.h index 02274bd707..d8d1199e43 100644 --- a/src/DGtal/kernel/IntegerConverter.h +++ b/src/DGtal/kernel/IntegerConverter.h @@ -57,7 +57,7 @@ namespace DGtal /// @param[inout] n the (initialized) big integer to set /// @param[in] sll a signed long long integer to assign to \a n. - static void mpz_set_sll(mpz_t n, long long sll) + static inline void mpz_set_sll(mpz_t n, long long sll) { mpz_set_si(n, (int)(sll >> 32)); /* n = (int)sll >> 32 */ mpz_mul_2exp(n, n, 32 ); /* n <<= 32 */ @@ -66,7 +66,7 @@ namespace DGtal /// @param[inout] n the (initialized) big integer to set /// @param[in] ull an unsigned long long integer to assign to \a n. - static void mpz_set_ull(mpz_t n, unsigned long long ull) + static inline void mpz_set_ull(mpz_t n, unsigned long long ull) { mpz_set_ui(n, (unsigned int)(ull >> 32)); /* n = (unsigned int)(ull >> 32) */ mpz_mul_2exp(n, n, 32); /* n <<= 32 */ @@ -76,15 +76,14 @@ namespace DGtal /// Conversion to uint64 is tricky and not native for GMP. /// @param n any number /// @return its uint64 representation. - static unsigned long long mpz_get_ull(mpz_t n) + static inline unsigned long long mpz_get_ull(mpz_t n) { - unsigned int lo, hi; mpz_t tmp; mpz_init( tmp ); mpz_mod_2exp( tmp, n, 64 ); /* tmp = (lower 64 bits of n) */ - lo = mpz_get_ui( tmp ); /* lo = tmp & 0xffffffff */ + auto lo = mpz_get_ui( tmp ); /* lo = tmp & 0xffffffff */ mpz_div_2exp( tmp, tmp, 32 ); /* tmp >>= 32 */ - hi = mpz_get_ui( tmp ); /* hi = tmp & 0xffffffff */ + auto hi = mpz_get_ui( tmp ); /* hi = tmp & 0xffffffff */ mpz_clear( tmp ); return (((unsigned long long)hi) << 32) + lo; } @@ -92,7 +91,7 @@ namespace DGtal /// Conversion to int64 is tricky and not native for GMP. /// @param n any number /// @return its int64 representation. - static long long mpz_get_sll(mpz_t n) + static inline long long mpz_get_sll(mpz_t n) { return (long long)mpz_get_ull(n); /* just use unsigned version */ } @@ -198,11 +197,11 @@ namespace DGtal /// @return the same integer static DGtal::int32_t cast( DGtal::BigInteger i ) { - DGtal::int32_t r = i.get_si(); + auto r = i.get_si(); if ( DGtal::BigInteger( r ) != i ) trace.warning() << "Bad integer conversion: " << i << " -> " << r << std::endl; - return r; + return (DGtal::int32_t)r; } /// Conversion of a lattice point. diff --git a/src/DGtal/kernel/IntegralIntervals.h b/src/DGtal/kernel/IntegralIntervals.h index 802a796b84..a0e939ff58 100644 --- a/src/DGtal/kernel/IntegralIntervals.h +++ b/src/DGtal/kernel/IntegralIntervals.h @@ -381,7 +381,7 @@ namespace DGtal Self starOfCells() const { Self R( *this ); - for ( auto i = 0; i < R.myData.size(); ) + for ( size_t i = 0; i < R.myData.size(); ) { auto& I = R.myData[ i ]; if ( ( I.first & 0x1 ) == 0 ) I.first -= 1; diff --git a/src/DGtal/kernel/PointVector.h b/src/DGtal/kernel/PointVector.h index 5ade9a44f5..04b341ebc7 100644 --- a/src/DGtal/kernel/PointVector.h +++ b/src/DGtal/kernel/PointVector.h @@ -719,7 +719,7 @@ namespace DGtal /** @brief * Destructor. */ - ~PointVector(); + ~PointVector() {} // ----------------------- Standard services ------------------------------ diff --git a/src/DGtal/kernel/PointVector.ih b/src/DGtal/kernel/PointVector.ih index dba8f0eec3..ab39cc4857 100644 --- a/src/DGtal/kernel/PointVector.ih +++ b/src/DGtal/kernel/PointVector.ih @@ -105,11 +105,6 @@ PointVector(const PointVector & apoint1, //------------------------------------------------------------------------------ template inline -DGtal::PointVector::~PointVector() -{} -//------------------------------------------------------------------------------ -template -inline DGtal::PointVector::PointVector( const Component * ptrValues ) { // The problem here is that we have no guaranty on the size of init !! diff --git a/src/DGtal/kernel/sets/DigitalSetInserter.h b/src/DGtal/kernel/sets/DigitalSetInserter.h index 7636d4e497..55f7b24f57 100644 --- a/src/DGtal/kernel/sets/DigitalSetInserter.h +++ b/src/DGtal/kernel/sets/DigitalSetInserter.h @@ -62,14 +62,20 @@ namespace DGtal * @tparam TDigitalSet any model of CDigitalSet */ template - class DigitalSetInserter: - public std::iterator + class DigitalSetInserter { BOOST_CONCEPT_ASSERT(( concepts::CDigitalSet )); // ----------------------- Standard services ------------------------------ public: + + using iterator_category = std::output_iterator_tag; + using value_type = void; + using difference_type = void; + using pointer = void; + using reference = void; + /** * Constructor. * @param aSet any digital set diff --git a/src/DGtal/math/LagrangeInterpolation.h b/src/DGtal/math/LagrangeInterpolation.h index b729718cc7..1248c72ae1 100644 --- a/src/DGtal/math/LagrangeInterpolation.h +++ b/src/DGtal/math/LagrangeInterpolation.h @@ -198,7 +198,7 @@ namespace DGtal /// polynomial). Polynomial basis( Size i ) const { - ASSERT( 0 <= i && i < size() ); + ASSERT( i < size() ); return myLagrangeBasis[ i ]; } diff --git a/src/DGtal/math/MPolynomial.h b/src/DGtal/math/MPolynomial.h index 5430831de7..18f5392127 100644 --- a/src/DGtal/math/MPolynomial.h +++ b/src/DGtal/math/MPolynomial.h @@ -43,6 +43,16 @@ /** Prevents repeated inclusion of headers. */ #define MPolynomial_h + +//David Coeurjolly: too many deprecation warnings +//There are pragma pop at the end of this file. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + + + ////////////////////////////////////////////////////////////////////////////// // Inclusions #include @@ -2086,6 +2096,10 @@ namespace DGtal // Includes inline functions. #include "DGtal/math/MPolynomial.ih" +#pragma GCC diagnostic pop +#pragma clang diagnostic pop + + // // /////////////////////////////////////////////////////////////////////////////// diff --git a/src/DGtal/math/OrderedLinearRegression.h b/src/DGtal/math/OrderedLinearRegression.h index 909e89e179..1448345d0e 100644 --- a/src/DGtal/math/OrderedLinearRegression.h +++ b/src/DGtal/math/OrderedLinearRegression.h @@ -167,7 +167,7 @@ namespace DGtal linearModel.computeRegression(); itx += n; ity += n; - unsigned int l = myX.size() - n + 1; + unsigned int l = (unsigned int)myX.size() - n + 1; for ( ; itx != itxe; ++itx, ++ity, --l ) { std::pair ic; @@ -210,7 +210,7 @@ namespace DGtal linearModel.computeRegression(); itx += n; ity += n; - unsigned int l = myX.size() - n + 1; + unsigned int l = static_cast(myX.size()) - n + 1; for ( ; itx != itxe; ++itx, ++ity, --l ) { std::pair ic; diff --git a/src/DGtal/math/linalg/CDenseMatrix.h b/src/DGtal/math/linalg/CDenseMatrix.h index 1719f1fe62..4235297774 100644 --- a/src/DGtal/math/linalg/CDenseMatrix.h +++ b/src/DGtal/math/linalg/CDenseMatrix.h @@ -94,16 +94,15 @@ struct CDenseMatrix : CMatrix BOOST_CONCEPT_USAGE( CDenseMatrix ) { - Scalar& aa = z(i, j); - aa = aa; // to avoid compiler warning - - checkConstConstraints(); + Scalar& aa = z(i, j); + (void)aa; // to avoid compiler warning + checkConstConstraints(); } void checkConstConstraints() const { - Scalar bb = z(i, j); - bb = bb; // to avoid compiler warning + Scalar bb = z(i, j); + (void)bb; // to avoid compiler warning } // ------------------------- Private Datas -------------------------------- diff --git a/src/DGtal/math/linalg/CDenseVector.h b/src/DGtal/math/linalg/CDenseVector.h index bbdafa946c..a981b69517 100644 --- a/src/DGtal/math/linalg/CDenseVector.h +++ b/src/DGtal/math/linalg/CDenseVector.h @@ -94,17 +94,17 @@ struct CDenseVector : CVector BOOST_CONCEPT_USAGE( CDenseVector ) { - Scalar& aa = z(i); - aa = aa; // to avoid compiler warning - - checkConstConstraints(); + Scalar& aa = z(i); + (void)aa; // to avoid compiler warning + + checkConstConstraints(); } void checkConstConstraints() const - { - Scalar bb = z(i); - bb = bb; // to avoid compiler warning - } + { + Scalar bb = z(i); + (void)bb; // to avoid compiler warning + } // ------------------------- Private Datas -------------------------------- private: diff --git a/src/DGtal/math/linalg/CVectorSpace.h b/src/DGtal/math/linalg/CVectorSpace.h index 57721f763c..77063ef851 100644 --- a/src/DGtal/math/linalg/CVectorSpace.h +++ b/src/DGtal/math/linalg/CVectorSpace.h @@ -76,7 +76,6 @@ namespace DGtal | Name | Expression | Type requirements | Return type | Precondition | Semantics | Post condition | Complexity | |-------|------------|-------------------|---------------|--------------|-----------|----------------|------------| - | Reset container content | \a z.clear() | | | | | | | | Addition | \a z = \a x + \a y | | \c VectorSpace | | | | | | Substraction | \a z = \a x - \a y | | \c VectorSpace | | | | | | External multiplication | \a z = \a a * \a x | | \c VectorSpace | | | | | @@ -100,7 +99,6 @@ namespace DGtal BOOST_CONCEPT_USAGE( CVectorSpace ) { - z.clear(); z = x + y; z = x - y; z = a * x; diff --git a/src/DGtal/math/linalg/EigenSupport.h b/src/DGtal/math/linalg/EigenSupport.h index 82673f5dcd..9660b90c1b 100644 --- a/src/DGtal/math/linalg/EigenSupport.h +++ b/src/DGtal/math/linalg/EigenSupport.h @@ -39,7 +39,6 @@ #define EigenSupport_h /** Prevents inclusion if Eigen support hasn't been enabled **/ -#if defined(WITH_EIGEN) ////////////////////////////////////////////////////////////////////////////// // Eigen API extensions @@ -144,9 +143,6 @@ namespace DGtal } // namespace DGtal -#else // defined WITH_EIGEN -#error "DGtal Eigen support hasn't been enabled" -#endif // defined WITH_EIGEN #endif // !defined EigenSupport_h #undef EigenSupport_RECURSES diff --git a/src/DGtal/shapes/MeshHelpers.ih b/src/DGtal/shapes/MeshHelpers.ih index 679c89c2e4..174a182dc7 100644 --- a/src/DGtal/shapes/MeshHelpers.ih +++ b/src/DGtal/shapes/MeshHelpers.ih @@ -158,8 +158,8 @@ Mesh< RealPoint >& mesh, const std::vector &cols ) bool hasColor = cols.size() == smesh.nbFaces(); for ( auto&& v : smesh.positions() ) mesh.addVertex( v ); - unsigned int i = 0; - for ( auto&& f : smesh.allIncidentVertices() ) + unsigned int i = 0; + for ( auto&& f : smesh.allIncidentVertices() ) { typename Mesh< RealPoint >::MeshFace face( f.cbegin(), f.cend() ); if (hasColor){ diff --git a/src/DGtal/shapes/MeshVoxelizer.h b/src/DGtal/shapes/MeshVoxelizer.h index dcffdde7ec..2095a84e45 100755 --- a/src/DGtal/shapes/MeshVoxelizer.h +++ b/src/DGtal/shapes/MeshVoxelizer.h @@ -154,7 +154,7 @@ namespace DGtal // ----------------------- Internal services ------------------------------ ///Enum type when deciding if a 2D point belongs to a 2D triangle. - enum TriangleOrientation { OUTSIDE, INSIDE, ONEDGE, ONVERTEX }; + enum TriangleOrientation { TRIANGLE_OUTSIDE, TRIANGLE_INSIDE, TRIANGLE_ONEDGE, TRIANGLE_ONVERTEX }; /** * Compute (unsigned) distance between @a p and the Euclidean plane diff --git a/src/DGtal/shapes/MeshVoxelizer.ih b/src/DGtal/shapes/MeshVoxelizer.ih index ece288ff54..fb2d8f8e94 100755 --- a/src/DGtal/shapes/MeshVoxelizer.ih +++ b/src/DGtal/shapes/MeshVoxelizer.ih @@ -76,13 +76,13 @@ DGtal::MeshVoxelizer::pointIsInside2DTriangle(const Poi if( ( val1 == 0. && val2 == 0. ) || ( val1 == 0. && val3 == 0. ) || ( val2 == 0. && val3 == 0. ) ) - return ONVERTEX; + return TRIANGLE_ONVERTEX; else if(val1 < 0. || val2 < 0. || val3 < 0.) - return OUTSIDE; + return TRIANGLE_OUTSIDE; else if(val1 == 0. || val2 == 0. || val3 == 0.) - return ONEDGE; + return TRIANGLE_ONEDGE; else - return INSIDE; + return TRIANGLE_INSIDE; } // --------------------------------------------------------- @@ -156,7 +156,7 @@ DGtal::MeshVoxelizer::voxelizeTriangle(DigitalSet &outp PointR2 pp = myIntersectionTarget.project(i, v); // check if current voxel projection is inside ABC projection - if(pointIsInside2DTriangle(AA, BB, CC, pp) != OUTSIDE) + if(pointIsInside2DTriangle(AA, BB, CC, pp) != TRIANGLE_OUTSIDE) { if (outputSet.domain().isInside( v ) ) outputSet.insert(v); @@ -226,11 +226,11 @@ DGtal::MeshVoxelizer::voxelize(DigitalSet &outputSet, #ifdef WITH_OPENMP #pragma omp parallel for schedule(dynamic) #endif - for(unsigned int i = 0; i < aMesh.nbFaces(); i++) + for(int i = 0; i < (int)aMesh.nbFaces(); i++) { DigitalSet currentSet{rawEmpty}; MeshFace currentFace = aMesh.getFace(i); - for(unsigned int j=0; j + 2 < currentFace.size(); ++j) + for(size_t j=0; j + 2 < currentFace.size(); ++j) { voxelize(currentSet, aMesh.getVertex(currentFace[0]), aMesh.getVertex(currentFace[j+1]), diff --git a/src/DGtal/shapes/PolygonalSurface.ih b/src/DGtal/shapes/PolygonalSurface.ih index e60950e96a..535d31c983 100644 --- a/src/DGtal/shapes/PolygonalSurface.ih +++ b/src/DGtal/shapes/PolygonalSurface.ih @@ -133,7 +133,7 @@ inline typename DGtal::PolygonalSurface::Point& DGtal::PolygonalSurface::position( Vertex v ) { - ASSERT( 0 <= v && v < myPositions.size() ); + ASSERT( v < myPositions.size() ); return myPositions[ v ]; } //----------------------------------------------------------------------------- @@ -142,7 +142,7 @@ inline const typename DGtal::PolygonalSurface::Point& DGtal::PolygonalSurface::position( Vertex v ) const { - ASSERT( 0 <= v && v < myPositions.size() ); + ASSERT( v < myPositions.size() ); return myPositions[ v ]; } //----------------------------------------------------------------------------- diff --git a/src/DGtal/shapes/SurfaceMeshHelper.ih b/src/DGtal/shapes/SurfaceMeshHelper.ih index 59a055e9f5..c1e90860c1 100644 --- a/src/DGtal/shapes/SurfaceMeshHelper.ih +++ b/src/DGtal/shapes/SurfaceMeshHelper.ih @@ -179,7 +179,7 @@ sphereSecondPrincipalCurvatures( const Scalar radius, Size m, Size n ) template typename DGtal::SurfaceMeshHelper::RealVectors DGtal::SurfaceMeshHelper:: -sphereFirstPrincipalDirections( const Scalar radius, Size m, Size n ) +sphereFirstPrincipalDirections( const Scalar , Size m, Size n ) { // since the sphere is made of umbilic points, returned directions // are arbitrary tangent vectors. Here we return latitude vectors. @@ -210,7 +210,7 @@ sphereFirstPrincipalDirections( const Scalar radius, Size m, Size n ) template typename DGtal::SurfaceMeshHelper::RealVectors DGtal::SurfaceMeshHelper:: -sphereSecondPrincipalDirections( const Scalar radius, Size m, Size n ) +sphereSecondPrincipalDirections( const Scalar , Size m, Size n ) { // since the sphere is made of umbilic points, returned directions // are arbitrary tangent vectors. Here we return latitude vectors. @@ -290,9 +290,9 @@ makeLantern( const Scalar radius, const Scalar height, const RealPoint& center, std::vector< RealVector > vnormals( nbv ); for ( Size k = 0; k < nbv; ++k ) { - RealVector n = p[ k ] - center; - n[ 2 ] = 0.0; - vnormals[ k ] = n.getNormalized(); + RealVector _n = p[ k ] - center; + _n[ 2 ] = 0.0; + vnormals[ k ] = _n.getNormalized(); } smesh.setVertexNormals( vnormals.cbegin(), vnormals.cend() ); } @@ -301,9 +301,9 @@ makeLantern( const Scalar radius, const Scalar height, const RealPoint& center, std::vector< RealVector > fnormals( smesh.nbFaces() ); for ( Size k = 0; k < fnormals.size(); ++k ) { - RealVector n = smesh.faceCentroid( k ) - center; - n[ 2 ] = 0.0; - fnormals[ k ] = n.getNormalized(); + RealVector _n = smesh.faceCentroid( k ) - center; + _n[ 2 ] = 0.0; + fnormals[ k ] = _n.getNormalized(); } smesh.setFaceNormals( fnormals.cbegin(), fnormals.cend() ); } @@ -328,6 +328,7 @@ typename DGtal::SurfaceMeshHelper::Scalars DGtal::SurfaceMeshHelper:: lanternGaussianCurvatures( const Scalar radius, Size m, Size n ) { + (void)radius; //unused param. n = std::max( n, (Size)2 ); // nb latitudes m = std::max( m, (Size)3 ); // nb longitudes const Size nbv = n * m; @@ -340,6 +341,7 @@ typename DGtal::SurfaceMeshHelper::Scalars DGtal::SurfaceMeshHelper:: lanternFirstPrincipalCurvatures( const Scalar radius, Size m, Size n ) { + (void)radius; //unused param. m = std::max( m, (Size)2 ); // nb latitudes n = std::max( n, (Size)3 ); // nb longitudes // vertices are numbered as follows @@ -357,6 +359,7 @@ typename DGtal::SurfaceMeshHelper::Scalars DGtal::SurfaceMeshHelper:: lanternSecondPrincipalCurvatures( const Scalar radius, Size m, Size n ) { + (void)radius; //unused param. m = std::max( m, (Size)2 ); // nb latitudes n = std::max( n, (Size)3 ); // nb longitudes // vertices are numbered as follows @@ -374,6 +377,7 @@ typename DGtal::SurfaceMeshHelper::RealVectors DGtal::SurfaceMeshHelper:: lanternFirstPrincipalDirections( const Scalar radius, Size m, Size n ) { + (void)radius; //unused param. m = std::max( m, (Size)2 ); // nb latitudes n = std::max( n, (Size)3 ); // nb longitudes // vertices are numbered as follows @@ -392,6 +396,7 @@ typename DGtal::SurfaceMeshHelper::RealVectors DGtal::SurfaceMeshHelper:: lanternSecondPrincipalDirections( const Scalar radius, Size m, Size n ) { + (void)radius; //unused param. m = std::max( m, (Size)2 ); // nb latitudes n = std::max( n, (Size)3 ); // nb longitudes // vertices are numbered as follows @@ -587,6 +592,10 @@ DGtal::SurfaceMeshHelper:: torusFirstPrincipalDirections( const Scalar big_radius, const Scalar small_radius, Size m, Size n, const int twist ) { + (void)big_radius;//not used + (void)small_radius; + (void)twist; + m = std::max( m, (Size)3 ); // nb latitudes n = std::max( n, (Size)3 ); // nb longitudes // vertices are numbered as follows @@ -613,6 +622,9 @@ DGtal::SurfaceMeshHelper:: torusSecondPrincipalDirections( const Scalar big_radius, const Scalar small_radius, Size m, Size n, const int twist ) { + (void)big_radius; //not used + (void)small_radius; //not used + m = std::max( m, (Size)3 ); // nb latitudes n = std::max( n, (Size)3 ); // nb longitudes // vertices are numbered as follows diff --git a/src/DGtal/shapes/TriangulatedSurface.ih b/src/DGtal/shapes/TriangulatedSurface.ih index 90b38473f4..f440479a89 100644 --- a/src/DGtal/shapes/TriangulatedSurface.ih +++ b/src/DGtal/shapes/TriangulatedSurface.ih @@ -100,7 +100,7 @@ inline typename DGtal::TriangulatedSurface::Point& DGtal::TriangulatedSurface::position( Vertex v ) { - ASSERT( 0 <= v && v < myPositions.size() ); + ASSERT( v < myPositions.size() ); return myPositions[ v ]; } //----------------------------------------------------------------------------- @@ -109,7 +109,7 @@ inline const typename DGtal::TriangulatedSurface::Point& DGtal::TriangulatedSurface::position( Vertex v ) const { - ASSERT( 0 <= v && v < myPositions.size() ); + ASSERT( v < myPositions.size() ); return myPositions[ v ]; } //----------------------------------------------------------------------------- diff --git a/src/DGtal/topology/CubicalComplexFunctions.ih b/src/DGtal/topology/CubicalComplexFunctions.ih index ca37f1db03..d6b47dd25f 100644 --- a/src/DGtal/topology/CubicalComplexFunctions.ih +++ b/src/DGtal/topology/CubicalComplexFunctions.ih @@ -65,8 +65,6 @@ collapse( CubicalComplex< TKSpace, TCellContainer > & K, CellMapIterator it_cell; // generic iterator on a cell. CellMapIterator it_cell_c; // points on c in the free pair (c,d) CellMapIterator it_cell_d; // points on d in the free pair (c,d) - CMIVectorConstIterator itlow; - CMIVectorConstIterator itqup; if ( verbose ) trace.info() << "[CC::collapse]-+ tag collapsible elements... " << flush; // Restricts the set of elements that are collapsible. diff --git a/src/DGtal/topology/VoxelComplex.ih b/src/DGtal/topology/VoxelComplex.ih index 0b8e429853..1bb0136509 100644 --- a/src/DGtal/topology/VoxelComplex.ih +++ b/src/DGtal/topology/VoxelComplex.ih @@ -814,8 +814,7 @@ typename DGtal::VoxelComplex::CliqueContainer DGtal::VoxelComplex::criticalCliquesForD( const Dimension d, const Parent &cubical, bool verbose) const { -#ifdef WITH_OPENMP - +#if defined(WITH_OPENMP) && !defined(WIN32) ASSERT(dimension >= 0 && dimension <= 3); CliqueContainer critical; diff --git a/src/DGtal/topology/VoxelComplexFunctions.ih b/src/DGtal/topology/VoxelComplexFunctions.ih index 5c50e418b0..53e80f67ad 100644 --- a/src/DGtal/topology/VoxelComplexFunctions.ih +++ b/src/DGtal/topology/VoxelComplexFunctions.ih @@ -199,7 +199,7 @@ persistenceAsymetricThinningScheme( x_y.copySimplicityTable(vc); bool stability{false}; - uint64_t generation{0}; + unsigned int generation{0}; auto xsize = X.nbCells(3); auto xsize_old = xsize; const bool close_it = true; diff --git a/tests/arithmetic/testLightSternBrocot.cpp b/tests/arithmetic/testLightSternBrocot.cpp index f27000acf7..c10a1f74c1 100644 --- a/tests/arithmetic/testLightSternBrocot.cpp +++ b/tests/arithmetic/testLightSternBrocot.cpp @@ -52,7 +52,7 @@ template bool equalCFrac( const std::vector & c1, const std::vector & c2 ) { - unsigned int s = c1.size() < c2.size() ? c1.size() : c2.size(); + auto s = c1.size() < c2.size() ? c1.size() : c2.size(); if ( ( s != c1.size() ) && ( c1.back() != NumberTraits::ONE ) ) return false; if ( ( s != c2.size() ) && ( c2.back() != NumberTraits::ONE ) ) @@ -84,8 +84,8 @@ bool testReducedFraction() p /= g; q /= g; IntegerComputer ics; - Quotient sp = NumberTraits::castToInt64_t( p ); - Quotient sq = NumberTraits::castToInt64_t( q ); + Quotient sp = (Quotient)NumberTraits::castToInt64_t( p ); + Quotient sq = (Quotient)NumberTraits::castToInt64_t( q ); std::vector cf1; ics.getCFrac( cf1, sp, sq ); Fraction f1 = SB::fraction( p, q ); @@ -100,8 +100,8 @@ bool testReducedFraction() trace.info() << "(" << nbok << "/" << nb << ") " << " cfrac" << std::endl; - unsigned int depth = cf1.size(); - for ( unsigned int k = 1; k < depth; ++k ) + size_t depth = cf1.size(); + for ( size_t k = 1; k < depth; ++k ) { std::vector cf1_red; Fraction fr = f1.reduced( k ); diff --git a/tests/arithmetic/testLighterSternBrocot.cpp b/tests/arithmetic/testLighterSternBrocot.cpp index ba7731c450..164b1a5906 100644 --- a/tests/arithmetic/testLighterSternBrocot.cpp +++ b/tests/arithmetic/testLighterSternBrocot.cpp @@ -55,7 +55,7 @@ template bool equalCFrac( const std::vector & c1, const std::vector & c2 ) { - unsigned int s = c1.size() < c2.size() ? c1.size() : c2.size(); + auto s = c1.size() < c2.size() ? c1.size() : c2.size(); if ( ( s != c1.size() ) && ( c1.back() != NumberTraits::ONE ) ) return false; if ( ( s != c2.size() ) && ( c2.back() != NumberTraits::ONE ) ) @@ -87,8 +87,8 @@ bool testReducedFraction() p /= g; q /= g; IntegerComputer ics; - Quotient sp = NumberTraits::castToInt64_t( p ); - Quotient sq = NumberTraits::castToInt64_t( q ); + Quotient sp = (Quotient)NumberTraits::castToInt64_t( p ); + Quotient sq = (Quotient)NumberTraits::castToInt64_t( q ); std::vector cf1; ics.getCFrac( cf1, sp, sq ); Fraction f1 = SB::fraction( p, q ); @@ -103,7 +103,7 @@ bool testReducedFraction() trace.info() << "(" << nbok << "/" << nb << ") " << " cfrac" << std::endl; - unsigned int depth = cf1.size(); + const auto depth = cf1.size(); for ( unsigned int k = 1; k < depth; ++k ) { std::vector cf1_red; diff --git a/tests/arithmetic/testSternBrocot.cpp b/tests/arithmetic/testSternBrocot.cpp index f7dbc43275..cac7814c10 100644 --- a/tests/arithmetic/testSternBrocot.cpp +++ b/tests/arithmetic/testSternBrocot.cpp @@ -99,7 +99,7 @@ bool testReducedFraction() trace.info() << "(" << nbok << "/" << nb << ") " << " cfrac" << std::endl; - unsigned int depth = cf1.size(); + unsigned int depth = (unsigned int)cf1.size(); for ( unsigned int k = 1; k < depth; ++k ) { std::vector cf1_red; diff --git a/tests/dec/CMakeLists.txt b/tests/dec/CMakeLists.txt index 82d09a3b50..ddeb51b911 100644 --- a/tests/dec/CMakeLists.txt +++ b/tests/dec/CMakeLists.txt @@ -1,6 +1,5 @@ set(DGTAL_TESTS_SRC - testDiscreteExteriorCalculus - testLinearStructure + testDiscreteExteriorCalculus testEmbedding testHeatLaplace testPolygonalCalculus @@ -11,7 +10,7 @@ set(DGTAL_TESTS_SRC # add_test is disabled for the following sources set(DGTAL_TESTS_SRC_NOTEST testDiscreteExteriorCalculusExtended - ) + testLinearStructure) if(WITH_EIGEN) foreach(FILE ${DGTAL_TESTS_SRC}) diff --git a/tests/dec/testGeodesicsInHeat.cpp b/tests/dec/testGeodesicsInHeat.cpp index 3b5949d170..eac6af3388 100644 --- a/tests/dec/testGeodesicsInHeat.cpp +++ b/tests/dec/testGeodesicsInHeat.cpp @@ -82,7 +82,7 @@ TEST_CASE( "Testing GeodesicsInHeat" ) heat.addSource(0); GeodesicsInHeat>::Vector d = heat.compute(); - REQUIRE( d.size() == positions.size() ); + REQUIRE( (size_t)d.size() == (size_t)positions.size() ); REQUIRE( d[5] == Approx(1.444608) ); heat.clearSource(); auto sources = heat.source(); diff --git a/tests/dec/testLinearStructure.cpp b/tests/dec/testLinearStructure.cpp index fef06f9077..ee715b8ac3 100644 --- a/tests/dec/testLinearStructure.cpp +++ b/tests/dec/testLinearStructure.cpp @@ -50,7 +50,6 @@ void test_linear_structure() //! [neumann-creation] typedef DiscreteExteriorCalculus<1, 2, EigenLinearAlgebraBackend> Calculus; - typedef std::list SCells; SCells cells; // fill cells container @@ -322,7 +321,7 @@ void test_linear_ring() const Calculus::PrimalIdentity0 laplace = calculus.laplace(); display_operator_info("laplace", laplace); - const int laplace_size = calculus.kFormLength(0, PRIMAL); + const auto laplace_size = calculus.kFormLength(0, PRIMAL); const Eigen::MatrixXd laplace_dense(laplace.myContainer); for (int ii=0; ii::SparseMatrix M = boxCalculus.globalLumpedMassMatrix(); double a=0.0; - for(auto v=0; v < box.nbVertices(); ++v ) + for( PolygonalCalculus< RealPoint,RealVector >::MySurfaceMesh::Index v=0; v < box.nbVertices(); ++v ) a += M.coeffRef(v,v); double fa=0.0; - for(auto f=0; f < box.nbFaces(); ++f ) + for( PolygonalCalculus< RealPoint,RealVector >::MySurfaceMesh::Index f=0; f < box.nbFaces(); ++f ) fa += box.faceArea(f); REQUIRE( a == fa ); } @@ -298,7 +298,7 @@ TEST_CASE( "Testing PolygonalCalculus and DirichletConditions" ) std::vector > faces; std::vector positions = primalSurface->positions(); - for(auto face= 0 ; face < primalSurface->nbFaces(); ++face) + for( PolygonalCalculus< RealPoint,RealVector >::MySurfaceMesh::Index face= 0 ; face < primalSurface->nbFaces(); ++face) faces.push_back(primalSurface->incidentVertices( face )); Mesh surfmesh = Mesh( positions.begin(), positions.end(), @@ -357,9 +357,7 @@ TEST_CASE( "Testing PolygonalCalculus and DirichletConditions" ) double max_u = 0.0; double min_i_u = 0.0; double max_i_u = 0.0; - double exp_u = 0.0; - double exp_u2 = 0.0; - for ( auto v = 0; v < surfmesh.nbVertices(); ++v ) + for ( PolygonalCalculus< RealPoint,RealVector >::MySurfaceMesh::Index v = 0; v < surfmesh.nbVertices(); ++v ) { min_phi = std::min( min_phi, phi( v ) ); max_phi = std::max( max_phi, phi( v ) ); diff --git a/tests/geometry/curves/estimation/testEstimatorComparator.cpp b/tests/geometry/curves/estimation/testEstimatorComparator.cpp index faaebe136c..b57cc1aeaa 100644 --- a/tests/geometry/curves/estimation/testEstimatorComparator.cpp +++ b/tests/geometry/curves/estimation/testEstimatorComparator.cpp @@ -74,7 +74,6 @@ bool testCompareEstimator(const std::string &name, const Shape & aShape, double + name ). c_str() ); // Creates a digitizer on the window (xLow, xUp). - typedef Space::RealPoint RealPoint; RealPoint xLow( -10.0, -10.0 ); RealPoint xUp( 10.0, 10.0 ); GaussDigitizer dig; diff --git a/tests/geometry/curves/estimation/testTrueLocalEstimator.cpp b/tests/geometry/curves/estimation/testTrueLocalEstimator.cpp index 8acd16ee1c..10636d4d3a 100644 --- a/tests/geometry/curves/estimation/testTrueLocalEstimator.cpp +++ b/tests/geometry/curves/estimation/testTrueLocalEstimator.cpp @@ -130,7 +130,6 @@ testTrueLocalEstimatorOnShapeDigitization( const string & name, + name ). c_str() ); // Creates a digitizer on the window (xLow, xUp). - typedef Space::RealPoint RealPoint; RealPoint xLow( -10.0, -10.0 ); RealPoint xUp( 10.0, 10.0 ); GaussDigitizer dig; diff --git a/tests/geometry/curves/testCombinDSS.cpp b/tests/geometry/curves/testCombinDSS.cpp index 435b5a6f82..4c13321562 100644 --- a/tests/geometry/curves/testCombinDSS.cpp +++ b/tests/geometry/curves/testCombinDSS.cpp @@ -57,7 +57,6 @@ using namespace Z2i; typedef FreemanChain Contour; -typedef FreemanChain::Vector Vector; diff --git a/tests/geometry/curves/testFrechetShortcut.cpp b/tests/geometry/curves/testFrechetShortcut.cpp index 50c356150d..612ea10f69 100644 --- a/tests/geometry/curves/testFrechetShortcut.cpp +++ b/tests/geometry/curves/testFrechetShortcut.cpp @@ -160,7 +160,6 @@ bool testSegmentation() trace.beginBlock ( "Testing block ..." ); - typedef GridCurve< KhalimskySpaceND< 2, int > > Curve; typedef Curve::PointsRange::ConstIterator Iterator; typedef FrechetShortcut SegmentComputer; diff --git a/tests/geometry/curves/testStabbingCircleComputer.cpp b/tests/geometry/curves/testStabbingCircleComputer.cpp index e8184b4def..cb7a3566c2 100644 --- a/tests/geometry/curves/testStabbingCircleComputer.cpp +++ b/tests/geometry/curves/testStabbingCircleComputer.cpp @@ -83,13 +83,8 @@ void ballGenerator(const TKSpace& aKSpace, GridCurve& aGC, const Intege // Types typedef TKSpace KSpace; typedef typename KSpace::SCell SCell; - typedef GridCurve GridCurve; - typedef typename KSpace::Space Space; - typedef Ball2D Shape; + typedef typename KSpace::Space Space; typedef typename Space::Point Point; - typedef typename Space::RealPoint RealPoint; - typedef HyperRectDomain Domain; - typedef typename Point::Component Component; MyBallPredicate predicate(aR); try diff --git a/tests/geometry/meshes/testCorrectedNormalCurrentComputer.cpp b/tests/geometry/meshes/testCorrectedNormalCurrentComputer.cpp index 6ce725905c..46e0d7d500 100644 --- a/tests/geometry/meshes/testCorrectedNormalCurrentComputer.cpp +++ b/tests/geometry/meshes/testCorrectedNormalCurrentComputer.cpp @@ -238,7 +238,7 @@ SCENARIO( "CorrectedNormalCurrentComputer ICNC convergence tests", "[icnc][conve } double sphere_area = 4.0 * M_PI; for ( auto & v : errors_mu0 ) v = fabs( v - sphere_area ) / sphere_area; - for ( auto i = 0; i < errors_mu0.size()-1; i++ ) { + for ( auto i = 0; i < (int)errors_mu0.size()-1; i++ ) { REQUIRE( errors_mu0[ i+1 ] < errors_mu0[ i ] ); } } @@ -256,7 +256,7 @@ SCENARIO( "CorrectedNormalCurrentComputer ICNC convergence tests", "[icnc][conve } double sphere_twice_mc = 8.0 * M_PI; for ( auto & v : errors_mu1 ) v = fabs( v - sphere_twice_mc ) / sphere_twice_mc; - for ( auto i = 0; i < errors_mu1.size()-1; i++ ) { + for ( auto i = 0; i < (int)errors_mu1.size()-1; i++ ) { REQUIRE( errors_mu1[ i+1 ] < errors_mu1[ i ] ); } } @@ -274,7 +274,7 @@ SCENARIO( "CorrectedNormalCurrentComputer ICNC convergence tests", "[icnc][conve } double sphere_gauss_c = 4.0 * M_PI; for ( auto & v : errors_mu2 ) v = fabs( v - sphere_gauss_c ) / sphere_gauss_c; - for ( auto i = 0; i < errors_mu2.size()-1; i++ ) { + for ( auto i = 0; i < (int)errors_mu2.size()-1; i++ ) { REQUIRE( errors_mu2[ i+1 ] < errors_mu2[ i ] ); } } @@ -301,7 +301,7 @@ SCENARIO( "CorrectedNormalCurrentComputer CCNC convergence tests", "[ccnc][conve } double sphere_area = 4.0 * M_PI; for ( auto & v : errors_mu0 ) v = fabs( v - sphere_area ) / sphere_area; - for ( auto i = 0; i < errors_mu0.size()-1; i++ ) { + for ( auto i = 0; i < (int)errors_mu0.size()-1; i++ ) { REQUIRE( errors_mu0[ i+1 ] < errors_mu0[ i ] ); } } @@ -319,7 +319,7 @@ SCENARIO( "CorrectedNormalCurrentComputer CCNC convergence tests", "[ccnc][conve } double sphere_twice_mc = 8.0 * M_PI; for ( auto & v : errors_mu1 ) v = fabs( v - sphere_twice_mc ) / sphere_twice_mc; - for ( auto i = 0; i < errors_mu1.size()-1; i++ ) { + for ( auto i = 0; i < (int)errors_mu1.size()-1; i++ ) { REQUIRE( errors_mu1[ i+1 ] < errors_mu1[ i ] ); } } diff --git a/tests/geometry/meshes/testNormalCycleComputer.cpp b/tests/geometry/meshes/testNormalCycleComputer.cpp index 0d6766601d..29ac868e25 100644 --- a/tests/geometry/meshes/testNormalCycleComputer.cpp +++ b/tests/geometry/meshes/testNormalCycleComputer.cpp @@ -132,7 +132,7 @@ SCENARIO( "NormalCycleComputer convergence tests", "[nc][convergence]" ) } double sphere_area = 4.0 * M_PI; for ( auto & v : errors_mu0 ) v = fabs( v - sphere_area ) / sphere_area; - for ( auto i = 0; i < errors_mu0.size()-1; i++ ) { + for ( auto i = 0; i < (int)errors_mu0.size()-1; i++ ) { REQUIRE( errors_mu0[ i+1 ] < errors_mu0[ i ] ); } } @@ -150,7 +150,7 @@ SCENARIO( "NormalCycleComputer convergence tests", "[nc][convergence]" ) } double sphere_twice_mc = 8.0 * M_PI; for ( auto & v : errors_mu1 ) v = fabs( v - sphere_twice_mc ) / sphere_twice_mc; - for ( auto i = 0; i < errors_mu1.size()-1; i++ ) { + for ( auto i = 0; i < (int)errors_mu1.size()-1; i++ ) { REQUIRE( errors_mu1[ i+1 ] < errors_mu1[ i ] ); } } @@ -168,7 +168,7 @@ SCENARIO( "NormalCycleComputer convergence tests", "[nc][convergence]" ) } double sphere_gauss_c = 4.0 * M_PI; for ( auto & v : errors_mu2 ) v = fabs( v - sphere_gauss_c ) / sphere_gauss_c; - for ( auto i = 0; i < errors_mu2.size(); i++ ) { + for ( size_t i = 0; i < errors_mu2.size(); i++ ) { REQUIRE( errors_mu2[ i ] == Approx( 0.0 ).margin( 1e-8 ) ); } } diff --git a/tests/geometry/surfaces/testCOBAGenericNaivePlaneComputer-benchmark.cpp b/tests/geometry/surfaces/testCOBAGenericNaivePlaneComputer-benchmark.cpp index d2e53024ca..686911aff1 100644 --- a/tests/geometry/surfaces/testCOBAGenericNaivePlaneComputer-benchmark.cpp +++ b/tests/geometry/surfaces/testCOBAGenericNaivePlaneComputer-benchmark.cpp @@ -81,7 +81,7 @@ checkGenericPlane( Integer a, Integer b, Integer c, Integer d, unsigned int nb = 0; unsigned int nbok = 0; unsigned int nbchanges = 0; - unsigned int complexity = plane.complexity(); + auto complexity = plane.complexity(); while ( nb != nbpoints ) { p[ 0 ] = getRandomInteger( -diameter+1, diameter ); @@ -91,9 +91,9 @@ checkGenericPlane( Integer a, Integer b, Integer c, Integer d, y = (Integer) p[ 1 ]; z = (Integer) p[ 2 ]; switch ( axis ) { - case 0: p[ 0 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; - case 1: p[ 1 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; - case 2: p[ 2 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; + case 0: p[ 0 ] = static_cast(NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) )); break; + case 1: p[ 1 ] = static_cast(NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) )); break; + case 2: p[ 2 ] = static_cast(NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ))); break; } bool ok = plane.extend( p ); // should be ok ++nb; nbok += ok ? 1 : 0; diff --git a/tests/geometry/surfaces/testCOBANaivePlaneComputer.cpp b/tests/geometry/surfaces/testCOBANaivePlaneComputer.cpp index 92c093033e..6e72e180ea 100644 --- a/tests/geometry/surfaces/testCOBANaivePlaneComputer.cpp +++ b/tests/geometry/surfaces/testCOBANaivePlaneComputer.cpp @@ -285,7 +285,6 @@ bool testCOBANaivePlaneComputer() unsigned int nbok = 0; unsigned int nb = 0; using namespace Z3i; - typedef BigInteger Integer; typedef COBANaivePlaneComputer NaivePlaneComputer; typedef COBAGenericNaivePlaneComputer GenericNaivePlaneComputer; diff --git a/tests/geometry/surfaces/testChordNaivePlaneComputer-benchmark.cpp b/tests/geometry/surfaces/testChordNaivePlaneComputer-benchmark.cpp index 9231533530..22a43fab49 100644 --- a/tests/geometry/surfaces/testChordNaivePlaneComputer-benchmark.cpp +++ b/tests/geometry/surfaces/testChordNaivePlaneComputer-benchmark.cpp @@ -89,9 +89,9 @@ checkPlane( Integer a, Integer b, Integer c, Integer d, y = (Integer) p[ 1 ]; z = (Integer) p[ 2 ]; switch ( axis ) { - case 0: p[ 0 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; - case 1: p[ 1 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; - case 2: p[ 2 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; + case 0: p[ 0 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; + case 1: p[ 1 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; + case 2: p[ 2 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; } bool ok = plane.extend( p ); // should be ok ++nb; nbok += ok ? 1 : 0; diff --git a/tests/geometry/surfaces/testChordNaivePlaneComputer.cpp b/tests/geometry/surfaces/testChordNaivePlaneComputer.cpp index 868d527346..dcaef8091f 100644 --- a/tests/geometry/surfaces/testChordNaivePlaneComputer.cpp +++ b/tests/geometry/surfaces/testChordNaivePlaneComputer.cpp @@ -90,9 +90,9 @@ checkPlane( Integer a, Integer b, Integer c, Integer d, y = (Integer) p[ 1 ]; z = (Integer) p[ 2 ]; switch ( axis ) { - case 0: p[ 0 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; - case 1: p[ 1 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; - case 2: p[ 2 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; + case 0: p[ 0 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; + case 1: p[ 1 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; + case 2: p[ 2 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; } bool ok_ext = plane.isExtendable( p ); // should be ok bool ok = plane.extend( p ); // should be ok @@ -132,9 +132,9 @@ checkPlane( Integer a, Integer b, Integer c, Integer d, y = (Integer) p[ 1 ]; z = (Integer) p[ 2 ]; switch ( axis ) { - case 0: p[ 0 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; - case 1: p[ 1 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; - case 2: p[ 2 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; + case 0: p[ 0 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; + case 1: p[ 1 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; + case 2: p[ 2 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; } PointInteger tmp = getRandomInteger( 2, 5 ) * (2*getRandomInteger( 0, 2 ) - 1 ); @@ -200,11 +200,11 @@ checkPlaneGroupExtension( Integer a, Integer b, Integer c, Integer d, y = (Integer) pp[ 1 ]; z = (Integer) pp[ 2 ]; switch ( axis ) { - case 0: pp[ 0 ] = NumberTraits::castToInt64_t + case 0: pp[ 0 ] = (PointInteger)NumberTraits::castToInt64_t ( ic.ceilDiv( d - b * y - c * z, a ) ); break; - case 1: pp[ 1 ] = NumberTraits::castToInt64_t + case 1: pp[ 1 ] = (PointInteger)NumberTraits::castToInt64_t ( ic.ceilDiv( d - a * x - c * z, b ) ); break; - case 2: pp[ 2 ] = NumberTraits::castToInt64_t + case 2: pp[ 2 ] = (PointInteger)NumberTraits::castToInt64_t ( ic.ceilDiv( d - a * x - b * y, c ) ); break; } } @@ -246,9 +246,9 @@ checkPlaneGroupExtension( Integer a, Integer b, Integer c, Integer d, y = (Integer) p[ 1 ]; z = (Integer) p[ 2 ]; switch ( axis ) { - case 0: p[ 0 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; - case 1: p[ 1 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; - case 2: p[ 2 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; + case 0: p[ 0 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; + case 1: p[ 1 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; + case 2: p[ 2 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; } PointInteger tmp = getRandomInteger( 2, 5 ) * (2*getRandomInteger( 0, 2 ) - 1 ); @@ -312,9 +312,9 @@ checkGenericPlane( Integer a, Integer b, Integer c, Integer d, y = (Integer) p[ 1 ]; z = (Integer) p[ 2 ]; switch ( axis ) { - case 0: p[ 0 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; - case 1: p[ 1 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; - case 2: p[ 2 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; + case 0: p[ 0 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; + case 1: p[ 1 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; + case 2: p[ 2 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; } bool ok_ext = plane.isExtendable( p ); // should be ok bool ok = plane.extend( p ); // should be ok @@ -354,9 +354,9 @@ checkGenericPlane( Integer a, Integer b, Integer c, Integer d, y = (Integer) p[ 1 ]; z = (Integer) p[ 2 ]; switch ( axis ) { - case 0: p[ 0 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; - case 1: p[ 1 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; - case 2: p[ 2 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; + case 0: p[ 0 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; + case 1: p[ 1 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; + case 2: p[ 2 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; } PointInteger tmp = getRandomInteger( 2, 5 ) * (2*getRandomInteger( 0, 2 ) - 1 ); @@ -428,6 +428,7 @@ checkWidth( Integer a, Integer b, Integer c, Integer d, { typedef typename NaivePlaneComputer::Point Point; typedef typename NaivePlaneComputer::InternalScalar InternalScalar; + typedef typename Point::Component PointInteger; IntegerComputer ic; Integer absA = ic.abs( a ); Integer absB = ic.abs( b ); @@ -454,9 +455,9 @@ checkWidth( Integer a, Integer b, Integer c, Integer d, y = (Integer) p[ 1 ]; z = (Integer) p[ 2 ]; switch ( axis ) { - case 0: p[ 0 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; - case 1: p[ 1 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; - case 2: p[ 2 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; + case 0: p[ 0 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; + case 1: p[ 1 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; + case 2: p[ 2 ] = (PointInteger)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; } } trace.beginBlock( "Computing axis width." ); @@ -728,9 +729,9 @@ checkExtendWithManyPoints( unsigned int diameter, Integer y = (Integer) p[ 1 ]; Integer z = (Integer) p[ 2 ]; switch( axis ) { - case 0: p[ 0 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; - case 1: p[ 1 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; - case 2: p[ 2 ] = NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; + case 0: p[ 0 ] = (Integer)NumberTraits::castToInt64_t( ic.ceilDiv( d - b * y - c * z, a ) ); break; + case 1: p[ 1 ] = (Integer)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - c * z, b ) ); break; + case 2: p[ 2 ] = (Integer)NumberTraits::castToInt64_t( ic.ceilDiv( d - a * x - b * y, c ) ); break; } pts.push_back( p ); } diff --git a/tests/geometry/surfaces/testDigitalSurfaceRegularization.cpp b/tests/geometry/surfaces/testDigitalSurfaceRegularization.cpp index aec980b142..ca5968b9cb 100644 --- a/tests/geometry/surfaces/testDigitalSurfaceRegularization.cpp +++ b/tests/geometry/surfaces/testDigitalSurfaceRegularization.cpp @@ -183,7 +183,7 @@ TEST_CASE( "Testing DigitalSurfaceRegularization" ) //Same with higher data attachment for x < 0.0 //! [DigitalRegLocal] DigitalSurfaceRegularization regul3(surface); - for(auto i = 0 ; i < original.size(); ++i) + for(size_t i = 0 ; i < original.size(); ++i) if (original[i][0]<0.0) { alphas[i] = 4.0; diff --git a/tests/geometry/surfaces/testShroudsRegularization.cpp b/tests/geometry/surfaces/testShroudsRegularization.cpp index 9168f90b8b..0cd13a3b52 100644 --- a/tests/geometry/surfaces/testShroudsRegularization.cpp +++ b/tests/geometry/surfaces/testShroudsRegularization.cpp @@ -86,7 +86,7 @@ TEST_CASE( "Testing ShroudsRegularization" ) auto regularizedPos = shrouds_reg.positions(); auto polySurf = SH3::makeDualPolygonalSurface( idxsurface ); auto polySurfPos = polySurf->positions(); - for ( auto i = 0; i < regularizedPos.size(); i++ ) + for ( size_t i = 0; i < regularizedPos.size(); i++ ) polySurfPos[ i ] = regularizedPos[ i ]; SH3::saveOBJ( polySurf, "goursat-shrouds-reg-k2.obj" ); //! [ShroudsRegSaveObj] diff --git a/tests/geometry/volumes/distance/testPowerMap.cpp b/tests/geometry/volumes/distance/testPowerMap.cpp index d51442f008..7b7cef6dc9 100644 --- a/tests/geometry/volumes/distance/testPowerMap.cpp +++ b/tests/geometry/volumes/distance/testPowerMap.cpp @@ -97,13 +97,13 @@ bool checkPowerMap( const PowerMap & aPowerMap) // Site shifting depending on the periodicity. std::vector< typename PowerMap::PeriodicitySpec > periodicShift; - for ( std::size_t i = 0; i < ( 1u << PowerMap::Space::dimension ); ++i ) + for ( typename PowerMap::Space::Dimension i = 0; i < ( 1u << PowerMap::Space::dimension ); ++i ) { const auto periodicity = getPeriodicityFromInteger< PowerMap::Space::dimension >( i ); // Checking if this periodicity possibility is valid. bool isValid = true; - for ( std::size_t j = 0; j < periodicity.size(); ++j ) + for ( typename PowerMap::Space::Dimension j = 0; j < periodicity.size(); ++j ) if ( periodicity[j] && ! aPowerMap.isPeriodic(j) ) { isValid = false; @@ -155,7 +155,7 @@ bool checkPowerMap( const PowerMap & aPowerMap) auto currSite = site; // Shifting site. - for ( std::size_t dim = 0; dim < PowerMap::Space::dimension ; ++dim ) + for ( typename PowerMap::Space::Dimension dim = 0; dim < PowerMap::Space::dimension ; ++dim ) if ( periodicity[dim] ) currSite[dim] += ( pt[dim] < currSite[dim] ? -1 : 1 ) * extent[dim]; @@ -255,7 +255,7 @@ bool testPowerMap( std::array const& aPeriodicity = {{ false, false }} for(unsigned int j=0; j<11; j++) { Z2i::Point p(i,j); - DGtal::int32_t dist = (i-power(p)[0])*(i-power(p)[0]) + + const auto dist = (i-power(p)[0])*(i-power(p)[0]) + ( j-power(p)[1])*(j-power(p)[1]) - image( power.projectPoint(power(p)) ); if (dist>=0) std::cerr<< "0 "; diff --git a/tests/geometry/volumes/distance/testVoronoiMap.cpp b/tests/geometry/volumes/distance/testVoronoiMap.cpp index d46c00e568..b9e78f4b25 100644 --- a/tests/geometry/volumes/distance/testVoronoiMap.cpp +++ b/tests/geometry/volumes/distance/testVoronoiMap.cpp @@ -26,7 +26,6 @@ * * This file is part of the DGtal library. */ - /////////////////////////////////////////////////////////////////////////////// #include #include @@ -98,7 +97,7 @@ Point calcPointModuloDomain( Point aPoint, Domain const & aDomain ) auto const & lowerBound = aDomain.lowerBound(); auto const & upperBound = aDomain.upperBound(); - for ( std::size_t i = 0; i < Domain::dimension; ++i ) + for ( typename Domain::Dimension i = 0; i < Domain::dimension; ++i ) aPoint[i] = ( aPoint[i] - 2*lowerBound[i] + upperBound[i] + 1 ) % ( upperBound[i] - lowerBound[i] + 1 ) + lowerBound[i]; return aPoint; @@ -158,7 +157,7 @@ bool checkVoronoi(const Set &aSet, const Voro & voro) // Checking if this periodicity possibility is valid. bool isValid = true; - for ( size_t j = 0; j < periodicity.size(); ++j ) + for ( typename Voro::Space::Dimension j = 0; j < periodicity.size(); ++j ) if ( periodicity[j] && ! voro.isPeriodic(j) ) { isValid = false; @@ -195,7 +194,7 @@ bool checkVoronoi(const Set &aSet, const Voro & voro) auto currSite = site; // Shifting site. - for ( std::size_t dim = 0; dim < Voro::Space::dimension ; ++dim ) + for ( typename Voro::Space::Dimension dim = 0; dim < Voro::Space::dimension ; ++dim ) if ( periodicity[dim] ) currSite[dim] += ( pt[dim] < currSite[dim] ? -1 : 1 ) * extent[dim]; diff --git a/tests/geometry/volumes/distance/testVoronoiMapComplete.cpp b/tests/geometry/volumes/distance/testVoronoiMapComplete.cpp index 5f775f3baa..e23b47b76a 100644 --- a/tests/geometry/volumes/distance/testVoronoiMapComplete.cpp +++ b/tests/geometry/volumes/distance/testVoronoiMapComplete.cpp @@ -25,7 +25,6 @@ * * This file is part of the DGtal library. */ - /////////////////////////////////////////////////////////////////////////////// #include #include @@ -150,27 +149,27 @@ TEST_CASE( "Testing VoronoiMapComplete 2D" ) SECTION( "Testing Complete Voronoi Map from Discrete Bisector Function paper" ) { - Point lowerBound( 0, 0 ), upperBound( 6, 7 ); - Domain domain( lowerBound, upperBound ); - DigitalSet set( domain ); - for ( Point point : set.domain() ) + Point _lowerBound( 0, 0 ), _upperBound( 6, 7 ); + Domain _domain( _lowerBound, _upperBound ); + DigitalSet _set( _domain ); + for ( Point point : _set.domain() ) { if ( point != Point( 1, 0 ) && point != Point( 5, 0 ) && point != Point( 2, 2 ) && point != Point( 4, 4 ) && point != Point( 0, 6 ) && point != Point( 6, 6 ) && point != Point( 3, 7 ) ) - set.insert( point ); + _set.insert( point ); } TImageContainer * brutForceVoronoiMap = - brut_force_voronoi_map_complete( set ); - CompleteVMap vmap( set.domain(), set, Z2i::l2Metric ); + brut_force_voronoi_map_complete( _set ); + CompleteVMap _vmap( _set.domain(), _set, Z2i::l2Metric ); - for ( Point point : set ) + for ( Point point : _set ) { std::unordered_set brut_force_set = brutForceVoronoiMap->operator()( point ); - CompleteVMap::Value class_set = vmap( point ); + CompleteVMap::Value class_set = _vmap( point ); // Cheking that all voronoi sites from the brut force set are in the // algorithm set diff --git a/tests/geometry/volumes/testBoundedRationalPolytope.cpp b/tests/geometry/volumes/testBoundedRationalPolytope.cpp index 20143027d5..a4218b1c09 100644 --- a/tests/geometry/volumes/testBoundedRationalPolytope.cpp +++ b/tests/geometry/volumes/testBoundedRationalPolytope.cpp @@ -177,7 +177,6 @@ SCENARIO( "BoundedRationalPolytope< Z3 > unit tests", "[rational_polytope][3d]" { typedef SpaceND<3,int> Space; typedef Space::Point Point; - typedef Space::Vector Vector; typedef BoundedRationalPolytope< Space > Polytope; GIVEN( "A tetrahedron P at (0,0,0), (5/2,0,0), (0,7/2,0), (0,0,3/2)" ) { diff --git a/tests/geometry/volumes/testCellGeometry.cpp b/tests/geometry/volumes/testCellGeometry.cpp index da60c36a0f..b9137a59a7 100644 --- a/tests/geometry/volumes/testCellGeometry.cpp +++ b/tests/geometry/volumes/testCellGeometry.cpp @@ -51,11 +51,8 @@ SCENARIO( "CellGeometry< Z2 > segment tests", "[cell_geometry][2d][segment]" ) { typedef KhalimskySpaceND<2,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Vector Vector; - typedef KSpace::Integer Integer; typedef CellGeometry< KSpace > CGeometry; typedef DigitalConvexity< KSpace > DConvexity; - typedef CGeometry::LatticePolytope Polytope; KSpace K; K.init( Point( -5, -5 ), Point( 10, 10 ), true ); @@ -121,11 +118,8 @@ SCENARIO( "CellGeometry< Z3 > segment tests", "[cell_geometry][3d][segment]" ) { typedef KhalimskySpaceND<3,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Vector Vector; - typedef KSpace::Integer Integer; typedef CellGeometry< KSpace > CGeometry; typedef DigitalConvexity< KSpace > DConvexity; - typedef CGeometry::LatticePolytope Polytope; KSpace K; K.init( Point( -5, -5, -5 ), Point( 10, 10, 10 ), true ); @@ -184,8 +178,6 @@ SCENARIO( "CellGeometry< Z2 > unit tests", "[cell_geometry][2d]" ) { typedef KhalimskySpaceND<2,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Vector Vector; - typedef KSpace::Integer Integer; typedef CellGeometry< KSpace > CGeometry; KSpace K; @@ -210,8 +202,6 @@ SCENARIO( "CellGeometry< Z3 > unit tests", "[cell_geometry][3d]" ) typedef KhalimskySpaceND<3,int> KSpace; typedef KSpace::Space Space; typedef KSpace::Point Point; - typedef KSpace::Vector Vector; - typedef KSpace::Integer Integer; typedef CellGeometry< KSpace > CGeometry; typedef HyperRectDomain Domain; @@ -249,8 +239,6 @@ SCENARIO( "CellGeometry< Z2 > intersections", "[cell_geometry][2d]" ) { typedef KhalimskySpaceND<2,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Vector Vector; - typedef KSpace::Integer Integer; typedef KSpace::Space Space; typedef CellGeometry< KSpace > CGeometry; typedef BoundedLatticePolytope< Space > Polytope; @@ -293,8 +281,6 @@ SCENARIO( "CellGeometry< Z3 > intersections", "[cell_geometry][3d]" ) { typedef KhalimskySpaceND<3,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Vector Vector; - typedef KSpace::Integer Integer; typedef KSpace::Space Space; typedef CellGeometry< KSpace > CGeometry; typedef BoundedLatticePolytope< Space > Polytope; @@ -347,8 +333,6 @@ SCENARIO( "CellGeometry< Z2 > rational intersections", { typedef KhalimskySpaceND<2,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Vector Vector; - typedef KSpace::Integer Integer; typedef KSpace::Space Space; typedef CellGeometry< KSpace > CGeometry; typedef BoundedRationalPolytope< Space > Polytope; @@ -405,8 +389,6 @@ SCENARIO( "CellGeometry< Z3 > rational intersections", { typedef KhalimskySpaceND<3,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Vector Vector; - typedef KSpace::Integer Integer; typedef KSpace::Space Space; typedef CellGeometry< KSpace > CGeometry; typedef BoundedRationalPolytope< Space > Polytope; diff --git a/tests/geometry/volumes/testConvexityHelper.cpp b/tests/geometry/volumes/testConvexityHelper.cpp index 8009bf673d..d0def6f9d8 100644 --- a/tests/geometry/volumes/testConvexityHelper.cpp +++ b/tests/geometry/volumes/testConvexityHelper.cpp @@ -98,7 +98,7 @@ SCENARIO( "ConvexityHelper< 2 > unit tests", } THEN( "The faces of cells are finite" ) { bool ok_finite = true; - for ( auto c = 0; c < complex.nbCells(); ++c ) { + for ( CvxCellComplex::Size c = 0; c < complex.nbCells(); ++c ) { const auto faces = complex.cellFaces( c ); for ( auto f : faces ) ok_finite = ok_finite && ! complex.isInfinite( complex.faceCell( f ) ); @@ -107,7 +107,7 @@ SCENARIO( "ConvexityHelper< 2 > unit tests", } THEN( "The opposite of faces of cells are infinite except two" ) { int nb_finite = 0; - for ( auto c = 0; c < complex.nbCells(); ++c ) { + for ( CvxCellComplex::Size c = 0; c < complex.nbCells(); ++c ) { const auto faces = complex.cellFaces( c ); for ( auto f : faces ) { const auto opp_f = complex.opposite( f ); @@ -289,7 +289,7 @@ SCENARIO( "ConvexityHelper< 3 > unit tests", } THEN( "The faces of cells are finite" ) { bool ok_finite = true; - for ( auto c = 0; c < complex.nbCells(); ++c ) { + for ( CvxCellComplex::Size c = 0; c < complex.nbCells(); ++c ) { const auto faces = complex.cellFaces( c ); for ( auto f : faces ) ok_finite = ok_finite && ! complex.isInfinite( complex.faceCell( f ) ); @@ -298,7 +298,7 @@ SCENARIO( "ConvexityHelper< 3 > unit tests", } THEN( "The opposite of faces of cells are infinite except two" ) { int nb_finite = 0; - for ( auto c = 0; c < complex.nbCells(); ++c ) { + for ( CvxCellComplex::Size c = 0; c < complex.nbCells(); ++c ) { const auto faces = complex.cellFaces( c ); for ( auto f : faces ) { const auto opp_f = complex.opposite( f ); diff --git a/tests/geometry/volumes/testDigitalConvexity.cpp b/tests/geometry/volumes/testDigitalConvexity.cpp index d69628d976..b094b48130 100644 --- a/tests/geometry/volumes/testDigitalConvexity.cpp +++ b/tests/geometry/volumes/testDigitalConvexity.cpp @@ -308,7 +308,6 @@ SCENARIO( "DigitalConvexity< Z3 > rational fully convex tetrahedra", "[convex_si { typedef KhalimskySpaceND<3,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Space Space; typedef DigitalConvexity< KSpace > DConvexity; DConvexity dconv( Point( -1, -1, -1 ), Point( 10, 10, 10 ) ); @@ -371,7 +370,6 @@ SCENARIO( "DigitalConvexity< Z2 > rational fully convex tetrahedra", "[convex_si { typedef KhalimskySpaceND<2,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Space Space; typedef DigitalConvexity< KSpace > DConvexity; DConvexity dconv( Point( -1, -1 ), Point( 10, 10 ) ); @@ -635,8 +633,6 @@ SCENARIO( "DigitalConvexity< Z2 > sub-convexity of polyhedra", "[full_subconvexi { typedef KhalimskySpaceND<2,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Space Space; - typedef HyperRectDomain< Space > Domain; typedef DigitalConvexity< KSpace > DConvexity; DConvexity dconv( Point( -36, -36 ), Point( 36, 36 ) ); @@ -652,8 +648,8 @@ SCENARIO( "DigitalConvexity< Z2 > sub-convexity of polyhedra", "[full_subconvexi auto CG = dconv.makeCellCover( P, 0, 2 ); auto L = dconv.StarCvxH( X, 0 ); REQUIRE( CG.nbCells() == L.size() ); - for ( int i = 0; i < k; i++ ) - for ( int j = i+1; j < k; j++ ) + for ( unsigned int i = 0; i < k; i++ ) + for ( unsigned int j = i+1; j < k; j++ ) { std::vector< Point > Z { X[ i ], X[ j ] }; const auto Q = dconv.makePolytope( Z ); @@ -671,8 +667,6 @@ SCENARIO( "DigitalConvexity< Z3 > sub-convexity of polyhedra", "[full_subconvexi { typedef KhalimskySpaceND<3,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Space Space; - typedef HyperRectDomain< Space > Domain; typedef DigitalConvexity< KSpace > DConvexity; DConvexity dconv( Point( -36, -36, -36 ), Point( 36, 36, 36 ) ); @@ -711,8 +705,6 @@ SCENARIO( "DigitalConvexity< Z3 > envelope", "[envelope][3d]" ) { typedef KhalimskySpaceND<3,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Space Space; - typedef HyperRectDomain< Space > Domain; typedef DigitalConvexity< KSpace > DConvexity; DConvexity dconv( Point( -36, -36, -36 ), Point( 36, 36, 36 ) ); @@ -787,8 +779,6 @@ SCENARIO( "DigitalConvexity< Z2 > envelope", "[envelope][2d]" ) { typedef KhalimskySpaceND<2,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Space Space; - typedef HyperRectDomain< Space > Domain; typedef DigitalConvexity< KSpace > DConvexity; DConvexity dconv( Point( -360, -360 ), Point( 360, 360 ) ); @@ -812,8 +802,6 @@ SCENARIO( "DigitalConvexity< Z2 > relative envelope", "[rel_envelope][2d]" ) { typedef KhalimskySpaceND<2,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Space Space; - typedef HyperRectDomain< Space > Domain; typedef DigitalConvexity< KSpace > DConvexity; DConvexity dconv( Point( -360, -360 ), Point( 360, 360 ) ); @@ -865,8 +853,6 @@ SCENARIO( "DigitalConvexity< Z3 > relative envelope", "[rel_envelope][3d]" ) { typedef KhalimskySpaceND<3,int> KSpace; typedef KSpace::Point Point; - typedef KSpace::Space Space; - typedef HyperRectDomain< Space > Domain; typedef DigitalConvexity< KSpace > DConvexity; DConvexity dconv( Point( -360, -360, -360 ), Point( 360, 360, 360 ) ); diff --git a/tests/geometry/volumes/testEhrhartPolynomial.cpp b/tests/geometry/volumes/testEhrhartPolynomial.cpp index 0ec7f1ad9c..5f7b23087c 100644 --- a/tests/geometry/volumes/testEhrhartPolynomial.cpp +++ b/tests/geometry/volumes/testEhrhartPolynomial.cpp @@ -208,7 +208,6 @@ SCENARIO( "EhrhartPolynomial< Z2 > triangle tests", "[ehrhart_polynomial][2d]" ) unsigned int nb0_ok = 0; unsigned int nb1_ok = 0; unsigned int nb_cvx_ok = 0; - unsigned int nb_not_cvx_ok = 0; for ( auto a : domain ) for ( auto b : domain ) for ( auto c : domain ) diff --git a/tests/geometry/volumes/testShortestPaths.cpp b/tests/geometry/volumes/testShortestPaths.cpp index f6373f6562..4869b3e308 100644 --- a/tests/geometry/volumes/testShortestPaths.cpp +++ b/tests/geometry/volumes/testShortestPaths.cpp @@ -50,13 +50,8 @@ SCENARIO( "TangencyComputer::ShortestPaths 3D tests", "[shortest_paths][3d][tang { typedef Z3i::Space Space; typedef Z3i::KSpace KSpace; - typedef Z3i::Domain Domain; - typedef Z3i::SCell SCell; typedef Shortcuts< KSpace > SH3; typedef Space::Point Point; - typedef Space::RealPoint RealPoint; - typedef Space::RealVector RealVector; - typedef Space::Vector Vector; typedef std::size_t Index; SECTION( "Computing shortest paths on a 3D unit sphere digitized at gridstep 0.25" ) @@ -87,15 +82,15 @@ SCENARIO( "TangencyComputer::ShortestPaths 3D tests", "[shortest_paths][3d][tang if ( lattice_points[ uppest ] < lattice_points[ i ] ) uppest = i; } // Compute shortest paths - typedef TangencyComputer< KSpace >::Index Index; + typedef TangencyComputer< KSpace >::Index _Index; TangencyComputer< KSpace > TC( K ); TC.init( lattice_points.cbegin(), lattice_points.cend() ); auto SP = TC.makeShortestPaths( sqrt(3.0) ); SP.init( lowest ); //< set source double last_distance = 0.0; - Index last = 0; + _Index last = 0; double prev_distance = 0.0; - std::set< Index > V; + std::set< _Index > V; unsigned int nb_multiple_pops = 0; unsigned int nb_decreasing_distance = 0; while ( ! SP.finished() ) diff --git a/tests/helpers/testShortcuts.cpp b/tests/helpers/testShortcuts.cpp index 65a5798f4e..a3b7c287e0 100644 --- a/tests/helpers/testShortcuts.cpp +++ b/tests/helpers/testShortcuts.cpp @@ -66,7 +66,7 @@ SCENARIO( "Shortcuts< K3 > pointel ordering", "[shortcuts][pointel]" ) } THEN( "The vertices of the polygonal surface are in the same order as the pointel range" ) { unsigned int nb_ok = 0, nb_ko = 0; - for ( auto i = 0; i < polySurf->nbVertices(); i++ ) + for ( size_t i = 0; i < polySurf->nbVertices(); i++ ) { auto p = pointels[ i ]; auto idx = c2i[ p ]; @@ -77,6 +77,7 @@ SCENARIO( "Shortcuts< K3 > pointel ordering", "[shortcuts][pointel]" ) } else nb_ok += 1; } + (void)nb_ok;//not used REQUIRE( nb_ko == 0 ); } } diff --git a/tests/images/testArrayImageAdapter.cpp b/tests/images/testArrayImageAdapter.cpp index 7bba6d00ee..33645f8716 100644 --- a/tests/images/testArrayImageAdapter.cpp +++ b/tests/images/testArrayImageAdapter.cpp @@ -137,7 +137,6 @@ void checkImage( TImage& anImage ) using Value = typename Image::Value; using Domain = typename Image::Domain; using Point = typename Image::Point; - using Dimension = typename Point::Dimension; using Coordinate = typename Point::Coordinate; using RefImage = ImageContainerBySTLVector; diff --git a/tests/images/testTiledImage.cpp b/tests/images/testTiledImage.cpp index dc08805d9a..bcd2f14adc 100644 --- a/tests/images/testTiledImage.cpp +++ b/tests/images/testTiledImage.cpp @@ -268,9 +268,9 @@ bool test_range_constRange() MyTiledImage tiledImage(imageFactoryFromImage, imageCacheReadPolicyFIFO, imageCacheWritePolicyWB, 4); // writing values - const int maximalValue = tiledImage.domain().size(); + const auto maximalValue = tiledImage.domain().size(); MyTiledImage::Range::OutputIterator it = tiledImage.range().outputIterator(); - for (int i = 0; i < maximalValue; ++i) + for (size_t i = 0; i < maximalValue; ++i) { *it++ = i; } diff --git a/tests/io/testITKio.cpp b/tests/io/testITKio.cpp index 54a8f70002..d9accdee86 100644 --- a/tests/io/testITKio.cpp +++ b/tests/io/testITKio.cpp @@ -116,7 +116,6 @@ testITKSpacingIO() trace.info() << "reading image spacing after write (should be 0.2, 0.3, 0.4)" << std::endl; trace.info() << "spacing: " << s[0] << " " << s[1] << " " << s[2] << std::endl; Image3D img (input.domain()); - functors::Identity f; ITKWriter::exportITK("imageVect_3d_intSpace0.8.mha", img, Z3i::RealPoint(0.8, 0.9, 1.0)); Image3DITK check3 = ITKReader::importITK("imageVect_3d_intSpace0.8.mha"); auto s3 = check3.getImageSpacing(); diff --git a/tests/kernel/testBasicPointFunctors.cpp b/tests/kernel/testBasicPointFunctors.cpp index 835b75c5ba..df18f80b13 100644 --- a/tests/kernel/testBasicPointFunctors.cpp +++ b/tests/kernel/testBasicPointFunctors.cpp @@ -248,7 +248,7 @@ bool testProjector() (pointInSourceDomain3D2== PointVector<3,int>(0, 1, 0)); // FlipDomainAxis - std::vector >::Size> vectFlip; + std::vector >::Dimension> vectFlip; vectFlip.push_back(1); vectFlip.push_back(2); functors::FlipDomainAxis > > flipFunctorAxis12(domainSource3D, vectFlip); diff --git a/tests/kernel/testHyperRectDomain.cpp b/tests/kernel/testHyperRectDomain.cpp index 39dc44261d..16f5285f1f 100644 --- a/tests/kernel/testHyperRectDomain.cpp +++ b/tests/kernel/testHyperRectDomain.cpp @@ -238,7 +238,6 @@ void testIteratorHelper( Iterator const& it_begin, Iterator const& it_end, Point pt, Domain const& domain, bool forward = true) { - using Dimension = typename Domain::Dimension; std::vector dimensions(Domain::dimension); std::iota(dimensions.begin(), dimensions.end(), Dimension(0)); @@ -250,7 +249,6 @@ template < > void testIterator(Point const& a, Point const& b, Point const& c) { - using Dimension = typename Point::Dimension; using Space = SpaceND; using Domain = HyperRectDomain; diff --git a/tests/kernel/testIntegralIntervals.cpp b/tests/kernel/testIntegralIntervals.cpp index fa98785474..a114ee0860 100644 --- a/tests/kernel/testIntegralIntervals.cpp +++ b/tests/kernel/testIntegralIntervals.cpp @@ -70,7 +70,7 @@ SCENARIO( "IntegralIntervals< int > unit tests", "[intervals]" ) { std::cout << "Bad count #V=" << V.size() << " #X=" << X.size() << std::endl; - for ( auto i : X ) std::cout << " " << i; + for ( auto j : X ) std::cout << " " << j; std::cout << std::endl; break; } @@ -103,7 +103,7 @@ SCENARIO( "IntegralIntervals< int > unit tests", "[intervals]" ) { std::cout << "Bad count #V=" << V.size() << " #X=" << X.size() << std::endl; - for ( auto i : X ) std::cout << " " << i; + for ( auto j : X ) std::cout << " " << j; std::cout << std::endl; break; } @@ -138,14 +138,6 @@ SCENARIO( "IntegralIntervals< int > set operations tests", "[intervals]" ) Intervals A_cap_B = A.set_intersection( B ); Intervals A_minus_B = A.set_difference( B ); Intervals A_delta_B = A.set_symmetric_difference( B ); - bool A_cup_B_subset_A_cup_B = A_cup_B.includes( A_cup_B ); - bool A_subset_A_cup_B = A_cup_B.includes( A ); - bool B_subset_A_cup_B = A_cup_B.includes( B ); - bool A_cap_B_subset_A_cup_B = A_cup_B.includes( A_cap_B ); - bool A_minus_B_subset_A = A.includes( A_minus_B ); - bool A_delta_B_subset_A_cup_B = A_cup_B.includes( A_delta_B ); - bool A_delta_B_subset_A = A.includes( A_delta_B ); // false - bool A_delta_B_subset_B = B.includes( A_delta_B ); // false THEN( "Interval can be constructed from sets" ) { REQUIRE( X.size() == A.size() ); REQUIRE( Y.size() == B.size() ); diff --git a/tests/kernel/testLatticeSetByIntervals.cpp b/tests/kernel/testLatticeSetByIntervals.cpp index 6316bee56b..793c7941fa 100644 --- a/tests/kernel/testLatticeSetByIntervals.cpp +++ b/tests/kernel/testLatticeSetByIntervals.cpp @@ -55,7 +55,7 @@ SCENARIO( "LatticeSetByIntervals< int > unit tests", "[lattice_set]" ) std::set< Point > S; LatticeSet L; unsigned int nb = 10000; - for ( auto i = 0; i < nb; i++ ) + for ( unsigned int i = 0; i < nb; i++ ) { Point p( rand() % 20, rand() % 20, rand() % 20 ); S.insert( p ); @@ -66,7 +66,7 @@ SCENARIO( "LatticeSetByIntervals< int > unit tests", "[lattice_set]" ) auto vec_L = L.toPointRange(); std::sort( vec_L.begin(), vec_L.end() ); std::vector< Point > vec_S( S.begin(), S.end() ); - for ( auto i = 0; i < vec_L.size(); i++ ) + for ( size_t i = 0; i < vec_L.size(); i++ ) { if ( vec_L[ i ] != vec_S[ i ] ) std::cout << i << " " << vec_L[ i ] << " != " << vec_S[ i ] @@ -316,17 +316,17 @@ SCENARIO( "LatticeSetByIntervals< int > 2d topology operations tests", "[lattice REQUIRE( StarSkelStarC.equals( StarC ) ); } WHEN( "Computing the extrema of a set of cells C, extremas are correct" ) { - std::vector< Point > X; - X.push_back( Point(10,-2) ); - X.push_back( Point(5,5) ); - X.push_back( Point(4,5) ); - X.push_back( Point(3,5) ); - X.push_back( Point(2,1) ); - X.push_back( Point(2,3) ); - X.push_back( Point(1,1) ); - X.push_back( Point(-2,3) ); - X.push_back( Point(-3,2) ); - LatticeSet C( X.cbegin(), X.cend(), 0 ); + std::vector< Point > XX; + XX.push_back( Point(10,-2) ); + XX.push_back( Point(5,5) ); + XX.push_back( Point(4,5) ); + XX.push_back( Point(3,5) ); + XX.push_back( Point(2,1) ); + XX.push_back( Point(2,3) ); + XX.push_back( Point(1,1) ); + XX.push_back( Point(-2,3) ); + XX.push_back( Point(-3,2) ); + LatticeSet C( XX.cbegin(), XX.cend(), 0 ); auto ExtrC = C.extremaOfCells(); CAPTURE( C.toPointRange() ); CAPTURE( ExtrC ); diff --git a/tests/kernel/testUnorderedSetByBlock.cpp b/tests/kernel/testUnorderedSetByBlock.cpp index 1d877e1a57..7fbf211e26 100644 --- a/tests/kernel/testUnorderedSetByBlock.cpp +++ b/tests/kernel/testUnorderedSetByBlock.cpp @@ -61,13 +61,13 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 2, int > unit tests with 32 bits bl typedef std::unordered_set< Point > StdUnorderedSet; typedef UnorderedSetByBlock< Point > BlockUnorderedSet; - const int nb_inserted = 100; - const int nb_sought = 200; - const int nb_erased = 100; + const size_t nb_inserted = 100; + const size_t nb_sought = 200; + const size_t nb_erased = 100; StdUnorderedSet stdSet; BlockUnorderedSet blkSet; - for ( int i = 0; i < nb_inserted; i++ ) + for ( size_t i = 0; i < nb_inserted; i++ ) { Point p = randomPoint( 10 ); stdSet.insert( p ); @@ -96,7 +96,7 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 2, int > unit tests with 32 bits bl WHEN( "Looking for elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are find with method `count`" ) { std::vector< Point > stdFound, stdNotFound; std::vector< Point > blkFound, blkNotFound; - for ( int i = 0; i < nb_sought; i++ ) + for ( size_t i = 0; i < nb_sought; i++ ) { Point p = randomPoint( 10 ); if ( stdSet.count( p ) != 0 ) stdFound.push_back( p ); @@ -118,9 +118,9 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 2, int > unit tests with 32 bits bl WHEN( "Looking for elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are find with method `find`" ) { std::vector< Point > stdFound, stdNotFound; std::vector< Point > blkFound, blkNotFound; - int std_nb_value_ok = 0; - int blk_nb_value_ok = 0; - for ( int i = 0; i < nb_sought; i++ ) + size_t std_nb_value_ok = 0; + size_t blk_nb_value_ok = 0; + for ( size_t i = 0; i < nb_sought; i++ ) { Point p = randomPoint( 10 ); const auto stdIt = stdSet.find( p ); @@ -155,9 +155,9 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 2, int > unit tests with 32 bits bl WHEN( "Erasing elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are left" ) { std::vector< Point > stdErase; std::vector< Point > blkErase; - int std_nb_erase_ok = 0; - int blk_nb_erase_ok = 0; - for ( int i = 0; i < nb_erased; i++ ) + size_t std_nb_erase_ok = 0; + size_t blk_nb_erase_ok = 0; + for ( size_t i = 0; i < nb_erased; i++ ) { Point p = randomPoint( 10 ); auto stdFindIt = stdSet.find ( p ); @@ -190,16 +190,16 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 2, int > unit tests with 32 bits bl REQUIRE( std::equal( stdTrv.cbegin(), stdTrv.cend(), blkTrv.cbegin() ) ); } WHEN( "Erasing a range in identical std::unordered_set<> and UnorderedSetByBlock<>, the same number of elements is left" ) { - int nb_std_before = stdSet.size(); - int nb_blk_before = blkSet.size(); + auto nb_std_before = stdSet.size(); + auto nb_blk_before = blkSet.size(); auto stdItB = stdSet.begin(); std::advance( stdItB, 10 ); auto blkItB = blkSet.begin(); std::advance( blkItB, 10 ); auto stdItE = stdItB; std::advance( stdItE, 20 ); auto blkItE = blkItB; std::advance( blkItE, 20 ); stdSet.erase( stdItB, stdItE ); blkSet.erase( blkItB, blkItE ); - int nb_std = std::distance(stdSet.begin(), stdSet.end()); - int nb_blk = std::distance(blkSet.begin(), blkSet.end()); + size_t nb_std = std::distance(stdSet.begin(), stdSet.end()); + size_t nb_blk = std::distance(blkSet.begin(), blkSet.end()); REQUIRE( stdSet.size() == nb_std ); REQUIRE( stdSet.size() == nb_std_before - 20 ); REQUIRE( blkSet.size() == nb_blk ); @@ -249,13 +249,13 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 3, int64 > unit tests with 32 bits typedef std::unordered_set< Point > StdUnorderedSet; typedef UnorderedSetByBlock< Point > BlockUnorderedSet; - const int nb_inserted = 1000; - const int nb_sought = 2000; - const int nb_erased = 1000; + const size_t nb_inserted = 1000; + const size_t nb_sought = 2000; + const size_t nb_erased = 1000; StdUnorderedSet stdSet; BlockUnorderedSet blkSet; - for ( int i = 0; i < nb_inserted; i++ ) + for ( size_t i = 0; i < nb_inserted; i++ ) { Point p = randomPoint( 10 ); stdSet.insert( p ); @@ -284,7 +284,7 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 3, int64 > unit tests with 32 bits WHEN( "Looking for elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are find with method `count`" ) { std::vector< Point > stdFound, stdNotFound; std::vector< Point > blkFound, blkNotFound; - for ( int i = 0; i < nb_sought; i++ ) + for ( size_t i = 0; i < nb_sought; i++ ) { Point p = randomPoint( 10 ); if ( stdSet.count( p ) != 0 ) stdFound.push_back( p ); @@ -306,9 +306,9 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 3, int64 > unit tests with 32 bits WHEN( "Looking for elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are find with method `find`" ) { std::vector< Point > stdFound, stdNotFound; std::vector< Point > blkFound, blkNotFound; - int std_nb_value_ok = 0; - int blk_nb_value_ok = 0; - for ( int i = 0; i < nb_sought; i++ ) + size_t std_nb_value_ok = 0; + size_t blk_nb_value_ok = 0; + for ( size_t i = 0; i < nb_sought; i++ ) { Point p = randomPoint( 10 ); const auto stdIt = stdSet.find( p ); @@ -343,9 +343,9 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 3, int64 > unit tests with 32 bits WHEN( "Erasing elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are left" ) { std::vector< Point > stdErase; std::vector< Point > blkErase; - int std_nb_erase_ok = 0; - int blk_nb_erase_ok = 0; - for ( int i = 0; i < nb_erased; i++ ) + size_t std_nb_erase_ok = 0; + size_t blk_nb_erase_ok = 0; + for ( size_t i = 0; i < nb_erased; i++ ) { Point p = randomPoint( 10 ); auto stdFindIt = stdSet.find ( p ); @@ -378,16 +378,16 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 3, int64 > unit tests with 32 bits REQUIRE( std::equal( stdTrv.cbegin(), stdTrv.cend(), blkTrv.cbegin() ) ); } WHEN( "Erasing a range in identical std::unordered_set<> and UnorderedSetByBlock<>, the same number of elements is left" ) { - int nb_std_before = stdSet.size(); - int nb_blk_before = blkSet.size(); + auto nb_std_before = stdSet.size(); + auto nb_blk_before = blkSet.size(); auto stdItB = stdSet.begin(); std::advance( stdItB, 10 ); auto blkItB = blkSet.begin(); std::advance( blkItB, 10 ); auto stdItE = stdItB; std::advance( stdItE, 20 ); auto blkItE = blkItB; std::advance( blkItE, 20 ); stdSet.erase( stdItB, stdItE ); blkSet.erase( blkItB, blkItE ); - int nb_std = std::distance(stdSet.begin(), stdSet.end()); - int nb_blk = std::distance(blkSet.begin(), blkSet.end()); + size_t nb_std = std::distance(stdSet.begin(), stdSet.end()); + size_t nb_blk = std::distance(blkSet.begin(), blkSet.end()); REQUIRE( stdSet.size() == nb_std ); REQUIRE( stdSet.size() == nb_std_before - 20 ); REQUIRE( blkSet.size() == nb_blk ); @@ -437,13 +437,13 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 2, int > unit tests with 64 bits bl typedef Splitter< Point, DGtal::uint64_t > Splitter64; typedef UnorderedSetByBlock< Point, Splitter64 > BlockUnorderedSet; - const int nb_inserted = 10000; - const int nb_sought = 200; - const int nb_erased = 100; + const size_t nb_inserted = 10000; + const size_t nb_sought = 200; + const size_t nb_erased = 100; StdUnorderedSet stdSet; BlockUnorderedSet blkSet; - for ( int i = 0; i < nb_inserted; i++ ) + for ( size_t i = 0; i < nb_inserted; i++ ) { Point p = randomPoint( 200 ); stdSet.insert( p ); @@ -472,7 +472,7 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 2, int > unit tests with 64 bits bl WHEN( "Looking for elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are find with method `count`" ) { std::vector< Point > stdFound, stdNotFound; std::vector< Point > blkFound, blkNotFound; - for ( int i = 0; i < nb_sought; i++ ) + for ( size_t i = 0; i < nb_sought; i++ ) { Point p = randomPoint( 10 ); if ( stdSet.count( p ) != 0 ) stdFound.push_back( p ); @@ -494,9 +494,9 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 2, int > unit tests with 64 bits bl WHEN( "Looking for elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are find with method `find`" ) { std::vector< Point > stdFound, stdNotFound; std::vector< Point > blkFound, blkNotFound; - int std_nb_value_ok = 0; - int blk_nb_value_ok = 0; - for ( int i = 0; i < nb_sought; i++ ) + size_t std_nb_value_ok = 0; + size_t blk_nb_value_ok = 0; + for ( size_t i = 0; i < nb_sought; i++ ) { Point p = randomPoint( 10 ); const auto stdIt = stdSet.find( p ); @@ -531,9 +531,9 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 2, int > unit tests with 64 bits bl WHEN( "Erasing elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are left" ) { std::vector< Point > stdErase; std::vector< Point > blkErase; - int std_nb_erase_ok = 0; - int blk_nb_erase_ok = 0; - for ( int i = 0; i < nb_erased; i++ ) + size_t std_nb_erase_ok = 0; + size_t blk_nb_erase_ok = 0; + for ( size_t i = 0; i < nb_erased; i++ ) { Point p = randomPoint( 10 ); auto stdFindIt = stdSet.find ( p ); @@ -566,16 +566,16 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 2, int > unit tests with 64 bits bl REQUIRE( std::equal( stdTrv.cbegin(), stdTrv.cend(), blkTrv.cbegin() ) ); } WHEN( "Erasing a range in identical std::unordered_set<> and UnorderedSetByBlock<>, the same number of elements is left" ) { - int nb_std_before = stdSet.size(); - int nb_blk_before = blkSet.size(); + auto nb_std_before = stdSet.size(); + auto nb_blk_before = blkSet.size(); auto stdItB = stdSet.begin(); std::advance( stdItB, 10 ); auto blkItB = blkSet.begin(); std::advance( blkItB, 10 ); auto stdItE = stdItB; std::advance( stdItE, 20 ); auto blkItE = blkItB; std::advance( blkItE, 20 ); stdSet.erase( stdItB, stdItE ); blkSet.erase( blkItB, blkItE ); - int nb_std = std::distance(stdSet.begin(), stdSet.end()); - int nb_blk = std::distance(blkSet.begin(), blkSet.end()); + size_t nb_std = std::distance(stdSet.begin(), stdSet.end()); + size_t nb_blk = std::distance(blkSet.begin(), blkSet.end()); REQUIRE( stdSet.size() == nb_std ); REQUIRE( stdSet.size() == nb_std_before - 20 ); REQUIRE( blkSet.size() == nb_blk ); @@ -626,13 +626,13 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 3, int64 > unit tests with 64 bits typedef Splitter< Point, DGtal::uint64_t > Splitter64; typedef UnorderedSetByBlock< Point, Splitter64 > BlockUnorderedSet; - const int nb_inserted = 40000; - const int nb_sought = 2000; - const int nb_erased = 1000; + const size_t nb_inserted = 40000; + const size_t nb_sought = 2000; + const size_t nb_erased = 1000; StdUnorderedSet stdSet; BlockUnorderedSet blkSet; - for ( int i = 0; i < nb_inserted; i++ ) + for ( size_t i = 0; i < nb_inserted; i++ ) { Point p = randomPoint( 100 ); stdSet.insert( p ); @@ -661,7 +661,7 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 3, int64 > unit tests with 64 bits WHEN( "Looking for elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are find with method `count`" ) { std::vector< Point > stdFound, stdNotFound; std::vector< Point > blkFound, blkNotFound; - for ( int i = 0; i < nb_sought; i++ ) + for ( size_t i = 0; i < nb_sought; i++ ) { Point p = randomPoint( 10 ); if ( stdSet.count( p ) != 0 ) stdFound.push_back( p ); @@ -683,9 +683,9 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 3, int64 > unit tests with 64 bits WHEN( "Looking for elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are find with method `find`" ) { std::vector< Point > stdFound, stdNotFound; std::vector< Point > blkFound, blkNotFound; - int std_nb_value_ok = 0; - int blk_nb_value_ok = 0; - for ( int i = 0; i < nb_sought; i++ ) + size_t std_nb_value_ok = 0; + size_t blk_nb_value_ok = 0; + for ( size_t i = 0; i < nb_sought; i++ ) { Point p = randomPoint( 10 ); const auto stdIt = stdSet.find( p ); @@ -720,9 +720,9 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 3, int64 > unit tests with 64 bits WHEN( "Erasing elements in identical std::unordered_set<> and UnorderedSetByBlock<>, the same elements are left" ) { std::vector< Point > stdErase; std::vector< Point > blkErase; - int std_nb_erase_ok = 0; - int blk_nb_erase_ok = 0; - for ( int i = 0; i < nb_erased; i++ ) + size_t std_nb_erase_ok = 0; + size_t blk_nb_erase_ok = 0; + for ( size_t i = 0; i < nb_erased; i++ ) { Point p = randomPoint( 10 ); auto stdFindIt = stdSet.find ( p ); @@ -755,16 +755,16 @@ SCENARIO( "UnorderedSetByBlock< PointVector< 3, int64 > unit tests with 64 bits REQUIRE( std::equal( stdTrv.cbegin(), stdTrv.cend(), blkTrv.cbegin() ) ); } WHEN( "Erasing a range in identical std::unordered_set<> and UnorderedSetByBlock<>, the same number of elements is left" ) { - int nb_std_before = stdSet.size(); - int nb_blk_before = blkSet.size(); + auto nb_std_before = stdSet.size(); + auto nb_blk_before = blkSet.size(); auto stdItB = stdSet.begin(); std::advance( stdItB, 10 ); auto blkItB = blkSet.begin(); std::advance( blkItB, 10 ); auto stdItE = stdItB; std::advance( stdItE, 20 ); auto blkItE = blkItB; std::advance( blkItE, 20 ); stdSet.erase( stdItB, stdItE ); blkSet.erase( blkItB, blkItE ); - int nb_std = std::distance(stdSet.begin(), stdSet.end()); - int nb_blk = std::distance(blkSet.begin(), blkSet.end()); + size_t nb_std = std::distance(stdSet.begin(), stdSet.end()); + size_t nb_blk = std::distance(blkSet.begin(), blkSet.end()); REQUIRE( stdSet.size() == nb_std ); REQUIRE( stdSet.size() == nb_std_before - 20 ); REQUIRE( blkSet.size() == nb_blk ); diff --git a/tests/shapes/testAstroid2D.cpp b/tests/shapes/testAstroid2D.cpp index 4460f728bd..fb85dfcda3 100644 --- a/tests/shapes/testAstroid2D.cpp +++ b/tests/shapes/testAstroid2D.cpp @@ -41,9 +41,6 @@ using namespace DGtal; using namespace Z2i; -typedef Z2i::Space Space; -typedef Z2i::Point Point; -typedef Z2i::RealPoint RealPoint; typedef Astroid2D Shape; diff --git a/tests/shapes/testBall3DSurface.cpp b/tests/shapes/testBall3DSurface.cpp index 6b3cfa8f0a..336127b297 100644 --- a/tests/shapes/testBall3DSurface.cpp +++ b/tests/shapes/testBall3DSurface.cpp @@ -48,7 +48,6 @@ int main(int /*argc*/, char** /*argv*/) // -------------------------------------------------------------------------- Type declaring - typedef Space::RealPoint RealPoint; typedef Ball3D EuclideanShape; bool test = true; diff --git a/tests/shapes/testLemniscate2D.cpp b/tests/shapes/testLemniscate2D.cpp index 118962e108..cc2c7f54f7 100644 --- a/tests/shapes/testLemniscate2D.cpp +++ b/tests/shapes/testLemniscate2D.cpp @@ -41,10 +41,6 @@ using namespace DGtal; using namespace Z2i; -typedef Z2i::Space Space; -typedef Z2i::Point Point; -typedef Z2i::RealPoint RealPoint; - typedef Lemniscate2D Shape; double notNullValue( diff --git a/tests/shapes/testMeshVoxelization.cpp b/tests/shapes/testMeshVoxelization.cpp index 7c2bcb93f7..96e2be81f4 100755 --- a/tests/shapes/testMeshVoxelization.cpp +++ b/tests/shapes/testMeshVoxelization.cpp @@ -24,7 +24,6 @@ * * This file is part of the DGtal library. */ - /////////////////////////////////////////////////////////////////////////////// #include #include "ConfigTest.h" @@ -43,13 +42,10 @@ using namespace Z3i; TEST_CASE("Basic voxelization test", "[voxelization]") { - using Space3Dint = SpaceND<3>; - using Domain = HyperRectDomain; using PointR3 = PointVector<3, double>; using VectorR3 = PointVector<3, double>; using PointR2 = PointVector<2, double>; using PointZ3 = PointVector<3, int>; - using DigitalSet = DigitalSetBySTLSet; using MeshVoxelizer26 = MeshVoxelizer< DigitalSet, 26>; using MeshVoxelizer6 = MeshVoxelizer< DigitalSet, 6>; @@ -104,33 +100,33 @@ TEST_CASE("Basic voxelization test", "[voxelization]") v[0] = 3.0; v[1] = 3.0; - REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::OUTSIDE); + REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_OUTSIDE); v[0] = 2.0; v[1] = 2.0; - REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::INSIDE); + REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_INSIDE); v[0] = 2; v[1] = 1; - REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::ONEDGE); + REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_ONEDGE); v[0] = 3; v[1] = 1; - REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::ONVERTEX); + REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_ONVERTEX); // another case A = { 16.3299, 0. }; B = { 0., 16.3299 }; C = { -16.3299, 0. }; v = { -17., 0.}; - REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::OUTSIDE); + REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_OUTSIDE); // another case A = { -0.891282, 9.91201 }; B = { -1.40823, 9.91261 }; C = { -1.36963, 9.37414 }; v = { -1.16961, 9.83039 }; - REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::INSIDE); + REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_INSIDE); } // --------------------------------------------------------- diff --git a/tests/shapes/testProjection.cpp b/tests/shapes/testProjection.cpp index c29c174929..df8f7f5811 100644 --- a/tests/shapes/testProjection.cpp +++ b/tests/shapes/testProjection.cpp @@ -139,7 +139,7 @@ bool test_shape(Shape& shape, const double h, const double epsilon) functors::SCellToInnerPoint sCellToInnerPoint(kspace); functors::SCellToOuterPoint sCellToOuterPoint(kspace); - const int prev = ( i + sCells0.size() - 3 ) % sCells0.size(), next = (i + 3) % sCells0.size(); + auto prev = ( i + sCells0.size() - 3 ) % sCells0.size(), next = (i + 3) % sCells0.size(); RealPoint inner_prev = sCellToInnerPoint( sCells0[prev] ); RealPoint outer_prev = sCellToOuterPoint( sCells0[prev] ); diff --git a/tests/shapes/testShapeMoveCenter.cpp b/tests/shapes/testShapeMoveCenter.cpp index f691fc2bb4..651733889c 100644 --- a/tests/shapes/testShapeMoveCenter.cpp +++ b/tests/shapes/testShapeMoveCenter.cpp @@ -51,17 +51,14 @@ using namespace DGtal; using namespace Z2i; -typedef Z2i::Space Space; -typedef Z2i::Point Point; -typedef Z2i::RealPoint RealPoint; - -typedef AccFlower2D AccFlower; -typedef Astroid2D Astroid; -typedef Ball2D Ball; -typedef Ellipse2D Ellipse; -typedef Flower2D Flower; -typedef Lemniscate2D Lemniscate; -typedef NGon2D NGon; + +typedef AccFlower2D MyAccFlower; +typedef Astroid2D MyAstroid; +typedef Ball2D MyBall; +typedef Ellipse2D MyEllipse; +typedef Flower2D MyFlower; +typedef Lemniscate2D MyLemniscate; +typedef NGon2D MyNGon; typedef ImplicitBall BallImplicit; typedef ImplicitHyperCube HyperCubeImplicit; @@ -72,45 +69,45 @@ template Shape createShape( const RealPoint& center, const RealPoint& radii ); template<> -AccFlower createShape( const RealPoint& center, const RealPoint& radii ) +MyAccFlower createShape( const RealPoint& center, const RealPoint& radii ) { - return AccFlower( center, radii[0], radii[1], 12, 2. ); + return MyAccFlower( center, radii[0], radii[1], 12, 2. ); } template<> -Astroid createShape( const RealPoint& center, const RealPoint& radii ) +MyAstroid createShape( const RealPoint& center, const RealPoint& radii ) { - return Astroid( center, radii[0], radii[1] ); + return MyAstroid( center, radii[0], radii[1] ); } template<> -Ball createShape( const RealPoint& center, const RealPoint& radii ) +MyBall createShape( const RealPoint& center, const RealPoint& radii ) { - return Ball( center, radii[0] ); + return MyBall( center, radii[0] ); } template<> -Ellipse createShape( const RealPoint& center, const RealPoint& radii ) +MyEllipse createShape( const RealPoint& center, const RealPoint& radii ) { - return Ellipse( center, radii[0], radii[1], 2. ); + return MyEllipse( center, radii[0], radii[1], 2. ); } template<> -Flower createShape( const RealPoint& center, const RealPoint& radii ) +MyFlower createShape( const RealPoint& center, const RealPoint& radii ) { - return Flower( center, radii[0], radii[1], 5, 2. ); + return MyFlower( center, radii[0], radii[1], 5, 2. ); } template<> -Lemniscate createShape( const RealPoint& center, const RealPoint& radii ) +MyLemniscate createShape( const RealPoint& center, const RealPoint& radii ) { - return Lemniscate( center, radii[0] ); + return MyLemniscate( center, radii[0] ); } template<> -NGon createShape( const RealPoint& center, const RealPoint& radii ) +MyNGon createShape( const RealPoint& center, const RealPoint& radii ) { - return NGon( center, radii[0], 20, 2. ); + return MyNGon( center, radii[0], 20, 2. ); } template<> @@ -141,7 +138,7 @@ std::uniform_real_distribution unif(-1000000.,1000000.); std::default_random_engine re; TEMPLATE_TEST_CASE("Star shapes", "move() method", - AccFlower, Astroid, Ball, Ellipse, Flower, Lemniscate, NGon, + MyAccFlower, MyAstroid, MyBall, MyEllipse, MyFlower, MyLemniscate, MyNGon, BallImplicit, HyperCubeImplicit, Norm1BallImplicit, RoundedHyperCubeImplicit) { const double centerX = unif(re); diff --git a/tests/shapes/testSurfaceMesh.cpp b/tests/shapes/testSurfaceMesh.cpp index 322cde27f7..2a48bc912d 100644 --- a/tests/shapes/testSurfaceMesh.cpp +++ b/tests/shapes/testSurfaceMesh.cpp @@ -118,7 +118,6 @@ SCENARIO( "SurfaceMesh< RealPoint3 > build tests", "[surfmesh][build]" ) typedef PointVector<3,double> RealVector; typedef SurfaceMesh< RealPoint, RealVector > PolygonMesh; typedef PolygonMesh::Vertices Vertices; - typedef PolygonMesh::Face Face; typedef PolygonMesh::Edge Edge; typedef PolygonMesh::Vertex Vertex; GIVEN( "A box with an open side" ) { @@ -236,7 +235,6 @@ SCENARIO( "SurfaceMesh< RealPoint3 > mesh helper tests", "[surfmesh][helper]" ) { typedef PointVector<3,double> RealPoint; typedef PointVector<3,double> RealVector; - typedef SurfaceMesh< RealPoint, RealVector > PolygonMesh; typedef SurfaceMeshHelper< RealPoint, RealVector > PolygonMeshHelper; typedef PolygonMeshHelper::NormalsType NormalsType; GIVEN( "A sphere of radius 10" ) { @@ -337,9 +335,6 @@ SCENARIO( "SurfaceMesh< RealPoint3 > reader/writer tests", "[surfmesh][io]" ) SCENARIO( "SurfaceMesh< RealPoint3 > boundary tests", "[surfmesh][boundary]" ) { - typedef PointVector<3,double> RealPoint; - typedef PointVector<3,double> RealVector; - typedef SurfaceMesh< RealPoint, RealVector > PolygonMesh; auto polymesh = makeNonManifoldBoundary(); auto polymesh2 = makeBox(); WHEN( "Checking the topolopgy of the mesh boundary" ) { diff --git a/tests/topology/testDigitalSurface.cpp b/tests/topology/testDigitalSurface.cpp index f341e787d4..b2eac6ea17 100644 --- a/tests/topology/testDigitalSurface.cpp +++ b/tests/topology/testDigitalSurface.cpp @@ -277,7 +277,6 @@ bool testExplicitDigitalSurface() typedef FrontierPredicate SurfelPredicate; typedef ExplicitDigitalSurface Frontier; typedef Frontier::SurfelConstIterator ConstIterator; - typedef Frontier::SCell SCell; unsigned int nbok = 0; unsigned int nb = 0; @@ -386,7 +385,6 @@ bool testLightExplicitDigitalSurface() typedef FrontierPredicate SurfelPredicate; typedef LightExplicitDigitalSurface Frontier; typedef Frontier::SurfelConstIterator ConstIterator; - typedef Frontier::SCell SCell; unsigned int nbok = 0; unsigned int nb = 0; diff --git a/tests/topology/testObjectBorder.cpp b/tests/topology/testObjectBorder.cpp index 181657f497..6ebadea2a6 100644 --- a/tests/topology/testObjectBorder.cpp +++ b/tests/topology/testObjectBorder.cpp @@ -200,10 +200,8 @@ bool testObjectBorder() //We split the border according to its components vector borders ( 30 ); - unsigned int nbComponents; - vector::iterator it = borders.begin(); - nbComponents = bubbleBorder2.writeComponents ( it ); + auto nbComponents = bubbleBorder2.writeComponents ( it ); trace.info() << "The Bubble object has " << nbComponents << " (4,8)-connected components" << endl; diff --git a/tests/topology/testSimpleExpander.cpp b/tests/topology/testSimpleExpander.cpp index 82dd736d54..077145734d 100644 --- a/tests/topology/testSimpleExpander.cpp +++ b/tests/topology/testSimpleExpander.cpp @@ -209,7 +209,7 @@ using namespace DGtal::Z2i; bool testLayers() { - GradientColorMap cmap_grad( 0, 30 ); + GradientColorMap cmap_grad( 0, 30 ); cmap_grad.addColor( Color( 128, 128, 255 ) ); cmap_grad.addColor( Color( 255, 255, 128 ) ); cmap_grad.addColor( Color( 128, 255, 128 ) ); @@ -270,8 +270,7 @@ bool testLayers() ++it ) std::cout << " " << *it; board << CustomStyle( expander.layer().className(), - new CustomFillColor - ( cmap_grad( expander.distance() ) ) ) + new CustomFillColor( cmap_grad( expander.distance() ) ) ) << expander.layer(); expander.nextLayer(); diff --git a/tests/topology/testUmbrellaComputer.cpp b/tests/topology/testUmbrellaComputer.cpp index a45d0cbc98..1c33dd9283 100644 --- a/tests/topology/testUmbrellaComputer.cpp +++ b/tests/topology/testUmbrellaComputer.cpp @@ -49,10 +49,8 @@ bool testUmbrellaComputer() { using namespace Z3i; - typedef Space::RealPoint RealPoint; typedef ImplicitBall EuclideanShape; typedef GaussDigitizer DigitalShape; - typedef GaussDigitizer::Domain Domain; typedef LightImplicitDigitalSurface Boundary; typedef Boundary::SurfelConstIterator ConstIterator; //typedef Boundary::Tracker Tracker; @@ -140,10 +138,8 @@ bool testCombinatorialSurface() { using namespace Z3i; - typedef Space::RealPoint RealPoint; typedef ImplicitBall EuclideanShape; typedef GaussDigitizer DigitalShape; - typedef GaussDigitizer::Domain Domain; typedef LightImplicitDigitalSurface Boundary; typedef Boundary::SurfelConstIterator ConstIterator; //typedef Boundary::Tracker Tracker; diff --git a/tests/topology/testVoxelComplex.cpp b/tests/topology/testVoxelComplex.cpp index d6add4efb9..61010b5698 100644 --- a/tests/topology/testVoxelComplex.cpp +++ b/tests/topology/testVoxelComplex.cpp @@ -250,7 +250,7 @@ TEST_CASE_METHOD(Fixture_complex_diamond, "Neighbors from Object and KSpace", auto &vc = complex_fixture; SECTION(" get neighbors from Kspace") { { - size_t dim_voxel = 3; + Dimension dim_voxel = 3; auto it = vc.begin(dim_voxel); for (std::size_t n = 0; n < 10; ++n) ++it; @@ -287,7 +287,7 @@ TEST_CASE_METHOD(Fixture_complex_diamond, "Neighbors from Object and KSpace", TEST_CASE_METHOD(Fixture_complex_diamond, "Test Simplicity", "[simplicity]") { auto &vc = complex_fixture; - size_t dim_voxel = 3; + Dimension dim_voxel = 3; auto cit = vc.begin(dim_voxel); for (std::size_t n = 0; n < 10; ++n) ++cit;