Skip to content
Snippets Groups Projects
Commit 93c3021f authored by Tom Fischer's avatar Tom Fischer
Browse files

[MeL/MS] Ensure grid cell coordinates are valid.

parent 75fd0a22
No related branches found
No related tags found
No related merge requests found
......@@ -152,6 +152,13 @@ bool MeshElementGrid::sortElementInGridCells(MeshLib::Element const& element)
const std::size_t n_plane(_n_steps[0]*_n_steps[1]);
// If a node of an element is almost equal to the upper right point of the
// AABB the grid cell coordinates computed by getGridCellCoordintes() could
// be to large (due to numerical errors). The following lines ensure that
// the grid cell coordinates are in the valid range.
for (std::size_t k(0); k<3; ++k)
max[k] = std::min(_n_steps[k]-1, max[k]);
// insert the element into the grid cells
for (std::size_t i(min[0]); i<=max[0]; i++) {
for (std::size_t j(min[1]); j<=max[1]; j++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment