-
Notifications
You must be signed in to change notification settings - Fork 660
Fix get_index_in_direction for regular meshes #3948
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
base: develop
Are you sure you want to change the base?
Changes from 5 commits
9e81f73
863bdcb
02f0f79
6ad6439
6769079
13b1a02
16744b4
28b7c3c
5fdb700
6eef5f4
4c502fe
6314ea5
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 |
|---|---|---|
|
|
@@ -1472,7 +1472,11 @@ RegularMesh::RegularMesh(hid_t group) : StructuredMesh {group} | |
|
|
||
| int RegularMesh::get_index_in_direction(double r, int i) const | ||
| { | ||
| return std::ceil((r - lower_left_[i]) / width_[i]); | ||
| if (r == lower_left_[i]) { | ||
| return 1; | ||
| } else { | ||
| return std::ceil((r - lower_left_[i]) / width_[i]); | ||
| } | ||
|
Comment on lines
+1476
to
+1483
Contributor
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. This doesn't really match mentally what I was expecting. I would have thought that a particle that is coincident with any mesh boundary would account for the direction, not just the upper boundary. Additionally, the check for the upper boundary is done using floating-point equality, which seems like it may fail even when the particle is exactly on the boundary because of rounding/truncation. |
||
| } | ||
|
|
||
| const std::string RegularMesh::mesh_type = "regular"; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 386e507008ed3c72c6e1a101aafc01cfaaff2c0b10555558d1eab6332441f7b17264b55002d721151bac2f3e7c1a8aac4c5ed243f5270533d171850f985206ed | ||
| 0d7b17d4e364bda2be21feb2e5b2aae4be69fc8ed634c4f45062e8efc61b7bd24dcf448837692fd603afe3756501fe8821d134f2d6289179618f85178ddb8793 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| d17a437262d3316985fba4b48e21a7fcd5f32ac2d96ef0e66849f567deaeadc1e0f18d5d0bf5e9cab4246dbf823e7f43f249a1f67e928b27ae8c70b89f3cefbf | ||
| 2f1c8efbf6ab0b0c7319fadd7ee8f27b545c1ebab94ebe15cf1133b54227487542966b6d798970c8b37bc19e7041e687687d5285803241bb83f4c8dc40a4d276 |
Uh oh!
There was an error while loading. Please reload this page.