diff --git a/CMakeLists.txt b/CMakeLists.txt index d4f572e..9f1c6fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ target_include_directories(OpenABF $ $ ) -target_compile_features(OpenABF INTERFACE cxx_std_17) +target_compile_features(OpenABF INTERFACE cxx_std_20) set_target_properties(OpenABF PROPERTIES PUBLIC_HEADER "${public_hdrs}" diff --git a/README.md b/README.md index d5fed8c..d01162c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ The templated interface is designed for simple out-of-the-box use, and integration with existing geometric processing pipelines is quick and easy. ## Dependencies -- C++17 compiler +- C++20 compiler - [Eigen 3.3+](http://eigen.tuxfamily.org/) - CMake 3.15+ (optional) @@ -161,7 +161,7 @@ path. As OpenABF depends upon the Eigen library, you will also need to add the Eigen headers to your include path: ```shell -g++ -I /path/to/eigen/ -std=c++17 -DNDEBUG -O3 main.cpp -o main +g++ -I /path/to/eigen/ -std=c++20 -DNDEBUG -O3 main.cpp -o main ``` > [!IMPORTANT] @@ -175,8 +175,8 @@ automatically conformant with the C++ standard in all cases. This may lead to the following issues when compiling against OpenABF. > [!NOTE] -> As this project only supports C++17 and up, you should always compile -with at least `/std:c++17`. +> As this project only supports C++20 and up, you should always compile +with at least `/std:c++20`. #### Undeclared identifier errors diff --git a/conductor/code_styleguides/cpp.md b/conductor/code_styleguides/cpp.md index f4218c3..0fcc005 100644 --- a/conductor/code_styleguides/cpp.md +++ b/conductor/code_styleguides/cpp.md @@ -42,7 +42,7 @@ Setters on instance configuration follow the instance-method rule: `set_( Pre-2026 code in several places uses `camelCase` for instance methods and `detail::` free functions (e.g., `setLevelRatio`, `detail::lscm::buildSystem`, `DecimationMesh::tryCollapse`). These are tracked for rename in issue #94. New code must follow the table above. ## C++ Standards -- **Standard**: C++17 required; do not use C++20 features in public headers without a guard +- **Standard**: C++20 required - **Headers**: All public headers must be self-contained (include what they use) - **`#pragma once`**: Preferred over include guards in project headers - **RAII**: Prefer RAII over manual resource management diff --git a/conductor/setup_state.json b/conductor/setup_state.json index 7dcef86..87bd669 100644 --- a/conductor/setup_state.json +++ b/conductor/setup_state.json @@ -12,7 +12,7 @@ "key_goals": "Zero-to-low dependency header-only integration; multiple algorithms (ABF, ABF++, LSCM); multi-chart flattening and packing; high numerical accuracy; production-efficient implementations.", "voice_tone": "Concise and direct", "design_principles": "Simplicity over features, Performance first, Developer experience focused", - "languages": "C++17, Python 3.x (scripts)", + "languages": "C++20, Python 3.x (scripts)", "frontend": "None", "backend": "None", "database": "None", diff --git a/conductor/tech-stack.md b/conductor/tech-stack.md index 49deac9..87e86d1 100644 --- a/conductor/tech-stack.md +++ b/conductor/tech-stack.md @@ -1,7 +1,7 @@ # Tech Stack ## Primary Language -- **C++17** — all library code; required standard for consumers +- **C++20** — all library code; required standard for consumers - **Python 3.x** — utility/build scripts (e.g. `thirdparty/amalgamate/amalgamate.py` for single-header generation); Python bindings (pybind11) are a future consideration ## Build System diff --git a/docs/installation.md b/docs/installation.md index eceee85..51c1e53 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -5,7 +5,7 @@ file(s) into your include directory. This page outlines the various installation options. ## Dependencies -- C++17 compiler +- C++20 compiler - [Eigen 3.3+](http://eigen.tuxfamily.org/) - CMake 3.15+ (optional) @@ -74,7 +74,7 @@ path. As %OpenABF depends upon the Eigen library, you will also need to add the Eigen headers to your include path: ```{.sh} -g++ -I /path/to/eigen/ -std=c++17 -DNDEBUG -O3 main.cpp -o main +g++ -I /path/to/eigen/ -std=c++20 -DNDEBUG -O3 main.cpp -o main ``` **Note:** For best performance, compile your application with the `-DNDEBUG -03` @@ -86,8 +86,8 @@ For many legacy reasons, the Microsoft Visual C++ compiler (MSVC) is not automatically conformant with the C++ standard in all cases. This may lead to the following issues when compiling against OpenABF. -**Note:** As this project only supports C++17 and up, you should always compile -with at least `/std:c++17`. +**Note:** As this project only supports C++20 and up, you should always compile +with at least `/std:c++20`. ### Undeclared identifier errors diff --git a/include/OpenABF/ABF.hpp b/include/OpenABF/ABF.hpp index 98f5e27..01a23c6 100644 --- a/include/OpenABF/ABF.hpp +++ b/include/OpenABF/ABF.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -84,7 +85,7 @@ void InitializeAnglesAndWeights(MeshPtr& m) } /** @brief Compute ∇CTri w.r.t LambdaTri == CTri */ -template , bool> = true> +template auto TriGrad(const FacePtr& f) -> T { T g = -PI; @@ -95,7 +96,7 @@ auto TriGrad(const FacePtr& f) -> T } /** @brief Compute ∇CPlan w.r.t LambdaPlan == CPlan */ -template , bool> = true> +template auto PlanGrad(const VertPtr& v) -> T { T g = -2 * PI; @@ -106,7 +107,7 @@ auto PlanGrad(const VertPtr& v) -> T } /** @brief Compute ∇CLen w.r.t LambdaLen == CLen */ -template , bool> = true> +template auto LenGrad(const VertPtr& vertex) -> T { T p1{1}; @@ -119,8 +120,7 @@ auto LenGrad(const VertPtr& vertex) -> T } /** @brief Compute ∇CLen w.r.t edge->alpha */ -template , bool> = true> +template auto LenGrad(const VertPtr& vertex, const EdgePtr& edge) -> T { T p1{1}; @@ -146,7 +146,7 @@ auto LenGrad(const VertPtr& vertex, const EdgePtr& edge) -> T } /** @brief Compute ∇F w.r.t an edge's alpha */ -template , bool> = true> +template auto AlphaGrad(const EdgePtr& edge) -> T { // δE/δα @@ -172,7 +172,7 @@ auto AlphaGrad(const EdgePtr& edge) -> T } /** @brief Compute ∇F w.r.t all parameters */ -template , bool> = true> +template auto Gradient(const MeshPtr& mesh) -> T { T g{0}; @@ -225,9 +225,8 @@ auto Gradient(const MeshPtr& mesh) -> T * concept](https://eigen.tuxfamily.org/dox-devel/group__TopicSparseSystems.html) * and templated on Eigen::SparseMatrix */ -template , - class Solver = Eigen::SparseLU, Eigen::COLAMDOrdering>, - std::enable_if_t, bool> = true> +template , + class Solver = Eigen::SparseLU, Eigen::COLAMDOrdering>> class ABF { public: diff --git a/include/OpenABF/ABFPlusPlus.hpp b/include/OpenABF/ABFPlusPlus.hpp index 6999d9a..59050a0 100644 --- a/include/OpenABF/ABFPlusPlus.hpp +++ b/include/OpenABF/ABFPlusPlus.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -38,9 +39,8 @@ namespace OpenABF * concept](https://eigen.tuxfamily.org/dox-devel/group__TopicSparseSystems.html) * and templated on Eigen::SparseMatrix */ -template , - class Solver = Eigen::SparseLU, Eigen::COLAMDOrdering>, - std::enable_if_t, bool> = true> +template , + class Solver = Eigen::SparseLU, Eigen::COLAMDOrdering>> class ABFPlusPlus { public: diff --git a/include/OpenABF/AngleBasedLSCM.hpp b/include/OpenABF/AngleBasedLSCM.hpp index 1ce626a..47c071c 100644 --- a/include/OpenABF/AngleBasedLSCM.hpp +++ b/include/OpenABF/AngleBasedLSCM.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -32,9 +33,8 @@ template