diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index c6dbf33c6..399e63ebd 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true @@ -28,9 +28,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: clang@17 + +: clang@19 - run: clang --version diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index f673e0b90..c060f97c5 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -11,10 +11,10 @@ jobs: - 'src' - 'include' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run clang-format style check for C/C++/Protobuf programs. - uses: jidicula/clang-format-action@v4.11.0 + uses: jidicula/clang-format-action@v4.13.0 with: - clang-format-version: '17' + clang-format-version: '18' check-path: ${{ matrix.path }} fallback-style: 'Google' # optional \ No newline at end of file diff --git a/.github/workflows/codecov-upload.yml b/.github/workflows/codecov-upload.yml index a8dcaa093..ce21b5194 100644 --- a/.github/workflows/codecov-upload.yml +++ b/.github/workflows/codecov-upload.yml @@ -5,10 +5,6 @@ on: branches: - main - develop - pull_request: - branches: - - main - - develop workflow_dispatch: concurrency: @@ -21,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -32,9 +28,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version @@ -71,7 +67,7 @@ jobs: popd - name: Submit to codecov.io - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: # directory: build/gcov-reports fail_ci_if_error: false diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5d37cb16e..6f308f1b0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -17,10 +17,6 @@ on: - main - develop pull_request: - # The branches below must be a subset of the branches above - branches: - - main - - develop schedule: - cron: '26 7 * * 0' workflow_dispatch: @@ -48,11 +44,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -66,9 +62,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version @@ -84,4 +80,4 @@ jobs: run: cmake --build build -j 2 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index c69cdcfb0..32f8a582f 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -6,7 +6,7 @@ jobs: cpp-linter: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: cpp-linter/cpp-linter-action@v2 id: linter env: @@ -14,7 +14,7 @@ jobs: with: style: file tidy-checks: '' - version: 16 + version: 19 - name: Fail fast?! if: steps.linter.outputs.checks-failed > 0 diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index 95c757645..1a22c2f1c 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -1,12 +1,6 @@ name: Cppcheck -on: - push: - branches: - - main - - develop - pull_request: - workflow_dispatch: +on: [push, pull_request, workflow_dispatch] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -17,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true @@ -28,9 +22,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache cppcheck - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index ddc62b2ab..c5faed706 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -5,17 +5,13 @@ on: branches: - main - develop - pull_request: - branches: - - main - - develop workflow_dispatch: jobs: deploy: runs-on: ubuntu-latest steps: - - uses: DenverCoder1/doxygen-github-pages-action@v1.3.0 + - uses: DenverCoder1/doxygen-github-pages-action@v2.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: gh-pages diff --git a/.github/workflows/linux-clang.yml b/.github/workflows/linux-clang.yml index 26b78285c..04e911b67 100644 --- a/.github/workflows/linux-clang.yml +++ b/.github/workflows/linux-clang.yml @@ -1,12 +1,6 @@ name: Linux Clang -on: - push: - branches: - - main - - develop - pull_request: - workflow_dispatch: +on: [push, pull_request, workflow_dispatch] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -17,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true @@ -28,9 +22,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: clang@18 + +: clang@19 - run: clang --version diff --git a/.github/workflows/linux-gcc.yml b/.github/workflows/linux-gcc.yml index 28076a060..248c1163e 100644 --- a/.github/workflows/linux-gcc.yml +++ b/.github/workflows/linux-gcc.yml @@ -1,12 +1,6 @@ name: Linux GCC -on: - push: - branches: - - main - - develop - pull_request: - workflow_dispatch: +on: [push, pull_request, workflow_dispatch] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -17,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true @@ -28,9 +22,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version diff --git a/.github/workflows/lsan.yml b/.github/workflows/lsan.yml index 8dd0c44f2..6d9755c71 100644 --- a/.github/workflows/lsan.yml +++ b/.github/workflows/lsan.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true @@ -28,9 +28,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: clang@17 + +: clang@19 - run: clang --version diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index a87284c92..8deafba94 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,12 +1,6 @@ name: macOS -on: - push: - branches: - - main - - develop - pull_request: - workflow_dispatch: +on: [workflow_dispatch] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -14,10 +8,10 @@ concurrency: jobs: build: - runs-on: macos-13 + runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/msan.yml b/.github/workflows/msan.yml index a5555a345..00127d398 100644 --- a/.github/workflows/msan.yml +++ b/.github/workflows/msan.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true @@ -28,9 +28,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: clang@17 + +: clang@19 - run: clang --version diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index a0fea53ba..2fde63be8 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -6,9 +6,6 @@ on: - main - develop pull_request: - branches: - - main - - develop workflow_dispatch: concurrency: @@ -22,7 +19,7 @@ jobs: env: BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -32,14 +29,14 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache lcov - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version - name: Install sonar-scanner and build-wrapper - uses: sonarsource/sonarcloud-github-c-cpp@v2 + uses: sonarsource/sonarcloud-github-c-cpp@v3 - name: Restore artifacts or setup vcpkg uses: lukka/run-vcpkg@v11 diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml index fccd39a51..1123abaae 100644 --- a/.github/workflows/tsan.yml +++ b/.github/workflows/tsan.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true @@ -28,9 +28,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: clang@17 + +: clang@19 - run: clang --version diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index a8257dda8..7c03d2b4e 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true @@ -28,9 +28,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache valgrind - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version diff --git a/.github/workflows/whitespace.yml b/.github/workflows/whitespace.yml index 81801448c..430d1310c 100644 --- a/.github/workflows/whitespace.yml +++ b/.github/workflows/whitespace.yml @@ -7,5 +7,5 @@ jobs: name: Find Trailing Whitespace runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: erictleung/find-file-whitespace@main \ No newline at end of file diff --git a/.github/workflows/windows-msvc.yml b/.github/workflows/windows-msvc.yml index a75c22358..97cacc50f 100644 --- a/.github/workflows/windows-msvc.yml +++ b/.github/workflows/windows-msvc.yml @@ -15,7 +15,7 @@ jobs: VCPKG_ROOT: C:\vcpkg steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/windows-pkgx.yml b/.github/workflows/windows-pkgx.yml index 54b59a1d9..9d37437d8 100644 --- a/.github/workflows/windows-pkgx.yml +++ b/.github/workflows/windows-pkgx.yml @@ -15,15 +15,15 @@ jobs: VCPKG_ROOT: C:\vcpkg steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: clang@16 + +: clang@19 - name: Restore artifacts, or setup vcpkg uses: lukka/run-vcpkg@v11 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e636b132..7fc5f91d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,9 +86,6 @@ set(CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE TRUE) # https://howardhinnant.github.io/date/date.html find_package(date CONFIG REQUIRED) -# https://github.com/docopt/docopt.cpp -find_package(docopt CONFIG REQUIRED) - # https://github.com/doctest/doctest find_package(doctest CONFIG REQUIRED) @@ -104,6 +101,8 @@ find_package(Microsoft.GSL CONFIG REQUIRED) # https://www.pcg-random.org find_path(PCG_INCLUDE_DIRS "pcg_extras.hpp") +find_package(Boost REQUIRED COMPONENTS program_options) + # https://github.com/gabime/spdlog find_package(spdlog CONFIG REQUIRED) diff --git a/README.md b/README.md index 183301149..24775d5ef 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,6 @@ including the foundations and recent results, please see the [wiki](https://gith [Causal Dynamical Triangulations][CDT] in [C++] uses the [Computational Geometry Algorithms Library][CGAL], [Boost], [TBB], and [Eigen]. Arbitrary-precision numbers and functions are by [MPFR] and [GMP]. -[docopt] provides a beautiful command-line interface. [Melissa E. O'Neill's Permuted Congruential Generators][PCG] library provides high-quality RNGs that pass L'Ecuyer's [TestU01] statistical tests. [doctest] provides [BDD]/[TDD]. @@ -71,7 +70,6 @@ Arbitrary-precision numbers and functions are by [MPFR] and [GMP]. - [x] 3D Simplex - [x] 3D Spherical triangulation - [x] 2+1 foliation -- [x] Integrate [docopt] CLI - [x] S3 Bulk action - [x] 3D Ergodic moves - [x] High-quality Random Number Generation with M.E. O'Neill's [PCG] library @@ -211,13 +209,12 @@ along with several others. ## Usage -CDT-plusplus uses [docopt] to parse options from the help message, and so +CDT-plusplus uses [program_options] to parse options from the help message, and so understands long or short argument formats, provided the short argument given is an unambiguous match to a longer one. The help message should be instructive: ~~~text ./build/src/cdt --help -cdt started at 2023-01-03.14:44:22PST Causal Dynamical Triangulations in C++ using CGAL. Copyright (c) 2013 Adam Getchell @@ -228,28 +225,38 @@ to the Metropolis algorithm. Specify the number of passes to control how much evolution is desired. Each pass attempts a number of ergodic moves equal to the number of simplices in the simulation. -Usage:./cdt (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES [-d DIM] - [--init INITIAL] [--foliate FOLIATION] -k K --alpha ALPHA - --lambda LAMBDA [-p PASSES] [-c CHECKPOINT] +Usage:./cdt (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES + [-d DIM] + [--init INITIAL RADIUS] + [--foliate FOLIATION SPACING] + -k K + --alpha ALPHA + --lambda LAMBDA + [-p PASSES] + [-c CHECKPOINT] + +Optional arguments are in square brackets. Examples: ./cdt --spherical -n 32000 -t 11 --alpha 0.6 -k 1.1 --lambda 0.1 --passes 1000 -./cdt --s -n32000 -t11 -a.6 -k1.1 -l.1 -p1000 +./cdt -s -n32000 -t11 -a.6 -k1.1 -l.1 -p1000 Options: - -h --help Show this message - --version Show program version - -n SIMPLICES Approximate number of simplices - -t TIMESLICES Number of timeslices - -d DIM Dimensionality [default: 3] - -i --init INITIAL Initial radius [default: 1] - --foliate FOLIATION Foliation spacing between timeslices [default: 1] - -a --alpha ALPHA Negative squared geodesic length of 1-d - timelike edges - -k K K = 1/(8*pi*G_newton) - -l --lambda LAMBDA K * Cosmological constant - -p --passes PASSES Number of passes [default: 100] - -c --checkpoint CHECKPOINT Checkpoint every n passes [default: 10] + -h [ --help ] Show this message + -v [ --version ] Show program version + -s [ --spherical ] Spherical topology + -e [ --toroidal ] Toroidal topology + -n [ --simplices ] arg Approximate number of simplices + -t [ --timeslices ] arg Number of timeslices + -d [ --dimensions ] arg (=3) Dimensionality + -i [ --init ] arg (=1) Initial radius + -f [ --foliate ] arg (=1) Foliation spacing + -a [ --alpha ] arg Negative squared geodesic length of 1-d + timelike edges + -k [ --k ] arg K = 1/(8*pi*G_newton) + -l [ --lambda ] arg K * Cosmological constant + -p [ --passes ] arg (=100) Number of passes + -c [ --checkpoint ] arg (=10) Checkpoint every n passes ~~~ The dimensionality of the spacetime is such that each slice of spacetime is @@ -262,8 +269,7 @@ links (in 2+1 spacetime), and the timelike faces (in 3+1 spacetime). ## Documentation -Online documentation is at automatically -generated by [Travis-CI]. +Online documentation is at . If you have [Doxygen] installed you can generate the same information locally using the configuration file in `docs\Doxyfile` by simply typing at the top @@ -406,11 +412,10 @@ Optional: ## Issues - [vcpkg]'s version of [date] has an unfixed bug [#23637] which produces `use-of-uninitialized-value` in [MemorySanitizer]. +- [vcpkg] has issues with `fontconfig:arm64-osx` [#40623]. -- [docopt] also has a `use-of-uninitialized-value` bug ([#149]). - +[#40623]: https://github.com/microsoft/vcpkg/issues/40623 [#23637]: https://github.com/microsoft/vcpkg/issues/23637 -[#149]: https://github.com/docopt/docopt.cpp/issues/149 [CDT]: https://arxiv.org/abs/hep-th/0105267 [CGAL]: https://www.cgal.org [CMake]: https://www.cmake.org @@ -425,7 +430,7 @@ Optional: [Doxygen]: http://www.doxygen.org [Homebrew]: https://brew.sh [Ninja]: https://ninja-build.org -[docopt]: https://github.com/docopt/docopt.cpp +[program_options]: https://www.boost.org/doc/libs/1_85_0/doc/html/program_options/tutorial.html [Mathjax]: https://www.mathjax.org [GraphViz]: https://www.graphviz.org [Eigen]: http://eigen.tuxfamily.org/index.php?title=Main_Page diff --git a/cmake/StandardProjectSettings.cmake b/cmake/StandardProjectSettings.cmake index 8990f3300..bdd7314b1 100644 --- a/cmake/StandardProjectSettings.cmake +++ b/cmake/StandardProjectSettings.cmake @@ -54,3 +54,9 @@ add_definitions(-DCGAL_TRIANGULATION_NO_ASSERTIONS -DCGAL_TRIANGULATION_NO_POSTC # Easier navigation in an IDE when projects are organized in folders. set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +# Check if the compiler is MSVC +if (MSVC) + # Add /utf-8 flag to MSVC + add_compile_options(/utf-8) +endif() diff --git a/include/Ergodic_moves_3.hpp b/include/Ergodic_moves_3.hpp index 3ca14498b..2de25aca4 100644 --- a/include/Ergodic_moves_3.hpp +++ b/include/Ergodic_moves_3.hpp @@ -333,9 +333,8 @@ namespace ergodic_moves /// @param manifold The simplicial manifold /// @param candidate The vertex to check /// @returns True if (6,2) move is possible - [[nodiscard]] inline auto is_62_movable(Manifold const& manifold, - Vertex_handle const& candidate) - -> bool + [[nodiscard]] inline auto is_62_movable( + Manifold const& manifold, Vertex_handle const& candidate) -> bool { if (manifold.dimensionality() != 3) { @@ -485,8 +484,8 @@ namespace ergodic_moves /// @see /// https://github.com/CGAL/cgal/blob/8430d04539179f25fb8e716f99e19d28589beeda/TDS_3/include/CGAL/Triangulation_data_structure_3.h#L2094 [[nodiscard]] inline auto incident_cells_from_edge( - Delaunay_t<3> const& triangulation, Edge_handle const& edge) - -> std::optional + Delaunay_t<3> const& triangulation, + Edge_handle const& edge) -> std::optional { if (!triangulation.tds().is_edge(edge.first, edge.second, edge.third)) { @@ -519,8 +518,8 @@ namespace ergodic_moves /// @param t_edge_candidate The edge to check /// @returns A container of incident cells if there are exactly 4 or nullopt [[nodiscard]] inline auto find_bistellar_flip_location( - Delaunay const& triangulation, Edge_handle const& t_edge_candidate) - -> std::optional + Delaunay const& triangulation, + Edge_handle const& t_edge_candidate) -> std::optional { if (auto incident_cells = incident_cells_from_edge(triangulation, t_edge_candidate); @@ -565,10 +564,9 @@ namespace ergodic_moves /// @param top Top vertex of the cells being flipped /// @param bottom Bottom vertex of the cells being flipped /// @returns A flipped triangulation or nullopt - [[nodiscard]] inline auto bistellar_flip(Delaunay triangulation, - Edge_handle edge, Vertex_handle top, - Vertex_handle bottom) - -> std::optional + [[nodiscard]] inline auto bistellar_flip( + Delaunay triangulation, Edge_handle edge, Vertex_handle top, + Vertex_handle bottom) -> std::optional { // Get the cells incident to the edge auto incident_cells = get_incident_cells(triangulation, edge); @@ -841,10 +839,9 @@ namespace ergodic_moves /// @param t_after The manifold after the move /// @param t_move The type of move /// @return True if the move correctly changed the triangulation - [[nodiscard]] inline auto check_move(Manifold const& t_before, - Manifold const& t_after, - move_tracker::move_type const& t_move) - -> bool + [[nodiscard]] inline auto check_move( + Manifold const& t_before, Manifold const& t_after, + move_tracker::move_type const& t_move) -> bool { switch (t_move) { diff --git a/include/Foliated_triangulation.hpp b/include/Foliated_triangulation.hpp index 2594a9306..4b5e23849 100644 --- a/include/Foliated_triangulation.hpp +++ b/include/Foliated_triangulation.hpp @@ -901,7 +901,7 @@ namespace foliated_triangulations { causal_vertices.emplace_back(*gen++, i + 1); } // j - } // i + } // i return causal_vertices; } // make_foliated_ball diff --git a/include/Geometry.hpp b/include/Geometry.hpp index daae3714b..192f98da8 100644 --- a/include/Geometry.hpp +++ b/include/Geometry.hpp @@ -99,7 +99,7 @@ struct [[nodiscard("This contains data!")]] Geometry<3> swap(swap_from.N1_SL, swap_into.N1_SL); swap(swap_from.N0, swap_into.N0); } // swap -}; // struct Geometry<3> +}; // struct Geometry<3> using Geometry_3 = Geometry<3>; diff --git a/include/Metropolis.hpp b/include/Metropolis.hpp index 6b66f2af2..3c2def28f 100644 --- a/include/Metropolis.hpp +++ b/include/Metropolis.hpp @@ -493,7 +493,7 @@ class MoveStrategy m_failed_moves.four_four_moves()); } } // print_results -}; // Metropolis +}; // Metropolis using Metropolis_3 = MoveStrategy; diff --git a/include/Move_tracker.hpp b/include/Move_tracker.hpp index d85f8c161..c8616e211 100644 --- a/include/Move_tracker.hpp +++ b/include/Move_tracker.hpp @@ -79,7 +79,7 @@ namespace move_tracker if (dim == 3) { return NUMBER_OF_3D_MOVES; } if (dim == 4) { return NUMBER_OF_4D_MOVES; } return 0; // Error condition - } // moves_per_dimension + } // moves_per_dimension /** * \brief The data and methods to track ergodic moves diff --git a/include/Utilities.hpp b/include/Utilities.hpp index 9daf4eda2..a65dc1359 100644 --- a/include/Utilities.hpp +++ b/include/Utilities.hpp @@ -49,8 +49,8 @@ enum class topology_type /// @param t_os The output stream /// @param t_topology The topology /// @returns An output string of the topology -inline auto operator<<(std::ostream& t_os, topology_type const& t_topology) - -> std::ostream& +inline auto operator<<(std::ostream& t_os, + topology_type const& t_topology) -> std::ostream& { switch (t_topology) { @@ -90,13 +90,11 @@ namespace utilities /// @param t_initial_radius The radius of the first foliation t=1 /// @param t_foliation_spacing The spacing between foliations /// @returns A filename - [[nodiscard]] inline auto make_filename(topology_type const& t_topology, - Int_precision t_dimension, - Int_precision t_number_of_simplices, - Int_precision t_number_of_timeslices, - double t_initial_radius, - double t_foliation_spacing) noexcept - -> std::filesystem::path + [[nodiscard]] inline auto make_filename( + topology_type const& t_topology, Int_precision t_dimension, + Int_precision t_number_of_simplices, Int_precision t_number_of_timeslices, + double t_initial_radius, + double t_foliation_spacing) noexcept -> std::filesystem::path { std::string filename; if (t_topology == topology_type::SPHERICAL) { filename += "S"; } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 84df5894c..2566b8688 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,32 +1,15 @@ add_executable(initialize ${PROJECT_SOURCE_DIR}/src/initialize.cpp) - -# On macOS and Linux docopt builds an intermediate object, thus different targets than Windows See -# https://github.com/microsoft/vcpkg/issues/8666 -if(WIN32 OR APPLE) - target_link_libraries( - initialize - PRIVATE project_options - project_warnings - date::date-tz - docopt - fmt::fmt-header-only - Eigen3::Eigen - spdlog::spdlog_header_only - TBB::tbb - CGAL::CGAL) -else() - target_link_libraries( - initialize - PRIVATE project_options - project_warnings - date::date-tz - docopt_s - fmt::fmt-header-only - Eigen3::Eigen - spdlog::spdlog_header_only - TBB::tbb - CGAL::CGAL) -endif() +target_link_libraries( + initialize + PRIVATE project_options + project_warnings + date::date-tz + Boost::program_options + fmt::fmt-header-only + Eigen3::Eigen + spdlog::spdlog_header_only + TBB::tbb + CGAL::CGAL) target_compile_features(initialize PRIVATE cxx_std_20) add_executable(cdt-opt ${PROJECT_SOURCE_DIR}/src/cdt-opt.cpp) @@ -43,31 +26,17 @@ target_link_libraries( target_compile_features(cdt-opt PRIVATE cxx_std_20) add_executable(cdt ${PROJECT_SOURCE_DIR}/src/cdt.cpp) -if(WIN32 OR APPLE) - target_link_libraries( - cdt - PRIVATE project_options - project_warnings - date::date-tz - docopt - fmt::fmt-header-only - Eigen3::Eigen - spdlog::spdlog_header_only - TBB::tbb - CGAL::CGAL) -else() - target_link_libraries( - cdt - PRIVATE project_options - project_warnings - date::date-tz - docopt_s - fmt::fmt-header-only - Eigen3::Eigen - spdlog::spdlog_header_only - TBB::tbb - CGAL::CGAL) -endif() +target_link_libraries( + cdt + PRIVATE project_options + project_warnings + date::date-tz + Boost::program_options + fmt::fmt-header-only + Eigen3::Eigen + spdlog::spdlog_header_only + TBB::tbb + CGAL::CGAL) target_compile_features(cdt PRIVATE cxx_std_20) # Build cdt-viewer locally, but not in CI since QT takes more than an hour to build there @@ -78,7 +47,7 @@ if(APPLE AND NOT ($ENV{CI})) PRIVATE project_options project_warnings date::date-tz - docopt + Boost::program_options fmt::fmt-header-only Eigen3::Eigen spdlog::spdlog_header_only @@ -107,29 +76,29 @@ endif() # Tests ## # -add_test(NAME cdt COMMAND $ --s -n127 -t4 -a0.6 -k1.1 -l0.1 -p10) +add_test(NAME cdt COMMAND $ -s -n127 -t4 -a0.6 -k1.1 -l0.1 -p10) set_tests_properties(cdt PROPERTIES PASS_REGULAR_EXPRESSION "Writing to file S3-4-") -add_test(NAME cdt-triangle-inequalities COMMAND $ --s -n64 -t3 -a0.4 -k1.1 -l0.1) +add_test(NAME cdt-triangle-inequalities COMMAND $ -s -n64 -t3 -a0.4 -k1.1 -l0.1) set_tests_properties(cdt-triangle-inequalities PROPERTIES PASS_REGULAR_EXPRESSION "Triangle inequalities violated") -add_test(NAME cdt-dimensionality COMMAND $ --s -n64 -t3 -d4 -a0.4 -k1.1 -l0.1) +add_test(NAME cdt-dimensionality COMMAND $ -s -n64 -t3 -d4 -a0.4 -k1.1 -l0.1) set_tests_properties(cdt-dimensionality PROPERTIES PASS_REGULAR_EXPRESSION "Currently, dimensions cannot be >3.") -add_test(NAME cdt-toroidal COMMAND $ --t -n64 -t3 -a0.6 -k1.1 -l0.1) +add_test(NAME cdt-toroidal COMMAND $ -e -n64 -t3 -a0.6 -k1.1 -l0.1) set_tests_properties(cdt-toroidal PROPERTIES PASS_REGULAR_EXPRESSION "Toroidal triangulations not yet supported.") -add_test(NAME initialize COMMAND $ --s -n640 -t4 -o) +add_test(NAME initialize COMMAND $ -s -n640 -t4 -o) set_tests_properties(initialize PROPERTIES PASS_REGULAR_EXPRESSION "Writing to file S3-4") -add_test(NAME initialize-minimum-simplices COMMAND $ --s -n1 -t1 -o) +add_test(NAME initialize-minimum-simplices COMMAND $ -s -n1 -t1 -o) set_tests_properties(initialize-minimum-simplices PROPERTIES PASS_REGULAR_EXPRESSION "Simplices and timeslices should be greater or equal to 2.") -add_test(NAME initialize-dimensionality COMMAND $ --s -n64 -t3 -d4 -o) +add_test(NAME initialize-dimensionality COMMAND $ -s -n64 -t3 -d4 -o) set_tests_properties(initialize-dimensionality PROPERTIES PASS_REGULAR_EXPRESSION "Currently, dimensions cannot be >3.") -add_test(NAME initialize-toroidal COMMAND $ --t -n64 -t3 -o) +add_test(NAME initialize-toroidal COMMAND $ -e -n64 -t3 -o) set_tests_properties(initialize-toroidal PROPERTIES PASS_REGULAR_EXPRESSION "Toroidal triangulations not yet supported.") diff --git a/src/bistellar-flip.cpp b/src/bistellar-flip.cpp index 064edcfa5..b2fc4721c 100644 --- a/src/bistellar-flip.cpp +++ b/src/bistellar-flip.cpp @@ -18,7 +18,7 @@ Copyright © 2023 Adam Getchell #endif #define DOCTEST_CONFIG_IMPLEMENT -#include + #include #include diff --git a/src/cdt-viewer.cpp b/src/cdt-viewer.cpp index 0fd94889e..f2a498490 100644 --- a/src/cdt-viewer.cpp +++ b/src/cdt-viewer.cpp @@ -14,14 +14,17 @@ Copyright © 2022 Adam Getchell #include #define DOCTEST_CONFIG_IMPLEMENT -#include + #include #include +#include + #include "Manifold.hpp" #include "Utilities.hpp" -/// Help message parsed by docopt into command line arguments +namespace po = boost::program_options; + static auto constexpr USAGE = R"(Causal Dynamical Triangulations in C++ using CGAL. @@ -31,13 +34,9 @@ A program that views 3D triangulated spacetimes with a defined causal structure. Specify the filename of the triangulation to view. Usage: - cdt-viewer [options] + cdt-viewer -f FILENAME -Options: - -h --help Show this screen. - --version Show version. - --dry-run Don't actually do anything. -)"; +Options)"; auto main(int const argc, char* const argv[]) -> int try @@ -58,24 +57,42 @@ try // used during the next evaluation of RUN_ALL_TESTS, // which will lead to wrong results - // docopt option parser - std::string const usage_string{USAGE}; - std::map args = - docopt::docopt(usage_string, {argv + 1, argv + argc}, - true, // show help if requested - "cdt-viewer 1.0"); // version string + std::string const intro{USAGE}; + // Parsed arguments + std::string filename; + + po::options_description description(intro); + description.add_options()("help,h", "Show this message")( + "version,v", "Show program version")("dry-run", + "Don't actually do anything")( + "filename,f", po::value(&filename), + "Filename of triangulation to view"); + + po::variables_map args; + po::store(po::parse_command_line(argc, argv, description), args); + po::notify(args); + + if (args.count("help")) + { + std::cout << description << "\n"; + return res + EXIT_SUCCESS; + } - // Parse filename from arguments - auto filename = args[""].asString(); + if (args.count("version")) + { + fmt::print("cdt-viewer 1.0\n"); + return res + EXIT_SUCCESS; + } - if (args["--dry-run"].asBool()) + if (args.count("dry-run")) { fmt::print("Dry run. Exiting.\n"); return res + EXIT_SUCCESS; } fmt::print("cdt-viewer started at {}\n", utilities::current_date_time()); - fmt::print("Reading triangulation from file {}\n", filename); + fmt::print("Reading triangulation from file {}\n", + std::string_view(filename)); // Read from file auto const dt_in = utilities::read_file>(filename); diff --git a/src/cdt.cpp b/src/cdt.cpp index 0894bb676..f37f9d55d 100644 --- a/src/cdt.cpp +++ b/src/cdt.cpp @@ -11,13 +11,14 @@ /// https://github.com/ucdavis/CDT. #include -#include +#include #include using Timer = CGAL::Real_timer; using namespace std; +namespace po = boost::program_options; /// Help message parsed by docopt into options static string_view constexpr USAGE{ @@ -31,29 +32,23 @@ to the Metropolis algorithm. Specify the number of passes to control how much evolution is desired. Each pass attempts a number of ergodic moves equal to the number of simplices in the simulation. -Usage:./cdt (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES [-d DIM] - [--init INITIAL] [--foliate FOLIATION] -k K --alpha ALPHA - --lambda LAMBDA [-p PASSES] [-c CHECKPOINT] +Usage:./cdt (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES + [-d DIM] + [--init INITIAL RADIUS] + [--foliate FOLIATION SPACING] + -k K + --alpha ALPHA + --lambda LAMBDA + [-p PASSES] + [-c CHECKPOINT] + +Optional arguments are in square brackets. Examples: ./cdt --spherical -n 32000 -t 11 --alpha 0.6 -k 1.1 --lambda 0.1 --passes 1000 -./cdt --s -n32000 -t11 -a.6 -k1.1 -l.1 -p1000 - -Options: - -h --help Show this message - --version Show program version - -n SIMPLICES Approximate number of simplices - -t TIMESLICES Number of timeslices - -d DIM Dimensionality [default: 3] - -i --init INITIAL Initial radius [default: 1] - --foliate FOLIATION Foliation spacing between timeslices [default: 1] - -a --alpha ALPHA Negative squared geodesic length of 1-d - timelike edges - -k K K = 1/(8*pi*G_newton) - -l --lambda LAMBDA K * Cosmological constant - -p --passes PASSES Number of passes [default: 100] - -c --checkpoint CHECKPOINT Checkpoint every n passes [default: 10] -)"}; +./cdt -s -n32000 -t11 -a.6 -k1.1 -l.1 -p1000 + +Options)"}; /// @brief The main path of the CDT++ program /// @param argc Argument count = 1 + number of arguments @@ -62,33 +57,86 @@ Usage:./cdt (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES [-d DIM] auto main(int const argc, char* const argv[]) -> int try { - // Start running time - Timer timer; - timer.start(); - fmt::print("cdt started at {}\n", utilities::current_date_time()); + std::string const intro{USAGE}; + // Parsed arguments + topology_type topology; + long long simplices; + long long timeslices; + long long dimensions; + double initial_radius; + double foliation_spacing; + long double alpha; + long double k; + long double lambda; + long long passes; + long long checkpoint; + + po::options_description description(intro); + description.add_options()("help,h", "Show this message")( + "version,v", "Show program version")("spherical,s", "Spherical topology")( + "toroidal,e", "Toroidal topology")("simplices,n", + po::value(&simplices), + "Approximate number of simplices")( + "timeslices,t", po::value(×lices), + "Number of timeslices")( + "dimensions,d", po::value(&dimensions)->default_value(3), + "Dimensionality")("init,i", + po::value(&initial_radius)->default_value(1.0), + "Initial radius")( + "foliate,f", po::value(&foliation_spacing)->default_value(1.0), + "Foliation spacing")( + "alpha,a", po::value(&alpha), + "Negative squared geodesic length of 1-d timelike edges")( + "k,k", po::value(&k), "K = 1/(8*pi*G_newton)")( + "lambda,l", po::value(&lambda), "K * Cosmological constant")( + "passes,p", po::value(&passes)->default_value(100), + "Number of passes")("checkpoint,c", + po::value(&checkpoint)->default_value(10), + "Checkpoint every n passes"); + + po::variables_map args; + po::store(po::parse_command_line(argc, argv, description), args); + po::notify(args); - // docopt option parser - std::string const usage_string{USAGE}; - std::map> args = - docopt::docopt(usage_string, {argv + 1, argv + argc}, - true, // print help message automatically - "CDT 0.1.8"); // Version - - // Parse docopt::values in args map - auto const simplices = stoll(args["-n"].asString()); - auto const timeslices = stoll(args["-t"].asString()); - auto const dimensions = stoll(args["-d"].asString()); - auto const initial_radius = stod(args["--init"].asString()); - auto const foliation_spacing = stod(args["--foliate"].asString()); - auto const alpha = stold(args["--alpha"].asString()); - auto const k = stold(args["-k"].asString()); // NOLINT - auto const lambda = stold(args["--lambda"].asString()); - auto const passes = stoll(args["--passes"].asString()); - auto const checkpoint = stoll(args["--checkpoint"].asString()); - - // Topology of simulation - auto const topology = args["--spherical"].asBool() ? topology_type::SPHERICAL - : topology_type::TOROIDAL; + if (args.count("help")) + { + cout << description << "\n"; + return EXIT_SUCCESS; + } + + if (args.count("version")) + { + fmt::print("CDT++ version 0.1.8\n"); + return EXIT_SUCCESS; + } + + if (args.count("spherical")) { topology = topology_type::SPHERICAL; } + else if (args.count("toroidal")) { topology = topology_type::TOROIDAL; } + else + { + fmt::print("Topology not specified.\n"); + return EXIT_FAILURE; + } + + if (args.count("simplices")) + { + simplices = args["simplices"].as(); + } + else + { + fmt::print("Number of simplices not specified.\n"); + return EXIT_FAILURE; + } + + if (args.count("timeslices")) + { + timeslices = args["timeslices"].as(); + } + else + { + fmt::print("Number of timeslices not specified.\n"); + return EXIT_FAILURE; + } // Display job parameters fmt::print("Topology is {}\n", utilities::topology_to_str(topology)); @@ -104,6 +152,11 @@ try fmt::print("K: {}\n", k); fmt::print("Lambda: {}\n", lambda); + // Start running time + Timer timer; + timer.start(); + fmt::print("cdt started at {}\n", utilities::current_date_time()); + if (simplices < 2 || timeslices < 2) { timer.stop(); diff --git a/src/initialize.cpp b/src/initialize.cpp index 361cc15aa..0ac7b47c3 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -8,13 +8,13 @@ /// @brief Generates initial spacetimes /// @author Adam Getchell -#include +#include #include "Manifold.hpp" using namespace std; +namespace po = boost::program_options; -/// Help message parsed by docopt into options static string_view constexpr USAGE{ R"(Causal Dynamical Triangulations in C++ using CGAL. @@ -23,48 +23,100 @@ Copyright (c) 2014 Adam Getchell A program that generates d-dimensional triangulated spacetimes with a defined causal structure. Specify the topology of the triangulation (spherical or toroidal), the desired number of simplices, and the -desired number of timeslices. Optionally, the spacetime dimension may -also be given. +desired number of timeslices. -Usage:./initialize (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES [-d DIM] [-i INIT] [-f FOL] [-o] +Usage:./initialize (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES + [-d DIM] + [--init INITIAL RADIUS] + [--foliate FOLIATION SPACING] + [--output] + +Optional arguments are in square brackets. Examples: -./initialize --spherical -n 32000 -t 11 --init 1 --foliate 1 -./initialize --s -n32000 -t11 - -Options: - -h --help Show this message - --version Show program version - -n SIMPLICES Approximate number of simplices - -t TIMESLICES Number of timeslices - -d DIM Dimensionality [default: 3] - -i --init INIT Initial radius [default: 1] - -f --foliate FOL Foliation spacing [default: 1] - -o --output Save triangulation into OFF file -)"}; +./initialize --spherical --simplices 32000 --timeslices 11 --init 1.0 --foliate 1.0 --output +./initialize -s -n32000 -t11 -i1.0 -f1.0 -o + +Options)"}; auto main(int const argc, char* const argv[]) -> int try { - // docopt option parser - std::string const usage_string{USAGE}; - std::map args = docopt::docopt( - usage_string, {argv + 1, argv + argc}, true, "initializer 1.0"); - - auto const simplices = stoll(args["-n"].asString()); - auto const timeslices = stoll(args["-t"].asString()); - auto const dimensions = stoll(args["-d"].asString()); - auto const initial_radius = stod(args["--init"].asString()); - auto const foliation_spacing = stod(args["--foliate"].asString()); - auto const save_file = args["--output"].asBool(); + std::string const intro{USAGE}; + // Parsed arguments + topology_type topology; + long long simplices; + long long timeslices; + long long dimensions; + double initial_radius; + double foliation_spacing; + bool save_file; + + po::options_description description(intro); + description.add_options()("help,h", "Show this message")( + "version,v", "Show program version")("spherical,s", "Spherical topology")( + "toroidal,e", "Toroidal topology")("simplices,n", + po::value(&simplices), + "Approximate number of simplices")( + "timeslices,t", po::value(×lices), + "Number of timeslices")( + "dimensions,d", po::value(&dimensions)->default_value(3), + "Dimensionality")("init,i", + po::value(&initial_radius)->default_value(1.0), + "Initial radius")( + "foliate,f", po::value(&foliation_spacing)->default_value(1.0), + "Foliation spacing")("output,o", "Save triangulation into OFF file"); + + po::variables_map args; + po::store(po::parse_command_line(argc, argv, description), args); + po::notify(args); + + if (args.count("help")) + { + cout << description << "\n"; + return EXIT_SUCCESS; + } + + if (args.count("version")) + { + fmt::print("CDT initializer version 1.0\n"); + return EXIT_SUCCESS; + } + + if (args.count("spherical")) { topology = topology_type::SPHERICAL; } + else if (args.count("toroidal")) { topology = topology_type::TOROIDAL; } + else + { + fmt::print("Topology not specified.\n"); + return EXIT_FAILURE; + } + + if (args.count("simplices")) + { + simplices = args["simplices"].as(); + } + else + { + fmt::print("Number of simplices not specified.\n"); + return EXIT_FAILURE; + } + + if (args.count("timeslices")) + { + timeslices = args["timeslices"].as(); + } + else + { + fmt::print("Number of timeslices not specified.\n"); + return EXIT_FAILURE; + } + + if (args.count("output")) { save_file = true; } + else { save_file = false; } // Initialize triangulation manifolds::Manifold_3 universe; - // Topology of simulation - auto const topology = args["--spherical"].asBool() ? topology_type::SPHERICAL - : topology_type::TOROIDAL; - // Display job parameters fmt::print("Topology is {}\n", utilities::topology_to_str(topology)); fmt::print("Number of dimensions = {}\n", dimensions); diff --git a/tests/Ergodic_moves_3_test.cpp b/tests/Ergodic_moves_3_test.cpp index 7ca90aa36..9e5a78491 100644 --- a/tests/Ergodic_moves_3_test.cpp +++ b/tests/Ergodic_moves_3_test.cpp @@ -388,7 +388,7 @@ SCENARIO("Perform ergodic moves on the minimal manifold necessary (4,4) moves" * }; vector timevalues{0, 1, 1, 1, 1, 2}; auto causal_vertices = make_causal_vertices<3>(vertices, timevalues); - Manifold_3 manifold(causal_vertices, 0, 1); + Manifold_3 manifold(causal_vertices, 0, 1); // Verify we have 4 vertices, 4 edges, 4 faces, and 4 simplices REQUIRE_EQ(manifold.vertices(), 6); REQUIRE_EQ(manifold.edges(), 13); diff --git a/tests/Foliated_triangulation_test.cpp b/tests/Foliated_triangulation_test.cpp index 3fade86de..5cf7181e6 100644 --- a/tests/Foliated_triangulation_test.cpp +++ b/tests/Foliated_triangulation_test.cpp @@ -128,10 +128,10 @@ SCENARIO("FoliatedTriangulation free functions" * GIVEN("A vector of points and timevalues.") { - vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), + vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), Point_t<3>(0, 0, 1), Point_t<3>(RADIUS_2, RADIUS_2, RADIUS_2)}; - vector const Timevalues{1, 1, 1, 2}; + vector const Timevalues{1, 1, 1, 2}; WHEN("Causal vertices are created.") { auto causal_vertices = make_causal_vertices<3>(Vertices, Timevalues); @@ -152,10 +152,10 @@ SCENARIO("FoliatedTriangulation free functions" * } GIVEN("A mismatched set of points and timevalues.") { - vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), + vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), Point_t<3>(0, 0, 1), Point_t<3>(RADIUS_2, RADIUS_2, RADIUS_2)}; - vector const Timevalues{1, 1, 1}; + vector const Timevalues{1, 1, 1}; WHEN("Causal vertices are created.") { THEN("An exception is thrown.") diff --git a/tests/Manifold_test.cpp b/tests/Manifold_test.cpp index f6cd34f23..886c0bd4e 100644 --- a/tests/Manifold_test.cpp +++ b/tests/Manifold_test.cpp @@ -118,10 +118,10 @@ SCENARIO("Manifold free functions" * doctest::test_suite("manifold")) GIVEN("A vector of points and timevalues.") { - vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), + vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), Point_t<3>(0, 0, 1), Point_t<3>(RADIUS_2, RADIUS_2, RADIUS_2)}; - vector const Timevalues{1, 1, 1, 2}; + vector const Timevalues{1, 1, 1, 2}; WHEN("Causal vertices are created.") { auto causal_vertices = @@ -143,10 +143,10 @@ SCENARIO("Manifold free functions" * doctest::test_suite("manifold")) } GIVEN("A mismatched set of points and timevalues.") { - vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), + vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), Point_t<3>(0, 0, 1), Point_t<3>(RADIUS_2, RADIUS_2, RADIUS_2)}; - vector const Timevalues{1, 1, 1}; + vector const Timevalues{1, 1, 1}; WHEN("Causal vertices are created.") { THEN("An exception is thrown.") @@ -468,7 +468,7 @@ SCENARIO("3-Manifold function checks" * doctest::test_suite("manifold")) THEN("There is only one vertex, the infinite vertex.") { Manifold_3 const manifold; - auto&& vertices = + auto&& vertices = manifold.get_triangulation().get_delaunay().tds().vertices(); auto&& vertex = vertices.begin(); diff --git a/tests/Tetrahedron_test.cpp b/tests/Tetrahedron_test.cpp index ef3fa45f7..67b4e2c68 100644 --- a/tests/Tetrahedron_test.cpp +++ b/tests/Tetrahedron_test.cpp @@ -24,7 +24,7 @@ static inline auto constexpr RADIUS_2 = 2.0 * std::numbers::inv_sqrt3_v; SCENARIO("Construct a tetrahedron in a Delaunay triangulation" * doctest::test_suite("tetrahedron")) { - using Point = Point_t<3>; + using Point = Point_t<3>; GIVEN("A vector of 4 vertices.") { vector vertices{ diff --git a/tests/Utilities_test.cpp b/tests/Utilities_test.cpp index eb7fb8252..a8773ca1a 100644 --- a/tests/Utilities_test.cpp +++ b/tests/Utilities_test.cpp @@ -10,6 +10,7 @@ /// @details Tests for random, conversion, and datetime functions. #include +#include #include #include @@ -17,8 +18,6 @@ using namespace std; using namespace utilities; -// static inline auto constexpr NUMBER_OF_VALUES = 6; - SCENARIO("Various string/stream/time utilities" * doctest::test_suite("utilities")) { @@ -57,7 +56,7 @@ SCENARIO("Various string/stream/time utilities" * { // Update test yearly auto const result = current_date_time(); - auto const year = result.find("2023"); + auto const year = result.find("2024"); CHECK_NE(year, std::string::npos); // Human verification fmt::print("Current date and time is: {}\n", current_date_time()); @@ -165,8 +164,7 @@ SCENARIO("Reading and writing Delaunay triangulations to files" * } } -SCENARIO("Randomizing functions" * doctest::test_suite("utilities") * - doctest::may_fail()) +SCENARIO("Randomizing functions" * doctest::test_suite("utilities")) { spdlog::debug("Randomizing functions.\n"); GIVEN("A PCG die roller") @@ -199,15 +197,15 @@ SCENARIO("Randomizing functions" * doctest::test_suite("utilities") * { WHEN("We generate six different random integers within the range.") { - auto constexpr min = 64; - auto constexpr max = 6400; - auto const value1 = generate_random_int(min, max); - auto const value2 = generate_random_int(min, max); - auto const value3 = generate_random_int(min, max); - auto const value4 = generate_random_int(min, max); - auto const value5 = generate_random_int(min, max); - auto const value6 = generate_random_int(min, max); - array container = {value1, value2, value3, value4, value5, value6}; + auto constexpr min = 64; + auto constexpr max = 6400; + auto const value1 = generate_random_int(min, max); + auto const value2 = generate_random_int(min, max); + auto const value3 = generate_random_int(min, max); + auto const value4 = generate_random_int(min, max); + auto const value5 = generate_random_int(min, max); + auto const value6 = generate_random_int(min, max); + array container = {value1, value2, value3, value4, value5, value6}; THEN("They should all fall within the range and all be different.") { // All elements are >= min @@ -230,14 +228,14 @@ SCENARIO("Randomizing functions" * doctest::test_suite("utilities") * { WHEN("We generate six different timeslices within the range.") { - auto constexpr max = 256; - auto const value1 = generate_random_timeslice(max); - auto const value2 = generate_random_timeslice(max); - auto const value3 = generate_random_timeslice(max); - auto const value4 = generate_random_timeslice(max); - auto const value5 = generate_random_timeslice(max); - auto const value6 = generate_random_timeslice(max); - array container = {value1, value2, value3, value4, value5, value6}; + auto constexpr max = 256; + auto const value1 = generate_random_timeslice(max); + auto const value2 = generate_random_timeslice(max); + auto const value3 = generate_random_timeslice(max); + auto const value4 = generate_random_timeslice(max); + auto const value5 = generate_random_timeslice(max); + auto const value6 = generate_random_timeslice(max); + array container = {value1, value2, value3, value4, value5, value6}; THEN("They should all fall within the range and be different.") { auto constexpr min = 1; @@ -275,13 +273,13 @@ SCENARIO("Randomizing functions" * doctest::test_suite("utilities") * { WHEN("We generate six probabilities.") { - auto const value1 = generate_probability(); - auto const value2 = generate_probability(); - auto const value3 = generate_probability(); - auto const value4 = generate_probability(); - auto const value5 = generate_probability(); - auto const value6 = generate_probability(); - array container = {value1, value2, value3, value4, value5, value6}; + auto const value1 = generate_probability(); + auto const value2 = generate_probability(); + auto const value3 = generate_probability(); + auto const value4 = generate_probability(); + auto const value5 = generate_probability(); + auto const value6 = generate_probability(); + array container = {value1, value2, value3, value4, value5, value6}; THEN("They should all be different.") { diff --git a/vcpkg.json b/vcpkg.json index 3043d2eed..215b18ed7 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -2,9 +2,9 @@ "name": "cdt-plusplus", "version": "0.1.8", "dependencies": [ + "boost-program-options", "doctest", "date", - "docopt", "fmt", "ms-gsl", "eigen3",