Remove all references to "EmptyBox"#1165
Remove all references to "EmptyBox"#1165PhilipDeegan wants to merge 1 commit intoPHAREHUB:masterfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughGrid/box API refactor: removed Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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/core/data/grid/gridlayout.hpp (1)
114-127: Optional AMRBox parameter is a clean replacement for EmptyBox semantics.The constructor properly handles both provided and absent AMRBox values, with appropriate validation. The capture-less lambda for
inverseMeshSize_initialization is efficient.Consider enhancing the error message to include actual sizes for easier debugging:
💡 Optional: Include sizes in error message
- if (AMRBox_.size() != boxFromNbrCells(nbrCells).size()) - throw std::runtime_error("Error - invalid AMR box, incorrect number of cells"); + auto const expected = boxFromNbrCells(nbrCells); + if (AMRBox_.size() != expected.size()) + throw std::runtime_error("Error - invalid AMR box: got " + + std::to_string(AMRBox_.size()) + " cells, expected " + + std::to_string(expected.size()));🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/core/data/grid/gridlayout.hpp` around lines 114 - 127, The runtime_error thrown when AMRBox_.size() mismatches boxFromNbrCells(nbrCells).size() lacks detail; update the constructor in which AMRBox_ is set (uses AMRBox_, boxFromNbrCells, meshSize_, nbrCells) to include the actual sizes in the exception message so debugging is easier (e.g., include AMRBox_.size() and boxFromNbrCells(nbrCells).size() values and contextual text in the thrown std::runtime_error).
🤖 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/core/data/grid/gridlayout.hpp`:
- Around line 114-127: The runtime_error thrown when AMRBox_.size() mismatches
boxFromNbrCells(nbrCells).size() lacks detail; update the constructor in which
AMRBox_ is set (uses AMRBox_, boxFromNbrCells, meshSize_, nbrCells) to include
the actual sizes in the exception message so debugging is easier (e.g., include
AMRBox_.size() and boxFromNbrCells(nbrCells).size() values and contextual text
in the thrown std::runtime_error).
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/core/data/grid/gridlayout.hppsrc/core/data/particles/particle_array.hppsrc/core/utilities/box/box.hppsrc/core/utilities/cellmap.hpptests/core/numerics/pusher/test_pusher.cpp
65166c9 to
c22f461
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/core/data/grid/gridlayout.hpp`:
- Around line 124-125: The current check only compares total cell count
(AMRBox_.size()) with boxFromNbrCells(nbrCells).size(), which allows mismatched
per-dimension extents to slip through and break AMRToLocal/localToAMR; replace
this with an element-wise shape validation: obtain the expected per-dimension
extents from boxFromNbrCells(nbrCells) and compare each corresponding dimension
to AMRBox_ (e.g., same number of dimensions and equal extents for every index),
and throw the runtime_error if any dimension differs so AMRToLocal and
localToAMR can safely assume matching shapes.
In `@tests/core/numerics/pusher/test_pusher.cpp`:
- Around line 122-126: The AMRBox() factory constructs an enormous Box<int,
dimension> from 0..1000 per axis which causes ParticleArray/CellMap allocation
blowups; change AMRBox() (the AMRBox() function returning PHARE::core::Box<int,
dimension> built with ConstArray<int, dim>) to use a much smaller extent (e.g.
8..32 per axis or a small test-specific constant) or make the extents
configurable for tests so ParticleArray/CellMap allocations remain tiny for CI;
update any callers relying on AMRBox() to use the reduced-size box or the new
parameter so tests still exercise logic without huge memory/time cost.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/core/data/grid/gridlayout.hppsrc/core/data/particles/particle_array.hppsrc/core/utilities/box/box.hppsrc/core/utilities/cellmap.hpptests/core/numerics/pusher/test_pusher.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- src/core/data/particles/particle_array.hpp
c22f461 to
80890ad
Compare
80890ad to
dc26e6a
Compare
| auto const box_is_valid = box_.size() > 1; | ||
| if (box_is_valid) |
There was a problem hiding this comment.
now it's an implementation detail rather than a function/interface that is somewhat nonsensical
replace with std::optional when required.
closes #1092