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

Improves getting time step from Simulation type #649

Merged
merged 1 commit into from
Feb 28, 2020

Conversation

suyashbire1
Copy link
Collaborator

Fixes #648

@codecov
Copy link

codecov bot commented Feb 27, 2020

Codecov Report

Merging #649 into master will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #649      +/-   ##
==========================================
- Coverage   78.03%   78.00%   -0.04%     
==========================================
  Files         118      118              
  Lines        2363     2364       +1     
==========================================
  Hits         1844     1844              
- Misses        519      520       +1     

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ae1cbb...ad2e6ca. Read the comment docs.

Copy link
Member

@glwagner glwagner left a comment

Choose a reason for hiding this comment

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

Looks good, though there should be a docstring if this is user-facing.

Another possibility is to use Val to overload getproperty as we do for boundary condition directions:

https://github.com/climate-machine/Oceananigans.jl/blob/2ae1cbb86f484420dd2233745a5928a00bf6f77d/src/BoundaryConditions/coordinate_boundary_conditions.jl#L31

@glwagner glwagner changed the title Improves getting time step from Simulation class Improves getting time step from Simulation type Feb 28, 2020
@glwagner
Copy link
Member

I changed the title --- julia has types, but does not have classes.

@suyashbire1
Copy link
Collaborator Author

Another possibility is to use Val to overload getproperty as we do for boundary condition directions:

There are instances in the code where simulation.Δt is supposed to return a wizard. I guess overloading getproperty might get in the way of that code? @ali-ramadhan ?

Copy link
Member

@ali-ramadhan ali-ramadhan left a comment

Choose a reason for hiding this comment

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

Yeah this is nice but ideally users should be able to just do simulation.Δt and get the current time step. Unfortunately get_Δt seems necessary and feels like a Java style getter-setter.

We do need in a few places:
https://github.com/climate-machine/Oceananigans.jl/blob/2ae1cbb86f484420dd2233745a5928a00bf6f77d/src/Simulations.jl#L156
https://github.com/climate-machine/Oceananigans.jl/blob/2ae1cbb86f484420dd2233745a5928a00bf6f77d/src/Simulations.jl#L164

I think we should merge this PR but maybe figure out if there's an easier way to interact with simulations. Printing progress messages seems particularly cumbersome as you end up having to dive into multiple layers of types to get what you want (as shown by the example in #648).

@suyashbire1 suyashbire1 merged commit 0676c76 into master Feb 28, 2020
@suyashbire1 suyashbire1 deleted the simulation-deltat-improvements branch February 28, 2020 13:11
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.

Getting timestep from simulation class is cumbersome
3 participants