Skip to content

Comments

adding RegularMesh.get_indices_at_coords to match CylindricalMesh#3824

Open
shimwell wants to merge 5 commits intoopenmc-dev:developfrom
shimwell:find-closest-index-to-mesh-coord
Open

adding RegularMesh.get_indices_at_coords to match CylindricalMesh#3824
shimwell wants to merge 5 commits intoopenmc-dev:developfrom
shimwell:find-closest-index-to-mesh-coord

Conversation

@shimwell
Copy link
Member

@shimwell shimwell commented Feb 19, 2026

Description

To match the CylindricalMesh which has this function class I am keen to add this get_indices_at_coords function to the RegularMesh class.

Fixes # (issue)

Checklist

  • I have performed a self-review of my own code
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@GuySten
Copy link
Contributor

GuySten commented Feb 19, 2026

I suggest making get_indices_at_coords a required abstract method of StructuredMesh
and implement it also for RectlinearMesh.

@GuySten
Copy link
Contributor

GuySten commented Feb 19, 2026

You also should decide on a way to signal that a point is outside the mesh.

@shimwell
Copy link
Member Author

shimwell commented Feb 19, 2026

Thanks for this idea @GuySten I have made the abstract method.

Would it be ok if I leave the spherical mesh and rectilinear mesh implementation of get_indices_at_coords to another PR, I added not yet implemented errors for those options if that helps in the short term.

Also the point outside of the mesh question, not sure what is best to do there. Cylindrical mesh doesn't do anything special in that case so this PR is following that precedence. Would a warning message that prints when a user puts in a point outside the mesh be the best option for this?

@GuySten
Copy link
Contributor

GuySten commented Feb 19, 2026

I think it is fine.

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