Skip to content

fix: mesh_config in load#438

Merged
gouarin merged 3 commits into
hpc-maths:mainfrom
gouarin:load_config
Apr 2, 2026
Merged

fix: mesh_config in load#438
gouarin merged 3 commits into
hpc-maths:mainfrom
gouarin:load_config

Conversation

@gouarin
Copy link
Copy Markdown
Contributor

@gouarin gouarin commented Mar 24, 2026

Description

Updates restart loading to build the reconstructed mesh config from the existing mesh’s config rather than default-constructing a new config.

Code of Conduct

By submitting this PR, you agree to follow our Code of Conduct

  • I agree to follow this project's Code of Conduct

Copy link
Copy Markdown
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

Updates restart loading to build the reconstructed mesh config from the existing mesh’s config rather than default-constructing a new config.

Changes:

  • Switch mesh config creation in samurai::load(HighFive::File, Mesh&, ...) to use mesh.cfg() as the base config before applying min_level/max_level/disable_args_parse.

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

Comment thread include/samurai/io/restart.hpp Outdated
load(file, ca);
using config_t = typename Mesh::config_t;
auto mesh_cfg = config_t().min_level(min_level).max_level(max_level).disable_args_parse();
auto mesh_cfg = mesh.cfg().min_level(min_level).max_level(max_level).disable_args_parse();
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

mesh.cfg() returns a mutable reference to the mesh’s internal mesh_config (see Mesh_base::cfg()), and min_level()/max_level()/disable_args_parse() mutate it. With the current chained call, the existing mesh is modified before Mesh new_mesh{ca, mesh_cfg}; runs, so if Mesh construction throws the caller’s mesh is left partially modified (exception-safety regression vs the previous config_t() temporary). Consider copying the config first (e.g., auto mesh_cfg = mesh.cfg(); then apply the setters on mesh_cfg) so mesh stays unchanged until swap succeeds.

Suggested change
auto mesh_cfg = mesh.cfg().min_level(min_level).max_level(max_level).disable_args_parse();
auto mesh_cfg = mesh.cfg();
mesh_cfg.min_level(min_level).max_level(max_level).disable_args_parse();

Copilot uses AI. Check for mistakes.
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@gouarin gouarin changed the title fix: config in load fix: mesh_config in load Apr 2, 2026
@gouarin gouarin merged commit 7f43222 into hpc-maths:main Apr 2, 2026
19 checks passed
@gouarin gouarin deleted the load_config branch April 2, 2026 06:14
gouarin added a commit that referenced this pull request May 4, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.30.0](v0.29.2...v0.30.0)
(2026-05-04)


### Features

* ND projection and prediction operator
([#435](#435))
([55829ab](55829ab))


### Bug Fixes

* mesh_config in load
([#438](#438))
([7f43222](7f43222))
* set tag type to `uint8_t`
([#437](#437))
([44e2ce7](44e2ce7))


### Performance Improvements

* improve tag computation
([#436](#436))
([b0aadc5](b0aadc5))
* optimizations of local non-linear solvers
([#439](#439))
([f0eedea](f0eedea))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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