simplify toFieldBox usage#1018
Conversation
📝 Walkthrough""" WalkthroughThe changes refactor box conversion logic throughout the field data and geometry classes by removing the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant FieldData
participant FieldGeometry
participant GridLayout
User->>FieldData: copy/pack/unpack/operate(...)
FieldData->>FieldGeometry: toFieldBox(ghostBox, qty, layout)
FieldGeometry->>GridLayout: isPrimal(qty, direction)
FieldGeometry-->>FieldData: fieldBox
FieldData-->>User: result
Possibly related issues
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (7)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
|
error TBD in master field_linear_time_interpolate we have auto srcGhostBox = FieldGeometry<GridLayoutT, PhysicalQuantity>::toFieldBox(
fieldDataSrcNew.getBox(), qty, fieldDataSrcNew.gridLayout, withGhost);on this branch becomes: auto srcGhostBox = FieldGeometry<GridLayoutT, PhysicalQuantity>::toFieldBox(
fieldDataSrcNew.getGhostBox(), qty, fieldDataSrcNew.gridLayout);with the new definition of gdb tells me that On master though, The -5,26 on this PR is indeed just upper+1 as expected. On master it seems it's resulting in -2,23 because the So I wonder who's wrong at this point. TBD |
|
replacing the ghost{5} by ghost{GridYee::nbrGhosts()} makes the test working |
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (2)
src/amr/data/field/field_geometry.hpp (2)
152-159:⚠️ Potential issueUpdate documentation to remove withGhost parameter reference.
The documentation still mentions the
withGhostparameter which has been removed from the method signature./** * @brief toFieldBox takes an AMR cell-centered box and creates a box * that is adequate for the specified quantity. The layout is used to know - * the centering, nbr of ghosts of the specified quantity. - * @param withGhost true if we want to include the ghost nodes in the field box. + * the centering of the specified quantity. * * Note : precondition : the nbr of physical cells of the layout must correspond * to the nbr of cells of the box. */
279-279:⚠️ Potential issueRemove unused variable.
The
withGhostsvariable is no longer used after the refactoring and should be removed.- bool withGhosts = true;
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/amr/data/field/field_geometry.hpp(7 hunks)tests/amr/data/field/time_interpolate/test_field_data_time_interpolate.cpp(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/amr/data/field/time_interpolate/test_field_data_time_interpolate.cpp
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.hpp`: Review the C++ code, point out issues relative to principles of clean code, expressiveness, and performance.
**/*.hpp: Review the C++ code, point out issues relative to principles of clean code, expressiveness, and performance.
src/amr/data/field/field_geometry.hpp
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: build (macos-14)
- GitHub Check: build (ubuntu-latest, gcc)
- GitHub Check: build (macos-13)
- GitHub Check: build (ubuntu-latest, clang)
- GitHub Check: build (macos-latest)
- GitHub Check: Analyze (cpp)
- GitHub Check: Analyze (python)
🔇 Additional comments (4)
src/amr/data/field/field_geometry.hpp (4)
92-97: Good refactoring to explicit ghost box handling.The constructor now explicitly creates a ghost box by growing the input box by the appropriate number of ghost cells. This is cleaner and more explicit than the previous boolean flag approach.
141-141: Correct update to match new toFieldBox signature.The removal of the withGhost parameter is consistent with the refactoring.
194-206: Clean and correct implementation of field box conversion.The simplified implementation correctly handles primal/dual centering by adding the appropriate offset to the upper bound. This is much cleaner than the previous conditional logic.
320-320: Consistent update in restriction box handling.The toFieldBox call correctly follows the new signature without the withGhost parameter.
tests/amr/data/field/time_interpolate/test_field_data_time_interpolate.cpp
Outdated
Show resolved
Hide resolved
tests/amr/data/field/time_interpolate/test_field_data_time_interpolate.cpp
Outdated
Show resolved
Hide resolved
* simplify field box function * fix hard coded ghost nbr=5 into regular layout usage in a test
* simplify field box function * fix hard coded ghost nbr=5 into regular layout usage in a test
* simplify field box function * fix hard coded ghost nbr=5 into regular layout usage in a test
attempts to #1013