Skip to content

unstructured grid 1d - #146

Merged
Yurlungur merged 30 commits into
mainfrom
jmm/unstructured-grid-1d-2
Aug 5, 2026
Merged

unstructured grid 1d#146
Yurlungur merged 30 commits into
mainfrom
jmm/unstructured-grid-1d-2

Conversation

@Yurlungur

@Yurlungur Yurlungur commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

PR Summary

In this MR I add grid a grid object to Spiner that supports non-uniformly spaced points per axis in a Cartesian product fashion. This is another step on the path to interpolating directly on, e.g., SESAME grids. For this version, I use a binary search to search the interpolation points. I have an acceleration strategy in mind, which I will pursue in a subsequent MR.

A few things to note:

PR Checklist

  • Code is formatted. (You can use the format_spiner make target.)
  • Adds a test for any bugs fixed. Adds tests for new features.
  • Document any new features, update documentation for changes made.
  • Update the CHANGELOG.md file.
  • Make sure the copyright notice on any files you modified is up to date.
  • LANL employees: make sure tests pass both on the github CI and on the Darwin CI
  • If ML was used, make sure to add a disclaimer at the top of a file indicating ML was used to assist in generating the file.
  • If Agentic AI was used, have the AI generate a "proposed changes" markdown file and store it in the plan_histories folder, with a filename the same as the MR number.

If preparing for a new release, in addition please check the following:

  • Update the version in cmake.
  • Maintainers: ensure spackages are up to date:
    • LANL-internal team, update XCAP spackages
    • Current maintainer of upstream spackages, submit MR to spack

Comment thread spiner/databox.hpp Outdated
Comment thread spiner/databox.hpp
}
inline void setRange(int i, Grid_t g) {
PORTABLE_REQUIRE(0 <= i && i < rank_, "Grid must be in index range");
grids_[i].finalize(); // TODO(JMM): Do we want this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I decided we do not.

Comment thread spiner/databox.hpp
PORTABLE_REQUIRE(0 <= i && i < rank_, "Grid must be in index range");
grids_[i].finalize(); // TODO(JMM): Do we want this?
setIndexType(i, IndexType::Interpolated);
// TODO(JMM): Should this be a move?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No it shouldn't.

Comment thread spiner/databox.hpp
Comment on lines -404 to -405
// TODO(JMM): This could be replaced by a per-grid warning as we
// do for databox data if we want.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We do want.

Comment thread test/test.cpp
Comment on lines -790 to -792
/* A mocked up UniformGrid1D that owns an array of data.
* TODO(JMM): Remove/replace/update this once we have a NonuniformGrid1D.
*/

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

and done

Comment thread spiner/nonuniform_grid_1d.hpp Outdated
Comment thread spiner/nonuniform_grid_1d.hpp Outdated
Comment thread spiner/nonuniform_grid_1d.hpp Outdated
Comment thread spiner/nonuniform_grid_1d.hpp Outdated
Comment thread spiner/databox.hpp
Comment on lines +442 to 448
// JMM: We may wish to manually manage memory-owning grid objects
// to minimize the memory footprint.
if (include_grids) {
for (int i = 0; i < rank_; ++i) {
a.grids_[i] = grids_[i].getOnDevice();
}
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is new in my latest push. I added this functionality anticipating using it to be memory efficient for getOnDevice for SpinerEOS objects.

@Yurlungur

Copy link
Copy Markdown
Collaborator Author

@adamdempsey90 please re-review. I think I've addressed all your comments.

@Yurlungur
Yurlungur merged commit 08766fc into main Aug 5, 2026
4 checks passed
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.

4 participants