Skip to content

Handle out-of-bounds coordinates during evaluation#259

Open
Sichao25 wants to merge 2 commits intoSCOREC:developfrom
Sichao25:yus/out_of_bound_mode
Open

Handle out-of-bounds coordinates during evaluation#259
Sichao25 wants to merge 2 commits intoSCOREC:developfrom
Sichao25:yus/out_of_bound_mode

Conversation

@Sichao25
Copy link
Contributor

Handle out-of-bounds cases by throwing an exception or filling a given value. CLAMP mode (map to nearest elements) is not yet implemented.

@Sichao25 Sichao25 marked this pull request as ready for review February 14, 2026 04:07
@jacobmerson
Copy link
Collaborator

@hgangwar please review this when you get a chance. Changes here are what we discussed about handling points outside the domain.

{
ERROR, // Throw error when points are out of bounds
FILL, // Fill out-of-bounds points with a fill value
CLAMP // Clamp to nearest boundary cell (extrapolate)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call this NEAREST_BOUNDARY? Clamp means "saturate" to some high or low value. Such as: https://en.cppreference.com/w/cpp/algorithm/clamp.html


for (size_t i = 0; i < search_results.size(); ++i) {
auto [dim, elem_idx, coord] = search_results(i);
bool is_valid = (static_cast<int>(dim) == mesh.dim()) &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just check if the index is negative. A negative index means the point is outside.

num_missing_ = missing_point_indices.size();

// Handle missing points based on mode
if (num_missing_ > 0 && mode_ == OutOfBoundsMode::ERROR) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than waiting to process points, let's throw an error as soon as you get an invalid point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants