Skip to content

Cleanup: remove duplicate and unused #include statements#516

Open
mirams wants to merge 7 commits into
developfrom
modernize/include-cleanup
Open

Cleanup: remove duplicate and unused #include statements#516
mirams wants to merge 7 commits into
developfrom
modernize/include-cleanup

Conversation

@mirams

@mirams mirams commented Apr 30, 2026

Copy link
Copy Markdown
Member

Removes 99 include lines across 48 files:

  • 30 exact-duplicate includes (same header in same file twice)
  • 69 unused class headers where the included type is never referenced in that translation unit (verified: class name absent from all code outside the include line, or already pulled in transitively by another included header)

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>
@mirams mirams force-pushed the modernize/include-cleanup branch from eb5bb0a to fde6e88 Compare April 30, 2026 16:51
Comment thread crypt/test/simulation/TestCryptSimulation2dNightly.hpp
Comment thread global/src/checkpointing/SerializationExportWrapper.hpp
@mirams

mirams commented Apr 30, 2026

Copy link
Copy Markdown
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>
@mirams mirams marked this pull request as ready for review May 19, 2026 12:33
@mirams mirams requested review from Copilot, fcooper8472 and jmpf May 19, 2026 12:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 #include lines 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.

Comment thread crypt/src/simulation/CryptSimulation2d.cpp
Comment thread cell_based/test/tutorial/TestCreatingAndUsingANewSrnModelTutorial.hpp Outdated

@fcooper8472 fcooper8472 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than those two copilot suggestions, this looks good to me!

Comment thread cell_based/test/tutorial/TestCreatingAndUsingANewSrnModelTutorial.hpp Outdated
Comment thread crypt/src/simulation/CryptSimulation2d.cpp
mirams and others added 2 commits June 2, 2026 09:57
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

@copilot, implement the two changes in my comments above

Implemented in 533bd70 and a8b5fb0.

Copilot finished work on behalf of mirams June 3, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants