-
Notifications
You must be signed in to change notification settings - Fork 61
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
Stricter checks on network construction / simulation parameters. #2264
base: master
Are you sure you want to change the base?
Changes from 1 commit
6a5bdc4
4fb5476
12261a2
2739392
0893669
4797b9f
b85e8e6
73acec6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,8 +54,8 @@ struct cell_connection_base { | |
|
||
cell_connection_base(L src, cell_local_label_type dst, float w, const U::quantity& d): | ||
source(std::move(src)), target(std::move(dst)), weight(w), delay(d.value_as(U::ms)) { | ||
if (std::isnan(weight)) throw std::out_of_range("Connection weight must be finite."); | ||
if (std::isnan(delay) || delay < 0) throw std::out_of_range("Connection delay must be non-negative and infinite in units of [ms]."); | ||
if (std::isnan(weight)) throw std::domain_error("Connection weight must be finite."); | ||
if (std::isnan(delay) || delay <= 0) throw std::domain_error("Connection delay must be positive, finite, and given in units of [ms]."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inasmuch as we're presuming NaNs work as expected, we could just have the test Do we really need to enforce that delay is finite? If so, then the test should include that. Also, not being familiar (yet) with how LLNL units works, why do we need to specify that the quantity is in milliseconds? Can't we just convert as required or else assert in the type? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, the two issues go hand in hand: |
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have quite specific exceptions such as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am a bit torn here, |
||
}; | ||
|
||
|
@@ -69,7 +69,7 @@ struct gap_junction_connection { | |
|
||
gap_junction_connection(cell_global_label_type peer, cell_local_label_type local, double g): | ||
peer(std::move(peer)), local(std::move(local)), weight(g) { | ||
if (std::isnan(weight)) throw std::out_of_range("Gap junction weight must be finite."); | ||
if (std::isnan(weight)) throw std::domain_error("Gap junction weight must be finite."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar comments as above: testing finite or testing Nan? We should use an arbor exception. |
||
} | ||
}; | ||
|
||
|
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.
Message doesn't match test: should this test be
!std::isfinite(weight)
?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 better, yes.