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

Replace mutable structs using Accessors #2052

Merged
merged 13 commits into from
Sep 11, 2024

Conversation

huiyuxie
Copy link
Member

Another good way to be continued to address #2050 as @ranocha suggested.

Copy link
Contributor

Review checklist

This checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging.

Purpose and scope

  • The PR has a single goal that is clear from the PR title and/or description.
  • All code changes represent a single set of modifications that logically belong together.
  • No more than 500 lines of code are changed or there is no obvious way to split the PR into multiple PRs.

Code quality

  • The code can be understood easily.
  • Newly introduced names for variables etc. are self-descriptive and consistent with existing naming conventions.
  • There are no redundancies that can be removed by simple modularization/refactoring.
  • There are no leftover debug statements or commented code sections.
  • The code adheres to our conventions and style guide, and to the Julia guidelines.

Documentation

  • New functions and types are documented with a docstring or top-level comment.
  • Relevant publications are referenced in docstrings (see example for formatting).
  • Inline comments are used to document longer or unusual code sections.
  • Comments describe intent ("why?") and not just functionality ("what?").
  • If the PR introduces a significant change or new feature, it is documented in NEWS.md with its PR number.

Testing

  • The PR passes all tests.
  • New or modified lines of code are covered by tests.
  • New or modified tests run in less then 10 seconds.

Performance

  • There are no type instabilities or memory allocations in performance-critical parts.
  • If the PR intent is to improve performance, before/after time measurements are posted in the PR.

Verification

  • The correctness of the code was verified using appropriate tests.
  • If new equations/methods are added, a convergence test has been run and the results
    are posted in the PR.

Created with ❤️ by the Trixi.jl community.

@huiyuxie huiyuxie self-assigned this Aug 28, 2024
@huiyuxie huiyuxie added the refactoring Refactoring code without functional changes label Aug 28, 2024
@huiyuxie huiyuxie marked this pull request as draft August 28, 2024 20:54
Copy link

codecov bot commented Aug 28, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.

Project coverage is 95.95%. Comparing base (f9c9107) to head (4357e33).

Files with missing lines Patch % Lines
src/equations/ideal_glm_mhd_multicomponent_1d.jl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2052      +/-   ##
==========================================
- Coverage   96.32%   95.95%   -0.37%     
==========================================
  Files         470      470              
  Lines       37447    37466      +19     
==========================================
- Hits        36070    35949     -121     
- Misses       1377     1517     +140     
Flag Coverage Δ
unittests 95.95% <90.91%> (-0.37%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@huiyuxie
Copy link
Member Author

huiyuxie commented Sep 5, 2024

I cannot find the good compat version - please let the bot do this :/

@huiyuxie
Copy link
Member Author

huiyuxie commented Sep 5, 2024

Looks good but I'm worried about the introduction of new mutable structs - not sure if it will cause problem in the future.
@ranocha

@huiyuxie huiyuxie marked this pull request as ready for review September 5, 2024 03:27
@huiyuxie huiyuxie requested a review from ranocha September 5, 2024 03:27
@huiyuxie huiyuxie marked this pull request as draft September 5, 2024 04:35
@ranocha
Copy link
Member

ranocha commented Sep 5, 2024

Looks good but I'm worried about the introduction of new mutable structs - not sure if it will cause problem in the future.

I don't see an immediate reason why this would cause trouble in the future. We should definitely run some benchmarks to see whether there is any significant difference from this change.

Moreover, a lot of tests seem to fail.

@huiyuxie
Copy link
Member Author

huiyuxie commented Sep 5, 2024

I have no idea why tests only failed for IdealGlmMhdMulticomponentEquations2D. Can you help me have a check please @ranocha

@huiyuxie
Copy link
Member Author

huiyuxie commented Sep 5, 2024

I don't see an immediate reason why this would cause trouble in the future.

Like if I have to pass semi as an argument in kernels and then again non bittype errors - but I will try to avoid this case.

@huiyuxie
Copy link
Member Author

huiyuxie commented Sep 5, 2024

We should definitely run some benchmarks to see whether there is any significant difference from this change.

Do you mean the change of mutable structs will probably affect performance a lot? Why?

Copy link
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

See

c_h = convert(eltype(gammas), NaN)
- you need to adapt the inner constructor

src/equations/ideal_glm_mhd_2d.jl Show resolved Hide resolved
src/equations/ideal_glm_mhd_3d.jl Show resolved Hide resolved
src/equations/ideal_glm_mhd_multicomponent_2d.jl Outdated Show resolved Hide resolved
@huiyuxie
Copy link
Member Author

huiyuxie commented Sep 7, 2024

Thanks

@huiyuxie huiyuxie requested a review from ranocha September 9, 2024 08:56
@huiyuxie huiyuxie marked this pull request as ready for review September 9, 2024 08:57
@huiyuxie
Copy link
Member Author

huiyuxie commented Sep 9, 2024

Review please @ranocha how about the other way?

Project.toml Show resolved Hide resolved
src/callbacks_step/glm_speed.jl Show resolved Hide resolved
src/equations/ideal_glm_mhd_multicomponent_2d.jl Outdated Show resolved Hide resolved
@huiyuxie
Copy link
Member Author

Anyway, I prefer to make things move ahead - this issue has stalled my work for a really long time.

@ranocha Review again please and thanks for your long time support for my work - you are responsible

@huiyuxie huiyuxie requested a review from ranocha September 11, 2024 08:37
@huiyuxie
Copy link
Member Author

Can you make this update to the next release as soon as possible - so that I can continue my work next week, thanks! Also help me update the compat version.

@huiyuxie
Copy link
Member Author

Thanks :D

Copy link
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

Thanks! I will create a new release when this is merged

@ranocha ranocha merged commit 6bbcafc into trixi-framework:main Sep 11, 2024
33 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Refactoring code without functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants