Cleanup: remove duplicate and unused #include statements#516
Open
mirams wants to merge 7 commits into
Open
Conversation
Removes 67 net include lines across 48 files: - 30 duplicate includes (second occurrence of same header in same file) - 41 unused class headers where the included type is never referenced in that translation unit Two corrections applied after build verification: - SlidingBoundaryCondition.cpp: replaced implicit AbstractOffLatticeCellPopulation (was pulled in transitively) with a direct include of its own header - LinearSpringWithVariableSpringConstantsForce.cpp: replaced implicit AbstractVanLeeuwen2009WntSwatCellCycleModel with a direct include Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
eb5bb0a to
fde6e88
Compare
mirams
commented
Apr 30, 2026
mirams
commented
Apr 30, 2026
Member
Author
|
@copilot, implement the two changes in my comments above |
- Restore #include "CellBasedEventHandler.hpp" in TestCryptSimulation2dNightly.hpp (line 440, inside a comment) - Restore #include "CheckpointArchiveTypes.hpp" in SerializationExportWrapper.hpp (needed to prevent test failures) Agent-Logs-Url: https://github.com/Chaste/Chaste/sessions/700e2e49-eb95-4d02-99b8-16207f5546c0 Co-authored-by: mirams <858776+mirams@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR cleans up C++ #include lists across the codebase by removing duplicate includes and trimming headers that are no longer directly needed, reducing compile-time overhead and improving translation-unit hygiene.
Changes:
- Remove exact-duplicate
#includelines within the same file. - Remove headers for types not referenced in the translation unit (or already included elsewhere).
- In a few places, replace overly-specific headers with a more appropriate/common header.
Reviewed changes
Copilot reviewed 46 out of 46 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pde/test/TestSolveLaplacianWithQuadratics.hpp | Removes an unnecessary include from the test TU. |
| ode/src/solver/BackwardEulerIvpOdeSolver.hpp | Removes a redundant include from the solver header. |
| mesh/src/vertex/VertexMeshWriter.cpp | Drops unused mesh-type includes from the writer TU. |
| lung/test/ventilation/TestDynamicVentilation.hpp | Removes an unnecessary include from the test TU. |
| lung/src/airway_generation/AirwayGenerator.cpp | Removes an unused VTK include from the TU. |
| heart/test/tutorials/TestCardiacElectroMechanicsTutorial.hpp | Removes a duplicate include. |
| heart/test/tutorials/TestAnotherCardiacElectroMechanicsTutorial.hpp | Removes a duplicate include. |
| heart/test/postprocessing/TestPseudoEcgCalculator.hpp | Removes duplicate/unused includes from the test TU. |
| heart/test/monodomain/TestMonodomainPurkinjeProblemLong.hpp | Removes an unnecessary mesh include. |
| heart/test/monodomain/TestMonodomainPurkinjeAssemblersAndSolver.hpp | Removes an unnecessary mesh include. |
| heart/test/ionicmodels/TestCvodeCells.hpp | Removes an unused include from the test TU. |
| heart/test/extended_bidomain/TestStimulusFactory.hpp | Removes an unused stimulus-factory include. |
| heart/test/bidomain/TestBidomainTissue.hpp | Removes an unnecessary include from the test TU. |
| heart/src/postprocessing/PostProcessingWriter.cpp | Removes unused converter includes from the TU. |
| global/src/Exception.cpp | Removes a duplicate/unused include from the TU. |
| crypt/src/simulation/CryptSimulation2d.cpp | Removes unused concrete-model includes from the TU. |
| crypt/src/forces/LinearSpringWithVariableSpringConstantsForce.cpp | Replaces concrete-model includes with the abstract base model include. |
| continuum_mechanics/test/TestCompressibleNonlinearElasticitySolver.hpp | Removes a duplicate include. |
| cell_based/test/tutorial/TestCreatingAndUsingANewSrnModelTutorial.hpp | Removes an include and keeps export macro usage in the tutorial TU. |
| cell_based/test/simulation/TestOnLatticeSimulationWithPdes.hpp | Removes an unused simulation include. |
| cell_based/test/simulation/TestOffLatticeSimulationWithPdes.hpp | Removes an unnecessary PETSc setup include. |
| cell_based/test/population/TestMeshBasedCellPopulationWithGhostNodes.hpp | Removes unused writer includes. |
| cell_based/test/population/TestCellWriters.hpp | Removes a duplicate include. |
| cell_based/test/cell/TestCellSrn.hpp | Removes an unused include. |
| cell_based/test/cell/TestCell.hpp | Removes unused proliferative-type includes. |
| cell_based/test/cell_based_pde/TestSimulationsWithEllipticGrowingDomainPdeModifier.hpp | Removes an unused include. |
| cell_based/src/writers/population_writers/VoronoiDataWriter.cpp | Removes an unused base population include. |
| cell_based/src/writers/population_writers/VertexT3SwapLocationsWriter.cpp | Removes an unused base population include. |
| cell_based/src/writers/population_writers/VertexT2SwapLocationsWriter.cpp | Removes an unused base population include. |
| cell_based/src/writers/population_writers/VertexT1SwapLocationsWriter.cpp | Removes an unused base population include. |
| cell_based/src/writers/population_writers/VertexIntersectionSwapLocationsWriter.cpp | Removes an unused base population include. |
| cell_based/src/writers/population_writers/NodeVelocityWriter.cpp | Removes an unused base population include. |
| cell_based/src/writers/population_writers/CellPopulationAreaWriter.cpp | Removes an unused base population include. |
| cell_based/src/writers/population_writers/AbstractCellPopulationWriter.cpp | Removes unused concrete-population includes. |
| cell_based/src/writers/population_count_writers/AbstractCellPopulationCountWriter.cpp | Removes unused concrete-population includes. |
| cell_based/src/writers/cell_writers/ImmersedBoundaryNeighbourNumberWriter.cpp | Removes an unused immersed-boundary include. |
| cell_based/src/writers/cell_writers/CellProliferativeTypesWriter.cpp | Removes unused property/mutation includes. |
| cell_based/src/simulation/numerical_methods/AbstractNumericalMethod.cpp | Removes an unused population include. |
| cell_based/src/simulation/modifiers/DeltaNotchEdgeTrackingModifier.cpp | Removes an unused SRN-model include. |
| cell_based/src/population/VertexBasedCellPopulation.cpp | Removes an unused SRN-model include. |
| cell_based/src/population/NodeBasedCellPopulationWithParticles.cpp | Removes unused writer includes. |
| cell_based/src/population/MeshBasedCellPopulation.cpp | Removes an unused mesh include. |
| cell_based/src/population/forces/DiffusionForce.cpp | Removes an unused population include. |
| cell_based/src/population/boundary_conditions/SlidingBoundaryCondition.cpp | Replaces overly-specific population includes with the off-lattice base include. |
| cell_based/src/population/AbstractCellPopulation.cpp | Removes unused count-writer includes. |
| cell_based/src/cell/Cell.cpp | Removes an unused property include. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fcooper8472
reviewed
May 19, 2026
fcooper8472
left a comment
Member
There was a problem hiding this comment.
Other than those two copilot suggestions, this looks good to me!
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
Implemented in |
…into modernize/include-cleanup
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
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.
Removes 99 include lines across 48 files: