-
Notifications
You must be signed in to change notification settings - Fork 35
Optimize header includes and reduce dependencies #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Replace <Eigen/Dense> with lighter <Eigen/Core> in energy.h - Add <Eigen/Eigenvalues> to analysis.cpp where SelfAdjointEigenSolver is used This reduces compilation time for the heaviest header file (energy.h, ~2000 lines) by avoiding unnecessary Eigen decomposition modules. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace <spdlog/fmt/fmt.h> with <format> for GenericError template - Replace <range/v3/range/concepts.hpp> with <iterator> for iter_value_t - Use std::format instead of fmt::vformat in GenericError - Use std::iter_value_t instead of ranges::cpp20::iter_value_t This removes two third-party library includes from the most widely included header file, potentially improving compilation times. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Migrate from spdlog's bundled fmt library to C++20 std::format: - Update all fmt::format calls to std::format - Replace <spdlog/fmt/fmt.h> and <spdlog/fmt/ostr.h> with <format> - Add <format> include to headers that use std::format This reduces dependency on third-party formatting and uses the C++20 standard library instead. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace <spdlog/fmt/fmt.h> with <format> in precompiled headers to match the migration from fmt::format to std::format. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move BoundaryFunction and DistanceFunction to core.h - Remove geometry.h include from group.h (use units.h for pc::) - Add geometry.h to group.cpp and externalpotential.h where needed - Remove duplicate typedef from bonds.h Files like io.h, regions.h and their dependents no longer transitively include the 952-line geometry.h. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Headers that include core.h no longer need to explicitly include: - <ranges>, <optional>, <vector>, <iterator>, <functional> - <nlohmann/json.hpp> These are already provided by core.h. Also reorder celllistimpl.h to include core.h first. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- energy.h: remove Eigen/Core, ranges, optional (from space.h->core.h) - io.h: remove iterator, ranges (from group.h->core.h) - move.h: remove optional (from space.h->core.h) - analysis.h: remove vector (from space.h->core.h) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove <optional> and <ranges> which are already provided via regions.h -> space.h -> core.h Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move specialized utilities out of core.h to improve modularity: - aux/json_support.h: JSON utilities (SingleUseJSON, loadJSON, etc.) - aux/coordinates.h: Coordinate transforms (xyz2rth, xyz2rtp, rtp2xyz) - aux/usagetip.h: TipFromTheManual class - electrolyte.h: Electrolyte class and makeElectrolyte - aux/eigensupport.h: Added asEigenMatrix, asEigenVector functions - random.h: Added randomUnitVector, randomUnitVectorPolar functions - io.h: Added addGrowingSuffix function Core.h now includes these headers for backwards compatibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Each source file now explicitly includes the headers it needs (json_support.h, eigensupport.h, coordinates.h, usagetip.h, electrolyte.h) rather than relying on transitive includes through core.h. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- analysis.h: remove particle.h, molecule.h (provided by space.h) - bonds.h: remove core.h (provided by particle.h) - energy.h: remove aux/iteratorsupport.h (unused in header) - molecule.h: remove core.h (provided by particle.h) - move.h: remove geometry.h, molecule.h (provided by space.h) - montecarlo.cpp: add aux/iteratorsupport.h (was transitive via energy.h) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace full nlohmann/json.hpp with lightweight json_fwd.hpp since only function declarations use the json type (by reference). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
libstdc++ on Debian bookworm lacks <format> header support. Switch to libc++ which has full C++20 standard library support. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Ensures external dependencies are built with the same stdlib flags (e.g., -stdlib=libc++) as the main project to avoid ABI mismatches. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
fmt::format→std::format)nlohmann/json_fwd.hppforward declaration in tensor.h<format>instead of spdlog/fmtTest plan
🤖 Generated with Claude Code