Skip to content
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

Migrate include after ifdefs in core and solver h #1170

Merged
merged 9 commits into from
Jun 13, 2024

Conversation

blaisb
Copy link
Contributor

@blaisb blaisb commented Jun 12, 2024

Description

Everywhere throughout the include files of the core and the solver library, there were multiple includes that were defined before the #ifndef -> #define -> #endif statements. This is mostly aesthetics, but this can also have a small impact on compilation time, especially on systems with a slow filesystem (e.g. the clusters). See for example: https://stackoverflow.com/questions/20988705/is-an-include-before-ifdef-define-include-guard-okay

Additionally, some of the include guards were in capital letters, some were not. Heck, some were even missing. So I took the opportunity to uniformize thing. I limited myself to core/solver as a first step, but in a follow-up PR I could do it for the other parts of the library.

Testing

There are not tests required here. If the code compiles, everything will be fine.

Documentation

No documentation was modified in the making of this PR.

Checklist (will be removed when merged)

See this page for more information about the pull request process.

Code related list:

  • All in-code documentation related to this PR is up to date (Doxygen format)
  • Lethe documentation is up to date
  • The branch is rebased onto master
  • Code is indented with indent-all and .prm files (examples and tests) with prm-indent

Pull request related list:

  • No other PR is open related to this refactoring
  • Labels are applied
  • There are at least 2 reviewers (or 1 if small feature) excluding the responsible for the merge
  • If this PR closes an issue or is related to a project, it is linked in the "Projects" or "Development" section
  • If any future works is planed, an issue is opened
  • The PR description is cleaned and ready for merge

@blaisb blaisb added the Refactoring This PR is only refactoring or clean up label Jun 12, 2024
Copy link
Collaborator

@acdaigneault acdaigneault left a comment

Choose a reason for hiding this comment

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

I like those small clean up.
It's just small questions in my comments on the way we should name things, but I don't think changes would be required in this respect.

