Skip to content

Add output APIs#108

Merged
chengcli merged 4 commits intomainfrom
cli/refine_grid3
Jan 25, 2026
Merged

Add output APIs#108
chengcli merged 4 commits intomainfrom
cli/refine_grid3

Conversation

@chengcli
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings January 25, 2026 00:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Python bindings to expose output-related configuration and runtime state, enabling Python-side inspection/control of outputs.

Changes:

  • Switch pybind11 holders for OutputType / NetcdfOutput to std::shared_ptr to support returning/storing outputs via shared ownership.
  • Expose OutputType.file_number and OutputType.next_time as Python-accessible fields.
  • Expose MeshBlockOptions.outputs (and related output fields) plus add MeshBlock.get_outputs() to retrieve a block’s configured outputs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
python/csrc/pyoutput.cpp Updates OutputType/NetcdfOutput pybind holders and exposes output scheduling fields to Python.
python/csrc/pymesh.cpp Adds Python access to mesh output options and exposes a get_outputs() accessor for a block’s outputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

.def("increment_file_number",
[](snap::OutputType &a) { return ++a.file_number; });
.def_readwrite("file_number", &snap::OutputType::file_number)
.def_readwrite("next_time", &snap::OutputType::next_time);
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

The Python binding for OutputType.increment_file_number() was removed, but it is still used in multiple in-repo Python entrypoints/tests (e.g., tests/test_crater.py and several scripts under examples/). This will break those callers at runtime. Consider re-adding increment_file_number() as a thin convenience/deprecated alias (internally updating file_number), or update all in-repo call sites and any documented API expectations accordingly.

Suggested change
.def_readwrite("next_time", &snap::OutputType::next_time);
.def_readwrite("next_time", &snap::OutputType::next_time)
.def(
"increment_file_number",
[](snap::OutputType &self) {
// Deprecated convenience alias: prefer manipulating file_number directly.
self.file_number++;
},
"Deprecated: use 'file_number += 1' instead.");

Copilot uses AI. Check for mistakes.
@chengcli chengcli merged commit a1b769c into main Jan 25, 2026
3 checks passed
@chengcli chengcli deleted the cli/refine_grid3 branch January 25, 2026 21:14
@github-actions
Copy link
Contributor

🎉 Released v1.2.6!

What's Changed

Full Changelog: v1.2.5...v1.2.6

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.

1 participant