fix: mesh_config in load#438
Conversation
There was a problem hiding this comment.
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 usemesh.cfg()as the base config before applyingmin_level/max_level/disable_args_parse.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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(); |
There was a problem hiding this comment.
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.
| 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(); |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
TIP This summary will be updated as you push new changes. Give us feedback
🤖 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).
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