include/core/solid_objects_parameters.h Outdated Show resolved Hide resolved
include/core/tensors_and_points_dimension_manipulation.h Outdated Show resolved Hide resolved
include/solvers/copy_data.h Outdated Show resolved Hide resolved
include/core/auxiliary_math_functions.h Outdated Show resolved Hide resolved
@@ -1,3 +1,18 @@
/* ---------------------------------------------------------------------
*
* Copyright (C) 2019 - by the Lethe authors
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you want to update the year?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe in another PR when we change the license everywhere

Co-authored-by: Audrey Collard-Daigneault <71884806+acdaigneault@users.noreply.github.com>
Copy link
Collaborator

@AmishgaAlphonius AmishgaAlphonius left a comment

Choose a reason for hiding this comment

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

Nice uniformization and it's cool to learn that it can affect compile time.
I left a few comments and some files were not modified, but they do not follow the exact same format as the others. I've listed them here:

  • In include/core/inexact_newton_non_linear_solver.h, it should be lethe_inexact_newton_non_linear_solver_h instead of lethe_inexact_newton_iteration_non_linear_solver_h
  • In include/core/kinsol_newton_non_linear_solver.h, it should be lethe_kinsol_newton_non_linear_solver_h instead of kinsol_non_linear_solver_h
  • In include/core/phase_change.h, it should be lethe_phase_change_h instead of phase_change_h
  • In include/solvers/cahn_hilliard.h, it should be lethe_cahn_hilliard_h instead of cahn_hilliard_h

include/core/dem_properties.h Outdated Show resolved Hide resolved
@@ -18,7 +18,6 @@

Copy link
Collaborator

Choose a reason for hiding this comment

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

lines 16-17, it should be lethe_grid_tools_h instead of lethe_lethegridtools_h

Copy link
Contributor Author

@blaisb blaisb Jun 12, 2024

Choose a reason for hiding this comment

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

should actually be lethe_lethe_grid_tools_h
This class is weirdly named, will be refactored :)

include/core/mesh_controller.h Outdated Show resolved Hide resolved
include/solvers/postprocessors.h Outdated Show resolved Hide resolved
include/solvers/postprocessors_smoothing.h Outdated Show resolved Hide resolved
include/solvers/simulation_parameters.h Outdated Show resolved Hide resolved
include/solvers/simulation_parameters.h Outdated Show resolved Hide resolved
blaisb and others added 6 commits June 12, 2024 17:05
Co-authored-by: Amishga Alphonius <107414376+AmishgaAlphonius@users.noreply.github.com>
Co-authored-by: Amishga Alphonius <107414376+AmishgaAlphonius@users.noreply.github.com>
Co-authored-by: Amishga Alphonius <107414376+AmishgaAlphonius@users.noreply.github.com>
Co-authored-by: Amishga Alphonius <107414376+AmishgaAlphonius@users.noreply.github.com>
Co-authored-by: Amishga Alphonius <107414376+AmishgaAlphonius@users.noreply.github.com>
@acdaigneault
Copy link
Collaborator

Btw, thank you for the super exhaustive PR description :D

@blaisb
Copy link
Contributor Author

blaisb commented Jun 12, 2024

Btw, thank you for the super exhaustive PR description :D

Well rumor has it that someone has made a super cool amazing templates for PR and it makes it super easy now to write good PR messages. I'm just following the new very clear guidelines.

@blaisb blaisb merged commit eea049f into master Jun 13, 2024
8 checks passed
@blaisb blaisb deleted the include_in_core_headers branch June 13, 2024 12:05
blaisb pushed a commit that referenced this pull request Aug 6, 2024
Description
Quick refactor as done in PR #1170 that moves header includes after the #define.
Some @brief has been added here and there at the same time.
M-Badri pushed a commit to M-Badri/lethe that referenced this pull request Sep 29, 2024
Description
Everywhere throughout the include files of the core and the solver library, there were multiple includes that were defined before the #ifndef -> #define -> #endif statements. This is mostly aesthetics, but this can also have a small impact on compilation time, especially on systems with a slow filesystem (e.g. the clusters). See for example: https://stackoverflow.com/questions/20988705/is-an-include-before-ifdef-define-include-guard-okay

Additionally, some of the include guards were in capital letters, some were not. Heck, some were even missing. So I took the opportunity to uniformize thing. I limited myself to core/solver as a first step, but in a follow-up PR I could do it for the other parts of the library.

Testing
There are not tests required here. If the code compiles, everything will be fine.

Documentation
No documentation was modified in the making of this PR.

Co-authored-by: Audrey Collard-Daigneault <71884806+acdaigneault@users.noreply.github.com>
Co-authored-by: Amishga Alphonius <107414376+AmishgaAlphonius@users.noreply.github.com>
Former-commit-id: eea049f
M-Badri pushed a commit to M-Badri/lethe that referenced this pull request Sep 29, 2024
Description
Quick refactor as done in PR chaos-polymtl#1170 that moves header includes after the #define.
Some @brief has been added here and there at the same time.



Former-commit-id: 9beea0c
blaisb added a commit that referenced this pull request Sep 30, 2024
Description
Everywhere throughout the include files of the core and the solver library, there were multiple includes that were defined before the #ifndef -> #define -> #endif statements. This is mostly aesthetics, but this can also have a small impact on compilation time, especially on systems with a slow filesystem (e.g. the clusters). See for example: https://stackoverflow.com/questions/20988705/is-an-include-before-ifdef-define-include-guard-okay

Additionally, some of the include guards were in capital letters, some were not. Heck, some were even missing. So I took the opportunity to uniformize thing. I limited myself to core/solver as a first step, but in a follow-up PR I could do it for the other parts of the library.

Testing
There are not tests required here. If the code compiles, everything will be fine.

Documentation
No documentation was modified in the making of this PR.

Co-authored-by: Audrey Collard-Daigneault <71884806+acdaigneault@users.noreply.github.com>
Co-authored-by: Amishga Alphonius <107414376+AmishgaAlphonius@users.noreply.github.com>
Former-commit-id: eea049f
blaisb pushed a commit that referenced this pull request Sep 30, 2024
Description
Quick refactor as done in PR #1170 that moves header includes after the #define.
Some @brief has been added here and there at the same time.



Former-commit-id: 9beea0c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactoring This PR is only refactoring or clean up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants