allow arbitrary vector allocators for restarts#1161
allow arbitrary vector allocators for restarts#1161PhilipDeegan wants to merge 1 commit intoPHAREHUB:masterfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughRefactors restart I/O to use new helper templates, adds those helpers in Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/amr/samrai.hpp (1)
72-83: Consider making empty vectors a no-op in the write helper.Adding an early
vec.empty()return here would centralize behavior and avoid repeating zero-size guards at call sites.As per coding guidelines, `**/*.hpp`: “Review the C++ code, point out issues relative to principles of clean code, expressiveness, and performance.”♻️ Proposed refactor
template<typename T, typename A> void putVectorToRestart(auto& db, auto const& path, std::vector<T, A> const& vec) { + if (vec.empty()) + return; + if constexpr (std::is_same_v<T, double>) db.putDoubleArray(path, vec.data(), vec.size()); else if constexpr (std::is_same_v<T, int>) db.putIntegerArray(path, vec.data(), vec.size());🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/amr/samrai.hpp` around lines 72 - 83, The helper putVectorToRestart should early-return on empty vectors to centralize behavior and avoid callers duplicating zero-size checks; modify putVectorToRestart to check if vec.empty() and return immediately before calling db.putDoubleArray or db.putIntegerArray, preserving the existing type-specific branches (std::is_same_v<T,double> and std::is_same_v<T,int>) and keep the static_assert for unsupported types.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/amr/samrai.hpp`:
- Around line 72-83: The helper putVectorToRestart should early-return on empty
vectors to centralize behavior and avoid callers duplicating zero-size checks;
modify putVectorToRestart to check if vec.empty() and return immediately before
calling db.putDoubleArray or db.putIntegerArray, preserving the existing
type-specific branches (std::is_same_v<T,double> and std::is_same_v<T,int>) and
keep the static_assert for unsupported types.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/amr/data/field/field_data.hppsrc/amr/data/particles/particles_data.hppsrc/amr/data/tensorfield/tensor_field_data.hppsrc/amr/samrai.cppsrc/amr/samrai.hppsrc/core/utilities/types.hpp
1b388e3 to
dbf1d35
Compare
samrai restart
putVectorstyle functions only support vectors with the default standard allocatorwe could ask samrai folks to allow for other allocators, but that might never even happen