-
Notifications
You must be signed in to change notification settings - Fork 7
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
ORG78 Finish event wiring in SIPNET #25
Conversation
|
||
// calculate all fluxes and update state for this time step | ||
// we calculate all fluxes before updating state in case flux calculations depend on the old state | ||
void updateState() { | ||
double npp; // net primary productivity, g C * m^-2 ground area * day^-1 |
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.
Everything in this function above the #if EVENT_HANDLER
is just indent formatting changes
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.
Changes look great, looking forward to seeing how these events flesh out!
sipnet.c
Outdated
break; | ||
default: | ||
printf("Unknown event type (%d) in processEvents()\n", locEvent->type); | ||
exit(1); |
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.
do we really want to exit and not just print error message, and continue?
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.
That's a great question, I was going with what seems to be the standard for SIPNET - that is, exit on errors that look like mistakes in inputs. Any thoughts on this @dlebauer @infotroph ?
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.
Decided via discussion: using different error codes, starting here
sipnet.c
Outdated
@@ -2485,7 +2534,9 @@ void setupModel(SpatialParams *spatialParams, int loc) { | |||
|
|||
// Setup events at given location | |||
void setupEvents(int currLoc) { | |||
// Implementation TBD | |||
#if EVENT_HANDLER | |||
locEvent = events[currLoc]; |
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.
indenting looks off here
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.
Formatting looks inconsistent throughout - what about applying a formatter in a separate PR?
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.
I cannot get CLion on Mac to listen to its own format settings, thus some wonky things sneak in. I def. vote for adding a formatter on checkin/push/merge or some such, but I'll fix this one here for now. Thanks for pointing that out!
sipnet.c
Outdated
@@ -2554,6 +2605,12 @@ void runModelNoOut(double **outArray, int numDataTypes, int dataTypeIndices[], S | |||
|
|||
setupModel(spatialParams, loc); | |||
|
|||
#if EVENT_HANDLER | |||
// Implementation TBD |
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.
indenting looks off here
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.
Ditto
exitCodes.h
Outdated
// Note for future: these codes typically have other meanings and should not be | ||
// used here (except for 0 and 1, for which our meaning is the special meaning) | ||
// 0-2, 126-165, and 255 | ||
// See, e.g., https://tldp.org/LDP/abs/html/exitcodes.html |
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.
other link that might be good is https://man7.org/linux/man-pages/man3/sysexits.h.3head.html
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.
Yeah, I like that one better
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.
Or, in addition, looking at that more closely.
@@ -2485,7 +2535,9 @@ void setupModel(SpatialParams *spatialParams, int loc) { | |||
|
|||
// Setup events at given location | |||
void setupEvents(int currLoc) { | |||
// Implementation TBD | |||
#if EVENT_HANDLER |
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.
probably should be consistent and have the EVENT_HANDLER around the function as well.
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.
Good catch!
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.
one other thing to think about is to start a changelog, see pecan and https://keepachangelog.com/
This PR augments event handling in SIPNET by fetching events at the relevant place, and has a stubbed method for implementing the actual processing of events for later work.
Note that this is only for
runModelOutput()
, notrunModelNoOut()
; we can update the latter as well if desired later.