Skip to content

Refactor: improve code structure and maintainability#21

Merged
salva24 merged 5 commits into
compiler-research:masterfrom
aminatpwk:aminatpwk/refactor
Apr 19, 2026
Merged

Refactor: improve code structure and maintainability#21
salva24 merged 5 commits into
compiler-research:masterfrom
aminatpwk:aminatpwk/refactor

Conversation

@aminatpwk
Copy link
Copy Markdown
Contributor

Changes

  1. Replace dynamic cast chain with virtual dispatch by extracting interface: The ComputeConsumptionsSecretions method in DiffusionThomasAlgorithm previously used a chain of dynamic_cast calls to handle TumorCell and CarTCell agents separately. This meant that adding any new cell type would require modifying the diffusion grid code directly. As it also was noted with a fixme comment I created a new interface ISubstanceInteractor (declared in src/interfaces/substance_interactor.h) Both TumorCell and CarTCell inherit from it.
    The diffusion grid now performs a single cast to the interface, with no knowledge of concrete cell types, thus respecting the open/closed principle;
  2. Reorganize src/ into subdirectories by responsibility: All source files were previously in a single flat src/ directory. Files are now grouped by their role in the simulation.
    src/
    ├── agents/
    ├── diffusion/
    ├── forces/
    ├── interfaces/
    ├── params/
    ├── utils/
    ├── cart_tumor.h
    └── cart_tumor.cc

Related

  • Addresses the FIXME comment in DiffusionThomasAlgorithm::ComputeConsumptionsSecretions
  • README Project Structure section updated to reflect the new file layout

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

clang-tidy review says "All clean, LGTM! 👍"

Amina Sokoli added 2 commits April 1, 2026 21:36
@aminatpwk aminatpwk force-pushed the aminatpwk/refactor branch from ecd14bb to ed7eafe Compare April 1, 2026 19:38
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

clang-tidy review says "All clean, LGTM! 👍"

@aminatpwk aminatpwk force-pushed the aminatpwk/refactor branch from ed7eafe to b1534ab Compare April 1, 2026 19:50
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

clang-tidy review says "All clean, LGTM! 👍"

@aminatpwk aminatpwk force-pushed the aminatpwk/refactor branch from b1534ab to b7eadbf Compare April 1, 2026 19:58
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

clang-tidy review says "All clean, LGTM! 👍"

@aminatpwk aminatpwk force-pushed the aminatpwk/refactor branch from b7eadbf to 86958ad Compare April 1, 2026 20:04
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

clang-tidy review says "All clean, LGTM! 👍"

@aminatpwk aminatpwk force-pushed the aminatpwk/refactor branch from 86958ad to 5898acd Compare April 1, 2026 20:14
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

clang-tidy review says "All clean, LGTM! 👍"

@aminatpwk
Copy link
Copy Markdown
Contributor Author

Hi @salva24 , @vgvassilev
Just wanted to follow up on this PR. I would appreciate your thoughts on the proposed project restructuring and the move to virtual dispatch for ISubstanceInteractor and whether it aligns with the current architecture.
Let me know if anything needs to be adjusted or if you’d prefer a different direction.

Comment thread src/agents/cart_cell.cc Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

clang-tidy review says "All clean, LGTM! 👍"

@aminatpwk aminatpwk force-pushed the aminatpwk/refactor branch from 55cfe1f to aa5f856 Compare April 7, 2026 18:07
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

clang-tidy review says "All clean, LGTM! 👍"

Comment thread README.md
Copy link
Copy Markdown
Collaborator

@salva24 salva24 Apr 15, 2026

Choose a reason for hiding this comment

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

Hi, could you please include a small explanation in the readme for the new interface you created substance_interactor.h ? :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks for the heads up! :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great job, thank you very much for your contribution! :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you to you too! I appreciate the feedback! 🙌

@github-actions
Copy link
Copy Markdown

clang-tidy review says "All clean, LGTM! 👍"

Comment thread README.md
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great job, thank you very much for your contribution! :)

@salva24 salva24 merged commit 2eff64c into compiler-research:master Apr 19, 2026
3 checks passed
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.

3 participants