-
Notifications
You must be signed in to change notification settings - Fork 525
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
Ensure correct initialization of members for RegularMesh #1683
Ensure correct initialization of members for RegularMesh #1683
Conversation
16087f4
to
d9fb85b
Compare
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 @aprilnovak! These updates look good to me.
Hmm, now that I've done a bit more looking, if we merge this, then I don't think we'd ever get to the default mesh.cpp
But for non-Shannon-entropy meshes, we do want to throw an error if the user doesn't provide the |
Oof good point. I'm not entirely sure. I honestly don't have a good sense of how often this feature is used -- it's possible that we could simply remove it and document the heuristic we're using to generate that mesh shape, but it does seem like a convenient thing to keep around if possible. If we do want to keep this capability around, I'd really like to maintain the behavior you've added where the Considerable restructuring involved, but I think it would do the trick. |
What about this approach? Create a new global variable, This would avoid the creation of a new constructor so that ... except for the deprecated I think I have a rather clean way to do this as long as the |
I like it! Keeps things simple and no new constructors needed. Not sure about when support for |
I'm fine removing the support for |
d9fb85b
to
604a8c4
Compare
Ok I think I have this moved onto the Python side correctly. Some comments/questions:
|
Also, with regards to deprecation - I left a |
For |
604a8c4
to
5e72ff6
Compare
True, I forgot about that.
Good idea! Now included. |
…esh and simplify error checking.
5e72ff6
to
15190e6
Compare
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.
Re-approving as a formality after all of these additional improvements. 😃
Thanks @aprilnovak! |
I'm familiarizing myself with the
Mesh
representations, and came across what I think is an unprotected logic chain that could lead to unintended behavior for users. Basically, theRegularMesh
is provided with alower_left_
coordinate, and either:A) computes
upper_right_
from a providedshape_
andwidth_
B) computes
width_
from a providedshape_
andupper_right_
(a third option is to compute the
shape_
fromwidth_
andupper_right_
, but you probably wouldn't have a perfect integer number of cells and it doesn't seem like this is even supported).Therefore,
shape_
must be provided, but currently no error is thrown if it's not provided, in which caseshape_
andn_dimension_
are not set. You would also miss the check that the dimension is 1-D, 2-D, or 3-D.This PR protects against the fringe case where the user doesn't set
"dimension"
.