-
Notifications
You must be signed in to change notification settings - Fork 35
WIP Allow any placement of time dimension #434
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
Conversation
Personal taste, but I find this "3 assignments in one" formulation less readable than 3 simple assignments on separate lines. Also, should the new parameter be |
For cases like these: function next_timestep(ts::FixedTimestep{FIRST, STEP, LAST}) where {FIRST, STEP, LAST}
if finished(ts)
error("Cannot get next timestep, this is last timestep.")
end
return FixedTimestep{FIRST, STEP, LAST}(ts.t + 1)
end
function next_timestep(ts::VariableTimestep{TIMES}) where {TIMES}
if finished(ts)
error("Cannot get next timestep, this is last timestep.")
end
return VariableTimestep{TIMES}(ts.t + 1)
end Can't we have a single function: function next_timestep(ts::T) where {T <: AbstractTimestep}
if finished(ts)
error("Cannot get next timestep, this is last timestep.")
end
return T(ts.t + 1)
end And similarly for pairs of functions that don't do anything with the more detailed type parameters, i.e., they just call already-type-differentiated functions like |
|
also just a note on the innards of "time.jl": some of the functions for
I changed to this:
because I believe the parameter names |
Defining a short function I'm agnostic about whether we consolidate the pairs of functions in this PR or in a separate one. |
For some reason, I'm not seeing an "Approve" button, but I think you can merge this if tests are all passing. Nice job! |
Codecov Report
@@ Coverage Diff @@
## master #434 +/- ##
==========================================
+ Coverage 80.73% 80.97% +0.23%
==========================================
Files 26 26
Lines 1936 1976 +40
==========================================
+ Hits 1563 1600 +37
- Misses 373 376 +3
Continue to review full report at Codecov.
|
Okay I'll make those few changes but I'm not going to merge it until I add more tests! and get explorer working (maybe I can elicit @lrennels for that) |
@ckingdon95 happy to help if things are confusing in |
@lrennels I merged master back into this branch so the tests just re-ran. It looks like some of the dependency tests failed on Travis, but not for all of the deployments. You're more familiar with these tests than I am, would you mind taking a look and seeing if you think this is caused by something on this branch, or if this is just an unrelated Travis problem? Thanks!! |
@ckingdon95 we're getting this exact same error in the current |
Description of changes:
ti
which is an integer value equal to the time index position of that array. (I'm not particularly attached to the nameti
, we can pick something better if we want)getindex
andsetindex
functions forTimestepMatrix
withti
equal to 2 were addedgetindex
andsetindex
functions forTimestepArrays
have all been changed, similar to the following example:get_time_index_position
that gets used during build to get the appropriateti
value based on the parameter or variables dimension order.Todo: