-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fill out plugin for tools to implement events inside the model #1149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New api
Nice. Thanks for laying that out in detail.
Move
evt
namespace out from undermrgsolve
Just to make sure I'm understanding correctly: that's a breaking change, correct?
It looks like this was only added in the 1.0.1 release (99f2aed, gh-934), so is the expectation that the one function (push
) didn't get much use in the wild?
expect_identical(as.data.frame(a), as.data.frame(b)) | ||
}) | ||
|
||
local_edition(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this local_edition
call unnecessary? The file-level edition set by the local_edition
call on line 9 should be automatically reset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok; I wasn't sure about the scope for the editions.
Thanks, @kyleam. Yeah, this is a breaking change. We could easily leave the I don't think there is currently a way to have this properly error right now (proper from R's perspective) ... in order to notify the user of the change. The other thing I could try is grepping this out of the model code and warning there. I'll put the code back in and think about how to handle this in the future. |
I put that function back for now and will think of a way to pull it back someday. |
Summary
Housekeeping
self
is an object with typedatabox
; it is a struct that we use to shuttle information from the model back tomrgsolve
; adding apush()
method with signatureevdata
to push these event objects into a vector that will be processed by mrgsolveevt
namespace out from undermrgsolve
evt::ev
as an alias forevdata
; I'm going to start shaping these to be more like the R versionmodelheader.h
andmodel_include.R
, needed to switch around how the header file gets included; there will need to be some more refactoring of the include order; will take that up once this PR is merged; but for now, the tests show thatmrgsolve-evtools.h
is getting includedNew api
Signature rules
self
always comes first if it is in the signatureev
comes first ifself
is not in the signature<amt>
comes first, then<compartment>
;<rate>
comes after<compartment>
Two functions to implement doses now; they return nothing and there is no opportunity to interact with the object that implements the doses
void evt::bolus(self, <amt>, <compartment>)
: do a bolus dose right nowvoid evt::infuse(self, <amt>, <compartment>, <rate>)
: do an infusion right nowTwo functions to construct dose objects; the object is returned to allow user to customize a bit
evt::ev bolus(<amt>, <compartment>)
: return an object for a bolus doseevt::ev infuse(<amt>, <compartment>, <rate>)
: return an object for an infusionSome functions to help working with returned objects
void retime(<ev>, <time>)
: set the time of the dose; this also setsnow
tofalse
void now(<ev>)
: setnow
totrue
void push(self, <ev>)
: push an event object back to mrgsolve to processAlso added a
push
member function toself
; this could be overloaded eventually to push different types of stuff back. This will always be available, regardless of whether or not you load the plugin.There will definitely be more coming on this front. But I'm pretty sure on these items. I'd like to review this and merge and see how things go for what's next.