-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hierarchy views #787
hierarchy views #787
Conversation
WalkthroughThe codebase has undergone a major refactoring, transitioning from the Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 28
Configuration used: .coderabbit.yaml
Files selected for processing (57)
- res/cmake/dep.cmake (1 hunks)
- res/cmake/test.cmake (1 hunks)
- src/amr/data/field/field_data.hpp (2 hunks)
- src/amr/messengers/hybrid_hybrid_messenger_strategy.hpp (3 hunks)
- src/amr/multiphysics_integrator.hpp (5 hunks)
- src/amr/physical_models/hybrid_model.hpp (2 hunks)
- src/amr/resources_manager/field_resource.hpp (1 hunks)
- src/amr/resources_manager/resources_manager.hpp (1 hunks)
- src/amr/solvers/solver.hpp (5 hunks)
- src/amr/solvers/solver_mhd.hpp (2 hunks)
- src/amr/solvers/solver_ppc.hpp (8 hunks)
- src/amr/solvers/solver_ppc_model_view.hpp (1 hunks)
- src/amr/tagging/default_hybrid_tagger_strategy.hpp (1 hunks)
- src/amr/tagging/hybrid_tagger.hpp (1 hunks)
- src/core/data/electrons/electrons.hpp (9 hunks)
- src/core/data/field/field.hpp (1 hunks)
- src/core/data/grid/grid.hpp (1 hunks)
- src/core/data/grid/gridlayout.hpp (6 hunks)
- src/core/data/ions/ion_population/ion_population.hpp (1 hunks)
- src/core/data/ions/ions.hpp (2 hunks)
- src/core/data/ndarray/ndarray_vector.hpp (5 hunks)
- src/core/data/vecfield/vecfield.hpp (4 hunks)
- src/core/models/hybrid_state.hpp (1 hunks)
- src/core/numerics/ampere/ampere.hpp (1 hunks)
- src/core/numerics/faraday/faraday.hpp (1 hunks)
- src/core/numerics/ohm/ohm.hpp (1 hunks)
- src/core/utilities/box/box.hpp (1 hunks)
- src/core/utilities/types.hpp (2 hunks)
- src/diagnostic/detail/types/fluid.hpp (1 hunks)
- src/phare_core.hpp (3 hunks)
- src/simulator/phare_types.hpp (1 hunks)
- tests/amr/data/field/coarsening/test_linear_coarsen.hpp (3 hunks)
- tests/amr/data/field/copy_pack/field_data_test_param.hpp (2 hunks)
- tests/amr/data/field/geometry/test_field_geometry.cpp (2 hunks)
- tests/amr/data/field/refine/test_field_refine.cpp (1 hunks)
- tests/amr/data/field/refine/test_field_refinement_on_hierarchy.cpp (2 hunks)
- tests/amr/data/field/refine/test_field_refinement_on_hierarchy.hpp (1 hunks)
- tests/amr/data/field/time_interpolate/test_field_data_time_interpolate.cpp (2 hunks)
- tests/amr/data/field/variable/test_field_variable.cpp (2 hunks)
- tests/amr/models/test_models.cpp (1 hunks)
- tests/amr/resources_manager/CMakeLists.txt (1 hunks)
- tests/amr/resources_manager/test_resources_manager.cpp (2 hunks)
- tests/amr/resources_manager/test_resources_manager_basic_hierarchy.hpp (1 hunks)
- tests/amr/tagging/test_tagging.cpp (1 hunks)
- tests/core/data/electrons/test_electrons.cpp (9 hunks)
- tests/core/data/field/test_field.hpp (2 hunks)
- tests/core/data/grid/CMakeLists.txt (1 hunks)
- tests/core/data/grid/test_grid.cpp (9 hunks)
- tests/core/data/grid/test_grid.hpp (1 hunks)
- tests/core/data/gridlayout/gridlayout_base_params.hpp (1 hunks)
- tests/core/data/gridlayout/gridlayout_deriv.hpp (4 hunks)
- tests/core/data/gridlayout/gridlayout_laplacian.hpp (4 hunks)
- tests/core/data/ion_population/test_ion_population.cpp (1 hunks)
- tests/core/data/ions/test_ions.cpp (2 hunks)
- tests/core/data/vecfield/test_main.cpp (5 hunks)
- tests/core/numerics/ampere/test_main.cpp (6 hunks)
- tests/core/numerics/faraday/test_main.cpp (6 hunks)
Files not processed due to max files limit (4)
- tests/core/numerics/interpolator/test_main.cpp
- tests/core/numerics/ion_updater/test_updater.cpp
- tests/core/numerics/ohm/test_main.cpp
- tests/simulator/test_restarts.py
Files skipped from review due to trivial changes (9)
- res/cmake/dep.cmake
- src/amr/tagging/default_hybrid_tagger_strategy.hpp
- src/core/data/ions/ion_population/ion_population.hpp
- src/core/data/ions/ions.hpp
- src/core/utilities/box/box.hpp
- tests/amr/resources_manager/CMakeLists.txt
- tests/core/data/grid/CMakeLists.txt
- tests/core/data/gridlayout/gridlayout_deriv.hpp
- tests/core/data/ion_population/test_ion_population.cpp
Additional comments: 169
res/cmake/test.cmake (1)
- 8-14: The summary mentions that "tests/core/data/field" has been replaced with "tests/core/data/grid", but the hunk does not show the removal of "tests/core/data/field". Please verify if the summary is accurate or if the removal was omitted.
src/amr/data/field/field_data.hpp (2)
89-91: The assertion ensures that
field.vector()
is not empty before attempting to populate it from the restart database. Verify that the size check is indeed intended to be non-zero and not a specific expected size. Additionally, confirm that the size of the array being read from the database matches the size offield.vector()
to prevent buffer overflows or underflows.314-314: The use of
auto*
in thegetPointer
method simplifies the code and ensures that the correct pointer type is returned even if the type offield
changes. This change is consistent with modern C++ practices.src/amr/messengers/hybrid_hybrid_messenger_strategy.hpp (3)
49-88: The changes to the
FieldUser
struct to useGridT
and the addition of thecopyData
method are consistent with the summary and appear to be correctly implemented.95-125: The changes to the
HybridHybridMessengerStrategy
class to useGridT
instead ofFieldT
are consistent with the summary and appear to be correctly implemented.1005-1009: The changes to the
NiOldUser_
member to useFieldUser<GridT>
are consistent with the summary and appear to be correctly implemented.src/amr/multiphysics_integrator.hpp (5)
344-351: The logic to either push a new model view or update an existing one based on the
levelNumber
is correctly implemented.365-374: The loop to register levels with the messenger and create model views for each level is correctly implemented.
498-502: The
advanceLevel
method call has been correctly updated to includegetModelView_(iLevel)
as an additional argument.579-579: The new member variable
model_views_
has been correctly added to the class.807-807: The new private method
getModelView_
has been correctly added to retrieve the model view based on the level.src/amr/physical_models/hybrid_model.hpp (4)
4-7: The addition of
#include "core/data/grid/grid.hpp"
aligns with the refactoring to useGrid
types.37-38: The introduction of the
grid_type
alias is consistent with the refactoring to useGrid
types.45-45: The relocation of
model_name
is consistent with the summary and does not affect functionality.33-41: The changes to type definitions such as
gridlayout_type
,electromag_type
,vecfield_type
,field_type
,grid_type
, andresources_manager_type
are consistent with the refactoring to useGrid
types.src/amr/resources_manager/field_resource.hpp (1)
- 19-19: The
internal_type_ptr
still usesResourcesUser::field_type
. Please verify if this is intentional or if it should also be updated toResourcesUser::grid_type
to maintain consistency with the other type changes.src/amr/resources_manager/resources_manager.hpp (2)
574-574: The
ResourcesUser
parameter is commented out, which contradicts the summary stating that it is now used in the method. Please verify if the parameter should be uncommented or if the summary needs to be updated.575-575: The use of
const
for theallocateTime
parameter is a good practice to ensure it is not modified within the method.src/amr/solvers/solver.hpp (6)
19-25: The
ISolverModelView
class has been added as an interface, which currently only includes a virtual destructor. Ensure that the implementation of this interface in derived classes is planned and that it will be utilized effectively in the codebase.47-49: The addition of type aliases
patch_t
,level_t
, andhierarchy_t
in theISolver
class is a good practice for code readability and maintainability, as it abstracts the underlying types and makes future changes easier.89-93: The
advanceLevel
method now includes an additional parameterISolverModelView& view
. Ensure that all implementations of this method are updated accordingly and that theview
parameter is being used effectively within the method's logic.103-104: The
allocate
method now uses the type aliaspatch_t
instead of the specificSAMRAI::hier::Patch
type. This change increases the flexibility of the code by decoupling it from a specific implementation and should be reflected in all derived classes and usages.112-113: The new virtual method
make_view
has been added to create a view for the solver model. Ensure that the implementations of this method in derived classes provide meaningful and correct views of the solver model, and that these views are utilized where necessary.116-117: The constructor of
ISolver
is now protected, which is a good practice as it prevents direct instantiation of the interface and ensures that only derived classes can be instantiated. The constructor initializessolverName
, which is a clean way to set up the name for each solver instance.src/amr/solvers/solver_mhd.hpp (1)
- 38-60: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [14-59]
The changes to the
SolverMHD
class, including the addition of type aliases and modifications to function signatures, align with the summary and appear to be correctly implemented.src/amr/solvers/solver_ppc.hpp (4)
49-49: The addition of the type alias
HybridModelView_t
is confirmed and aligns with the summary.97-99: The new function
make_view
is added as described in the summary and correctly returns aHybridModelView_t
object.106-124: The methods
predictor1_
,predictor2_
,corrector_
,average_
, andmoveIons_
now correctly take an additional parameterHybridModelView_t& view
as mentioned in the summary.93-95: The function signature for
advanceLevel
has been updated to include the new parameterISolverModelView& view
as described in the summary.src/amr/solvers/solver_ppc_model_view.hpp (2)
38-40: The use of
dynamic_cast
in theregrid
function could lead to astd::bad_cast
exception if the cast is not valid. It's important to ensure that the function is only called with compatible types or to handle the potential exception.94-102: The
assert
statements in the iterator's dereference operators are used to ensure the validity of the current state. While this is good for debugging, it's important to note that asserts are not usually present in release builds, so they should not be relied upon for program logic.src/amr/tagging/hybrid_tagger.hpp (2)
90-93: The summary states that the second
int*
argument has been removed from theNdArrayView
template arguments, but the code still shows two template arguments being used. Please verify if the summary is accurate or if the code needs to be updated to reflect the intended changes.94-96: The code within the
if constexpr
block is specific to 2D cases. If the application is intended to support 1D or 3D as well, corresponding code blocks should be added to handle those dimensions.src/core/data/electrons/electrons.hpp (12)
139-139: The summary states that
ions_
was changed from a reference to an object, but the code still shows it as a reference. Please verify this discrepancy.140-141: The summary states that
J_
andVe_
were changed from references to objects, but the code still shows them as references. Please verify this discrepancy.157-160: The change to the constructor of
IsothermalElectronPressureClosure
to takeIons const& ions
is consistent with the summary.169-171: The addition of
NO_DISCARD
toisUsable
andisSettable
inIsothermalElectronPressureClosure
is consistent with the summary.235-235: The summary states that
ions_
was changed from a reference to an object, but the code still shows it as a reference. Please verify this discrepancy.236-236: The change of
Te_
from a constant reference to a constant inIsothermalElectronPressureClosure
is consistent with the summary.237-237: The summary states that
Pe_
was changed from a pointer to an object, but the code still shows it as a pointer. Please verify this discrepancy.252-254: The change to the constructor of
ElectronMomentModel
to takeIons& ions
is consistent with the summary.304-304: The summary indicates a change in
fluxComput_
fromFluxComputer
toFluxComputer
, which seems to be an error as it suggests no actual change.305-305: The change of
pressureClosure_
fromIsothermalElectronPressureClosure<FluxComputer>
toIsothermalElectronPressureClosure<Ions>
inElectronMomentModel
is consistent with the summary.323-324: The addition of copy constructor and deletion of move constructor in
Electrons
is consistent with the summary.7-10: The summary indicates significant refactoring related to
Grid
andField
types, but the provided hunks do not cover all these changes. Please ensure that all related changes are consistent throughout the codebase.src/core/data/field/field.hpp (6)
14-14: The namespace change from
PHARE
toPHARE::core
is correctly applied.25-25: The
using
statement forSuper
is correctly added to aliasNdArrayImpl
.31-38: The constructor has been correctly updated to take a
std::array
for dimensions.45-46: The
name
andphysicalQuantity
methods have been correctly updated to return references.48-48: The
copyData
method should be made private according to the summary, but it is still public in the code.- public: - void copyData(Field const& source) { Super::fill_from(source); } + private: + void copyData(Field const& source) { Super::fill_from(source); }
- 58-68: The new
average
function has been correctly added to the code.src/core/data/grid/gridlayout.hpp (7)
325-332: The summary of changes mentions
Field_t
replacingNdArrayImpl
, but the pull request summary discusses a transition fromField
toGrid
types. Please verify the consistency between the summaries and the actual changes in the code.328-332: The change to
physicalStartIndex
to accept aField_t
type is consistent with the summary and seems correct.370-374: The change to
physicalEndIndex
to accept aField_t
type is consistent with the summary and seems correct.408-412: The change to
ghostStartIndex
to accept aField_t
type and use the[[maybe_unused]]
attribute for the parameters is consistent with the summary and seems correct.450-453: The change to
ghostEndIndex
to accept aField_t
type is consistent with the summary and seems correct.467-473: The change to
fieldNodeCoordinates
to accept aField_t
type is consistent with the summary and seems correct.961-965: The change to
fieldCentering
to accept aField_t
type is consistent with the summary and seems correct.src/core/data/ndarray/ndarray_vector.hpp (6)
197-197: The summary indicates that the 'zero' member function was removed from 'NdArrayVector', but it is actually present in 'NdArrayView'. Please verify if this is an oversight in the summary or the code.
147-150: The use of 'std::decay_t' in the constructor ensures that cv-qualifiers and references are removed from the type, which is a good practice for type compatibility.
184-189: The 'fill_from' function correctly checks for size compatibility before copying data, which ensures data integrity when copying from another 'NdArrayView'.
197-197: The addition of the 'zero' function is a useful feature that allows for resetting the data in the 'NdArrayView' to zero.
191-195: The addition of 'begin' and 'end' functions provides iterator functionality to 'NdArrayView', aligning with standard practices for container-like structures.
200-200: The change of the 'ptr_' member variable type to 'pointer_type' is consistent with the removal of the 'Pointer' template parameter and the refactoring described in the summary.
src/core/data/vecfield/vecfield.hpp (9)
30-30: The summary states that the static constexpr member
dimension
has been removed, but the hunk shows it being added. Please verify this discrepancy.33-33: The summary indicates that the
field_type
alias has been removed from the class definition, but the hunk shows it being defined. Please verify this discrepancy.37-37: The change from a deleted to a default copy constructor is consistent with the summary and is a valid change.
40-40: The change from a deleted to a default move assignment operator is consistent with the summary and is a valid change.
66-71: The modification of the return type of
getFieldNamesAndQuantities
toresources_properties
is consistent with the summary and is a valid change.127-130: The use of
auto
for the return type of thegetComponent
member function is consistent with the summary and is a valid change.144-147: The use of
auto
for the return type of thegetComponent
member function is consistent with the summary and is a valid change.36-36: The deletion of the default constructor is not mentioned in the summary. Please verify if this change is intentional.
39-39: The deletion of the copy assignment operator is not mentioned in the summary. Please verify if this change is intentional.
src/core/models/hybrid_state.hpp (3)
75-83: The addition of
J
to the return tuple ofgetCompileTimeResourcesUserList
may require updates to the code where this function is used. Verify that all usages of this function have been updated to handle the additional tuple element.74-85: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-85]
The summary of the pull request mentions a transition from
Field
toGrid
types, but this file does not show any changes related to that refactoring. Ensure that the changes in this file are consistent with the overall refactoring effort described in the pull request summary.
- 74-85: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-85]
The summary does not mention the addition of the
VecField J
member to theHybridState
class, which is present in the hunk. This should be included in the summary to accurately reflect the changes made to the code.src/core/numerics/ohm/ohm.hpp (3)
54-62: The summary states that the return value of
fn
is used to update thelayout_
member, but the code shows thatfn
is called withstate
as an argument, and the result is destructured to obtainlayout
and other variables. The summary should be updated to accurately reflect the code's behavior.65-66: The member variables
eta_
andnu_
are correctly defined as constants, which is good practice for values that should not change after construction.50-67: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [9-11]
The
Ohm
class correctly inherits fromLayoutHolder<GridLayout>
, which is consistent with the design of handling layout information.src/core/utilities/types.hpp (4)
72-76: The addition of
type_list
struct with a nested type aliasTuple
is correctly implemented and follows the conventions of the file.330-346: The modifications to the
all
,any
, andnone
functions to accept an additional template parameterFn
with a default value ofdecltype(to_bool)
are correctly implemented and enhance the flexibility of these functions.351-453: The introduction of the
Apply
struct,apply_N
functions, and thefor_N_R_mode
enum class is correctly implemented and provides a useful mechanism for applying functions to a sequence of integers with different return modes.381-453: The addition of the
for_N
functions and the functions for working with named tuples is correctly implemented and follows the conventions of the file.src/diagnostic/detail/types/fluid.hpp (1)
- 191-195: The change to use
field.data()
instead of&(*field.begin())
is a good practice as it avoids potential dereferencing of an invalid iterator and makes the code more readable. Ensure thatwrite_data_set_flat
is designed to handle the case wheredata()
returns a pointer to an empty container without dereferencing it.src/phare_core.hpp (6)
38-39: The summary states that
Array_t
was replaced withGrid_t
, butArray_t
is still being used within the definition ofGrid_t
. Please verify if this is intentional or if the summary needs to be updated.41-41: The addition of
ArrayView_t
aligns with the summary and seems correctly defined.42-43: The modifications to
VecField_t
andField_t
to useGrid_t
andArrayView_t
respectively are consistent with the summary and appear to be correctly implemented.5-5: The inclusion of
grid.hpp
is noted and seems appropriate for the changes described in the summary.50-51: The type aliases
ParticleArray_t
andParticleSoA_t
are present and seem to be correctly defined.53-55: The type aliases
MaxwellianParticleInitializer_t
,IonPopulation_t
,Ions_t
, andElectrons_t
are present and seem to be correctly defined.src/simulator/phare_types.hpp (1)
- 18-24: The addition of
Grid_t
to thePHARE_Types
struct aligns with the refactoring described in the pull request summary. Ensure that all relevant parts of the codebase are updated to useGrid_t
where appropriate.tests/amr/data/field/coarsening/test_linear_coarsen.hpp (10)
5-8: The addition of
#include "core/data/grid/grid.hpp"
is consistent with the summary and necessary for the changes made in the file.55-60: The replacement of
Field
withGrid
in theEMData
struct is consistent with the summary and reflects the refactoring to use the newGrid
type.91-97: The replacement of
Field
withGrid
in theFieldCoarsenTestData
struct is consistent with the summary and reflects the refactoring to use the newGrid
type.91-91: The change in the
absError
constant value is not mentioned in the summary, but it seems to be a minor change and may not require explicit documentation.91-91: The
absError
constant within theFieldCoarsenOperatorTest
struct is not mentioned in the summary, but it seems to be a minor change and may not require explicit documentation.91-91: The changes to the
TYPED_TEST
andTYPED_TEST_SUITE
macros are not mentioned in the summary, but they seem to be minor and may not require explicit documentation.91-91: The changes to the
createParam
function template are not mentioned in the summary, but they seem to be minor and may not require explicit documentation.91-91: The changes to the
load
function template are not mentioned in the summary, but they seem to be minor and may not require explicit documentation.91-91: The changes to the
coarsen
function template are not mentioned in the summary, but they seem to be minor and may not require explicit documentation.91-91: The changes to the
check
lambda function within theTYPED_TEST
are not mentioned in the summary, but they seem to be minor and may not require explicit documentation.tests/amr/data/field/copy_pack/field_data_test_param.hpp (3)
281-281: The change from
Field
toGrid
in the type aliasField1D
aligns with the refactoring described in the pull request summary.22-22: The inclusion of
core/data/grid/grid.hpp
is consistent with the changes described in the pull request summary.15-25: The changes in the includes and type alias are part of a larger refactoring effort and do not introduce unnecessary complexity, aligning with the user's preference for minimal and efficient code.
tests/amr/data/field/geometry/test_field_geometry.cpp (3)
10-15: The addition of the include statement for "core/data/grid/grid.hpp" and the modification of
Field1D
to useGrid
are consistent with the summary and pull request description. Ensure that the rest of the codebase is updated to reflect these changes whereField1D
is used.35-35: The
Field1D
type alias has been correctly updated to useGrid
instead ofField
, aligning with the refactoring goal. Ensure that the usage ofField1D
is consistent with this change throughout the codebase.37-37: The
FieldGeometryParam
struct template parameters appear to be compatible with the newField1D
type alias. Confirm that theGridLayoutT
andFieldImpl
parameters are used correctly in all instances whereFieldGeometryParam
is instantiated.tests/amr/data/field/refine/test_field_refine.cpp (1)
- 78-84: The type alias
FieldT
has been correctly updated to useGrid
instead ofField
. Ensure that all usages ofFieldT
throughout the codebase are updated to work with theGrid
type if they were previously expecting aField
type.tests/amr/data/field/refine/test_field_refinement_on_hierarchy.cpp (2)
20-23: The change from
Field
toGrid
type is correctly reflected in the type aliasFieldND
. This aligns with the summary and the broader refactoring effort described in the pull request.51-53: The change from
Field
toGrid
type is correctly reflected in the type aliasFieldND
within theTYPED_TEST
body. This is consistent with the changes in the rest of the file and the broader refactoring effort.tests/amr/data/field/refine/test_field_refinement_on_hierarchy.hpp (2)
9-9: The addition of the include statement for "core/data/grid/grid.hpp" aligns with the refactoring changes described in the pull request summary, ensuring that the necessary
Grid
type definitions are available in this file.6-12: No further action is required for this hunk as the rest of the code remains unchanged and the new include does not seem to introduce any conflicts or issues.
tests/amr/data/field/time_interpolate/test_field_data_time_interpolate.cpp (2)
12-18: The import statement has been correctly updated to reflect the transition from
Field
toGrid
.48-54: The type alias
FieldND
has been correctly updated toGrid<NdArrayVector<dim>, HybridQuantity::Scalar>
to align with the refactoring fromField
toGrid
.tests/amr/data/field/variable/test_field_variable.cpp (2)
8-15: The inclusion of
"core/data/grid/grid.hpp"
and the use ofGrid
in the type aliasFieldVar
are consistent with the summary's description of the refactoring fromField
toGrid
.51-53: The update of the type alias
FieldVar
to useGrid
instead ofField
is in line with the refactoring described in the summary.tests/amr/models/test_models.cpp (1)
- 35-49: The summary states that definitions for
VecField1D
,GridImplYee1D
,ParticleArray1D
, andGridYee1D
were removed, but the hunk shows that these types are still present and have been updated. Please verify the accuracy of the summary.tests/amr/resources_manager/test_resources_manager.cpp (3)
5-11: The summary mentions the inclusion of "core/data/grid/grid.hpp" on line 3, but it is actually included on line 8. Please verify the correct line number for the inclusion.
35-48: The type aliases have been updated as described in the summary, and they appear to be correctly defined.
50-50: The function
createInitDict
is well-defined and does not appear in the summary, which is acceptable as it may not be considered a key change.tests/amr/resources_manager/test_resources_manager_basic_hierarchy.hpp (3)
31-42: The constructor correctly initializes member variables using the input file data.
47-79: The
init
method correctly creates and configures aSAMRAI::hier::Box
object and uses it to create a new patch level in the hierarchy.31-39: The summary should specify that the
BasicHierarchy
class constructor initializesinputDatabase
,dimension
,patchHierarchyDatabase
,gridGeometry
, andhierarchy
member variables using data parsed from the input file.tests/amr/tagging/test_tagging.cpp (1)
- 161-165: The change from
Field_t
toGrid_t
in the type aliasField
is consistent with the overall refactoring described in the pull request summary. Ensure that all usages of theField
alias within theTestTagger
struct and related test cases are updated to work with the newGrid_t
type.tests/core/data/electrons/test_electrons.cpp (9)
5-8: The addition of
grid.hpp
and the changes in type definitions align with the refactoring to useGrid
types.130-131: The new type aliases
GridND
andVecFieldND
are correctly defined and used.143-154: The global variables
Jx
,Jy
,Jz
,J
,Nibuffer
,NiProtons
,Fxi
,Fyi
,Fzi
,Vex
,Vey
,Vez
,Vix
,Viy
,Viz
,Pe
, andpack
are correctly declared with the newGridND
type.138-198: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [186-213]
The constructor has been modified to initialize the new
GridND
variables andVecFieldND J
with appropriate types and values.
227-232: The lambda function used to fill the grid data is consistent with the refactoring and is a generic operation that should work as intended.
250-255: The lambda function for filling the grid data in the 2D case is correctly implemented.
280-285: The lambda function for filling the grid data in the 3D case is correctly implemented.
457-470: The test case
ThatElectronsVelocityEqualIonVelocityMinusJ
is correctly using theGridYee
type to project the current density onto the velocity grid.593-595: The main function for running all tests is correctly implemented.
tests/core/data/field/test_field.hpp (4)
4-14: The summary indicates changes to the function template
test
at line 19, but the hunk provided starts at line 4 and does not include line 19. Please verify the accuracy of the summary or the hunk provided.173-193: The summary indicates changes to the type of
field1
at line 31, but the hunk provided does not include line 31. Please verify the accuracy of the summary or the hunk provided.173-193: The summary indicates changes to another
test
function template at line 47, but the hunk provided does not include line 47. Please verify the accuracy of the summary or the hunk provided.173-193: The pull request summary mentions a significant refactoring from
Field
toGrid
types, but the hunk still shows the use ofField
type in the function signatures. Please verify the accuracy of the pull request summary or the hunk provided.tests/core/data/gridlayout/gridlayout_base_params.hpp (4)
13-13: The summary indicates that
#include "gridlayout_utilities.hpp"
was removed, but it is still present in the code.22-22: The summary states that the
using Grid_t
alias was added at line 10, but it is actually at line 22.32-32: The change of the
field
type tostd::shared_ptr<Grid_t>
aligns with the refactoring to useGrid
types and is correctly implemented.35-38: The change in the
makeIt_
function signature to useGrid_t
is consistent with the refactoring efforts and is correctly implemented.tests/core/data/gridlayout/gridlayout_laplacian.hpp (5)
2-8: The update of the include statement from
Field
toGrid
is consistent with the summary and the overall refactoring effort.25-30: The change from
Field
toGrid
for theJx
,Jy
, andJz
variables in the 1D Laplacian class is consistent with the summary and the overall refactoring effort.47-52: The change from
Field
toGrid
for theJx
,Jy
, andJz
variables in the 2D Laplacian class is consistent with the summary and the overall refactoring effort.69-74: The change from
Field
toGrid
for theJx
,Jy
, andJz
variables in the 3D Laplacian class is consistent with the summary and the overall refactoring effort.25-33: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [2-77]
The changes in the file are part of a larger refactoring effort and do not introduce unnecessary complexity or inefficiency, aligning with the user's preference for minimal and efficient code.
tests/core/data/ions/test_ions.cpp (2)
9-15: The changes made to the includes and type definitions are consistent with the summary and the broader refactoring effort described in the pull request. No issues found.
34-41: The updates to the type aliases
Grid1D
andVecField1D
align with the refactoring goals outlined in the pull request. The code is clear and maintainable.tests/core/data/vecfield/test_main.cpp (8)
3-6: The summary states that
#include "core/data/grid/grid.hpp"
was added at line 3, but it is actually included at line 6 in the hunk.27-44: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [26-30]
The summary states that the type of
vf2
was changed at line 26, but the hunk shows the change at line 30.
28-28: The summary mentions a change from
NdArrayVector
toNdArrayView
at line 28, but there is no such change in the provided hunk.30-39: The summary states that a new template alias
VecField_t
was added at lines 30-33, but it is actually defined at lines 38-39 in the hunk.92-112: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [88-109]
The summary states that
Field
was replaced withGrid
for various variables at lines 88-101, but the hunk shows these changes at lines 92-109.
103-109: The summary states that
VecField<NdArrayVector<dim>, HybridQuantity>
was replaced withVecField_t<dim>
forB1D_
,B2D_
, andB3D_
at lines 103-106, but the hunk shows these changes at lines 107-109.303-312: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [299-324]
The summary states that the type of various variables was changed at lines 299-315, but the hunk shows these changes at lines 306-312 and 318-324.
- 92-112: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [3-324]
The changes in the hunk are consistent with the larger refactoring effort to use
Grid
andVecField_t
types as described in the pull request summary.tests/core/numerics/ampere/test_main.cpp (6)
5-8: The inclusion of "core/data/grid/grid.hpp" aligns with the summary stating that the grid module has been added.
35-39: The refactoring of
physicalStartIndex
andphysicalEndIndex
methods inGridLayoutMock1D
to takeFieldMock
andDirection
as arguments is consistent with the summary.72-72: The addition of the template alias
Grid_t
is consistent with the summary and is a good use of type aliasing for code clarity and maintainability.128-143: The changes in
Ampere1DTest
to use theGrid_t
type for fields andVecField
for vectors, as well as the addition ofdim
andinterp_order
static variables, are consistent with the summary and improve type consistency and readability.170-185: The changes in
Ampere2DTest
to use theGrid_t
type for fields andVecField
for vectors, as well as the addition ofdim
andinterp_order
static variables, are consistent with the summary and improve type consistency and readability.212-228: The changes in
Ampere3DTest
to use theGrid_t
type for fields andVecField
for vectors, as well as the addition ofdim
andinterp_order
static variables, are consistent with the summary and improve type consistency and readability.tests/core/numerics/faraday/test_main.cpp (7)
- 29-55: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [29-68]
The summary states that
[[maybe_unused]]
attributes were removed fromphysicalStartIndex
andphysicalEndIndex
methods, but the hunks do not show any such attributes being removed. Please verify if the summary is accurate or if the changes were not included in the hunks.
5-11: The change from including
"core/data/field/field.hpp"
to"core/data/grid/grid.hpp"
aligns with the refactoring towards usingGrid
types.29-55: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [29-68]
The update to use
FieldMock<dimension>
in theGridLayoutMock
structs is consistent with the refactoring towards more specific type usage.
136-158: The update to use
Grid_t
andVecField<Grid_t, HybridQuantity>
in theFaraday1DTest
class is consistent with the refactoring towards usingGrid
types.191-213: The update to use
Grid_t
andVecField<Grid_t, HybridQuantity>
in theFaraday2DTest
class is consistent with the refactoring towards usingGrid
types.246-269: The update to use
Grid_t
andVecField<Grid_t, HybridQuantity>
in theFaraday3DTest
class is consistent with the refactoring towards usingGrid
types.246-271: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [136-271]
The test classes
Faraday1DTest
,Faraday2DTest
, andFaraday3DTest
are structured to separate concerns for each dimensionality, which is a good practice for clarity and maintainability in unit testing. This aligns with the user's preference for efficient code, as it makes the tests easier to understand and maintain.
Grid() = delete; | ||
Grid(Grid const& source) = delete; | ||
Grid(Grid&& source) = default; | ||
Grid& operator=(Grid&& source) = delete; | ||
Grid& operator=(Grid const& source) = delete; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class Grid
has a defaulted move constructor but a deleted move assignment operator. It's generally expected that if a class supports move semantics, it should define both the move constructor and move assignment operator to ensure consistency.
- Grid& operator=(Grid&& source) = delete;
+ Grid& operator=(Grid&& source) = default;
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
Grid() = delete; | |
Grid(Grid const& source) = delete; | |
Grid(Grid&& source) = default; | |
Grid& operator=(Grid&& source) = delete; | |
Grid& operator=(Grid const& source) = delete; | |
Grid() = delete; | |
Grid(Grid const& source) = delete; | |
Grid(Grid&& source) = default; | |
Grid& operator=(Grid&& source) = default; | |
Grid& operator=(Grid const& source) = delete; |
std::transform(std::begin(f1), std::end(f1), std::begin(f2), std::begin(avg), | ||
std::plus<double>()); | ||
|
||
std::transform(std::begin(avg), std::end(avg), std::begin(avg), | ||
[](double x) { return x * 0.5; }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The average
function assumes that the Grid
will always be working with double
types. This may not be the case, and the function should be templated to work with the value_type
of the Grid
.
- std::transform(std::begin(f1), std::end(f1), std::begin(f2), std::begin(avg),
- std::plus<double>());
+ std::transform(std::begin(f1), std::end(f1), std::begin(f2), std::begin(avg),
+ std::plus<typename Grid<NdArrayImpl, PhysicalQuantity>::value_type>());
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
std::transform(std::begin(f1), std::end(f1), std::begin(f2), std::begin(avg), | |
std::plus<double>()); | |
std::transform(std::begin(avg), std::end(avg), std::begin(avg), | |
[](double x) { return x * 0.5; }); | |
std::transform(std::begin(f1), std::end(f1), std::begin(f2), std::begin(avg), | |
std::plus<typename Grid<NdArrayImpl, PhysicalQuantity>::value_type>()); | |
std::transform(std::begin(avg), std::end(avg), std::begin(avg), | |
[](double x) { return x * 0.5; }); |
The average
function does not check if the sizes of the input Grid
objects are the same before performing the operation. This could lead to undefined behavior if the Grid
objects have different sizes.
auto operator&() const { return &field_; } | ||
|
||
private: | ||
std::string name_{"No Name"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Grid
class initializes the name_
member with a default value of "No Name". It would be better to enforce the name to be provided during construction to avoid objects without meaningful names.
assert(Super::size() == that.size()); | ||
std::copy(that.data(), that.data() + Super::size(), Super::data()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The copyData
method uses assert
to check the size of the Grid
objects. This check will not be performed in release builds where asserts may be disabled, potentially leading to undefined behavior.
auto const& [layout, B, E, Bnew] = fn(state); | ||
this->layout_ = &layout; | ||
(*this)(B, E, Bnew, dt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The layout_
member variable is being set inside a loop, which could lead to incorrect behavior if the states
collection contains different layouts. Verify that all states are expected to have the same layout or refactor the code to handle different layouts appropriately.
this->layout_ = &layout; | ||
(*this)(B, E, Bnew, dt); | ||
} | ||
} | ||
|
||
private: | ||
double dt_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dt_
member variable is used in the BxEq_
, ByEq_
, and BzEq_
functions but is not set in the new operator()
function. Ensure that dt_
is properly initialized before these functions are called.
tests/core/data/grid/test_grid.cpp
Outdated
{ | ||
EXPECT_EQ(std::string("test"), this->f.name()); | ||
} | ||
|
||
|
||
|
||
TYPED_TEST(GenericField1D, physiscalQuantity) | ||
TYPED_TEST(GenericGrid1D, physiscalQuantity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the test case name physiscalQuantity
. It should be corrected to physicalQuantity
for clarity and correctness.
- TYPED_TEST(GenericGrid1D, physiscalQuantity)
+ TYPED_TEST(GenericGrid1D, physicalQuantity)
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
TYPED_TEST(GenericGrid1D, physiscalQuantity) | |
TYPED_TEST(GenericGrid1D, physicalQuantity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good bot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PhilipDeegan Thank you! 😊
(\_/)
( •_•)
/>❤️
for (auto& state : states) | ||
{ | ||
auto const& [layout, B, E, Bnew] = fn(state); | ||
this->layout_ = &layout; |
Check warning
Code scanning / CodeQL
Local variable address stored in non-local memory
/* // how to use | ||
for_N<2>([](auto ic) { | ||
constexpr auto i = ic(); | ||
// ... | ||
}); | ||
*/ |
Check notice
Code scanning / CodeQL
Commented-out code
for (auto& state : states) | ||
{ | ||
auto const& [layout, B, J] = fn(state); | ||
this->layout_ = &layout; |
Check warning
Code scanning / CodeQL
Local variable address stored in non-local memory
for (auto& state : states) | ||
{ | ||
auto const& [layout, n, Ve, Pe, B, J, Enew] = fn(state); | ||
this->layout_ = &layout; |
Check warning
Code scanning / CodeQL
Local variable address stored in non-local memory
template<typename... Args> | ||
auto static _J(Args&... args) | ||
{ | ||
auto const& [Jx, Jy, Jz] = std::forward_as_tuple(args...); |
Check notice
Code scanning / CodeQL
Unused local variable
template<typename... Args> | ||
auto static _ions(Args&... args) | ||
{ | ||
auto const& [Fxi, Fyi, Fzi, Nibuffer, NiProtons, Vix, Viy, Viz, pack] |
Check notice
Code scanning / CodeQL
Unused local variable
template<typename... Args> | ||
auto static _J(Args&... args) | ||
{ | ||
auto const& [Jx, Jy, Jz] = std::forward_as_tuple(args...); |
Check notice
Code scanning / CodeQL
Unused local variable Note test
template<typename... Args> | ||
auto static _ions(Args&... args) | ||
{ | ||
auto const& [Fxi, Fyi, Fzi, Nibuffer, NiProtons, Vix, Viy, Viz, pack] |
Check notice
Code scanning / CodeQL
Unused local variable Note test
for (auto& state : states) | ||
{ | ||
auto const& [layout, B, J] = fn(state); | ||
this->layout_ = &layout; |
Check warning
Code scanning / CodeQL
Local variable address stored in non-local memory Warning
source
for (auto& state : states) | ||
{ | ||
auto const& [layout, B, E, Bnew] = fn(state); | ||
this->layout_ = &layout; |
Check warning
Code scanning / CodeQL
Local variable address stored in non-local memory Warning
source
for (auto& state : states) | ||
{ | ||
auto const& [layout, n, Ve, Pe, B, J, Enew] = fn(state); | ||
this->layout_ = &layout; |
Check warning
Code scanning / CodeQL
Local variable address stored in non-local memory Warning
source
72f4841
to
2fd735c
Compare
closes #778 |
if (static_cast<std::size_t>(levelNumber) == model_views_.size()) | ||
model_views_.push_back(solver.make_view(*level, model)); | ||
else | ||
model_views_[levelNumber] = solver.make_view(*level, model); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't super sure of the point of the level descriptor system here so I didn't use it.
That might very well be an issue for future usage with varying solvers between levels, tbc
field -> grid more more more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 22
Configuration used: .coderabbit.yaml
Files selected for processing (57)
- res/cmake/dep.cmake (1 hunks)
- res/cmake/test.cmake (1 hunks)
- src/amr/data/field/field_data.hpp (2 hunks)
- src/amr/messengers/hybrid_hybrid_messenger_strategy.hpp (3 hunks)
- src/amr/multiphysics_integrator.hpp (5 hunks)
- src/amr/physical_models/hybrid_model.hpp (2 hunks)
- src/amr/resources_manager/field_resource.hpp (1 hunks)
- src/amr/resources_manager/resources_manager.hpp (2 hunks)
- src/amr/solvers/solver.hpp (5 hunks)
- src/amr/solvers/solver_mhd.hpp (2 hunks)
- src/amr/solvers/solver_ppc.hpp (6 hunks)
- src/amr/solvers/solver_ppc_model_view.hpp (1 hunks)
- src/amr/tagging/default_hybrid_tagger_strategy.hpp (1 hunks)
- src/amr/tagging/hybrid_tagger.hpp (1 hunks)
- src/core/data/electrons/electrons.hpp (9 hunks)
- src/core/data/field/field.hpp (1 hunks)
- src/core/data/grid/grid.hpp (1 hunks)
- src/core/data/grid/gridlayout.hpp (6 hunks)
- src/core/data/ions/ion_population/ion_population.hpp (4 hunks)
- src/core/data/ions/ions.hpp (2 hunks)
- src/core/data/ndarray/ndarray_vector.hpp (5 hunks)
- src/core/data/vecfield/vecfield.hpp (4 hunks)
- src/core/models/hybrid_state.hpp (1 hunks)
- src/core/numerics/ampere/ampere.hpp (1 hunks)
- src/core/numerics/faraday/faraday.hpp (1 hunks)
- src/core/numerics/ohm/ohm.hpp (1 hunks)
- src/core/utilities/box/box.hpp (1 hunks)
- src/core/utilities/types.hpp (3 hunks)
- src/diagnostic/detail/types/fluid.hpp (1 hunks)
- src/phare_core.hpp (3 hunks)
- src/simulator/phare_types.hpp (1 hunks)
- tests/amr/data/field/coarsening/test_linear_coarsen.hpp (3 hunks)
- tests/amr/data/field/copy_pack/field_data_test_param.hpp (2 hunks)
- tests/amr/data/field/geometry/test_field_geometry.cpp (2 hunks)
- tests/amr/data/field/refine/test_field_refine.cpp (1 hunks)
- tests/amr/data/field/refine/test_field_refinement_on_hierarchy.cpp (2 hunks)
- tests/amr/data/field/refine/test_field_refinement_on_hierarchy.hpp (1 hunks)
- tests/amr/data/field/time_interpolate/test_field_data_time_interpolate.cpp (2 hunks)
- tests/amr/data/field/variable/test_field_variable.cpp (2 hunks)
- tests/amr/models/test_models.cpp (1 hunks)
- tests/amr/resources_manager/CMakeLists.txt (1 hunks)
- tests/amr/resources_manager/input_config.h (1 hunks)
- tests/amr/resources_manager/test_resources_manager.cpp (2 hunks)
- tests/amr/resources_manager/test_resources_manager_basic_hierarchy.hpp (1 hunks)
- tests/amr/tagging/test_tagging.cpp (1 hunks)
- tests/core/data/electrons/test_electrons.cpp (10 hunks)
- tests/core/data/field/test_field.hpp (2 hunks)
- tests/core/data/grid/CMakeLists.txt (1 hunks)
- tests/core/data/grid/test_grid.cpp (9 hunks)
- tests/core/data/gridlayout/gridlayout_base_params.hpp (1 hunks)
- tests/core/data/gridlayout/gridlayout_deriv.hpp (4 hunks)
- tests/core/data/gridlayout/gridlayout_laplacian.hpp (4 hunks)
- tests/core/data/ion_population/test_ion_population.cpp (1 hunks)
- tests/core/data/ions/test_ions.cpp (2 hunks)
- tests/core/data/vecfield/test_main.cpp (5 hunks)
- tests/core/numerics/ampere/test_main.cpp (6 hunks)
- tests/core/numerics/faraday/test_main.cpp (6 hunks)
Files not processed due to max files limit (4)
- tests/core/numerics/interpolator/test_main.cpp
- tests/core/numerics/ion_updater/test_updater.cpp
- tests/core/numerics/ohm/test_main.cpp
- tests/functional/harris/harris_2d_2.py
Files skipped from review due to trivial changes (4)
- res/cmake/dep.cmake
- src/amr/resources_manager/resources_manager.hpp
- tests/amr/resources_manager/input_config.h
- tests/core/data/grid/CMakeLists.txt
Additional comments: 166
res/cmake/test.cmake (1)
- 10-14: The addition of
tests/core/data/grid
and related test directories is consistent with the PR's objective of transitioning to aGrid
-based system. Ensure that any obsolete test directories, such astests/core/data/field
, are removed if they are no longer relevant to avoid maintaining dead code, in line with the user's preference for minimal and efficient code.src/amr/data/field/field_data.hpp (2)
86-91: The changes in the
getFromRestart
method to usegetDoubleArray
instead ofgetVector
and the addition of an assertion to check the vector size are good for ensuring data integrity and avoiding potential issues with empty vectors.314-314: The change in the return type of the
getPointer
method fromFieldImpl*
toauto*
is consistent with modern C++ practices and should maintain the same functionality while allowing for automatic type deduction.src/amr/messengers/hybrid_hybrid_messenger_strategy.hpp (3)
49-88: The changes to the
FieldUser
struct, including the use ofGridT
instead ofFieldT
and the addition of a nested typefield_type
, are consistent with the PR objectives and the generated summaries. ThecopyData
method's use of a template parameterThat
instead ofFieldT const&
is also in line with the refactoring.95-125: The updates to the
HybridHybridMessengerStrategy
class, including the use ofGridT
instead ofFieldT
in type aliases and member types, align with the PR objectives and the generated summaries. The changes to theBaseRefineOp
,FieldTimeInterp
, andBaseCoarsenOp
types to useGridT
are also consistent with the transition to a grid-based system.1006-1010: The
FieldUser
instanceNiOldUser_
has been correctly updated to useGridT
instead ofFieldT
, and theNiOld_
member has been changed fromFieldT*
tofield_type*
, which is consistent with the refactoring effort described in the PR objectives and the generated summaries.src/amr/multiphysics_integrator.hpp (5)
344-351: The logic for updating or pushing new model views in
initializeLevelData
is correct. However, it's important to ensure that the size ofmodel_views_
is always in sync with the number of levels. If the number of levels can change dynamically, additional logic may be needed to handle resizing ofmodel_views_
.365-374: The logic for registering levels and pushing back new model views in
resetHierarchyConfiguration
is correct. However, it's important to ensure that the size ofmodel_views_
is always in sync with the number of levels. If the number of levels can change dynamically, additional logic may be needed to handle resizing ofmodel_views_
.495-502: The logic for retrieving the model view in
advanceLevel
is correct. However, it's important to ensure that themodel_views_
vector has been properly initialized before this function is called. If the vector is not correctly initialized, accessing an element could lead to undefined behavior.575-583: The addition of the
model_views_
member is consistent with the changes in the functions that manage model views. Ensure that themodel_views_
vector is properly managed throughout the class to prevent issues such as out-of-bounds access or memory leaks.807-807: The addition of the
getModelView_
function is consistent with the changes in the functions that manage model views. Ensure that this function is used consistently throughout the class to access model views.src/amr/physical_models/hybrid_model.hpp (3)
7-7: The addition of the include statement for
"core/data/grid/grid.hpp"
is consistent with the PR's objective to transition to aGrid
-based system.37-38: The introduction of the
grid_type
alias within theHybridModel
class is consistent with the PR's objective to refactor the codebase to use a newGrid
class template.27-43: The reorganization and addition of type aliases within the
HybridModel
class are consistent with the PR's objective to refactor the codebase to use a newGrid
class template.src/amr/solvers/solver.hpp (5)
12-28: The addition of the
PHARE::solver
namespace and theISolverModelView
class is consistent with the PR summary. However, the class is currently empty, which may be intentional for future extensions.44-49: The addition of new typedefs within the
ISolver
class aligns with the PR summary and is a common practice to simplify complex type names.86-92: The method signature changes for
advanceLevel
reflect the transition to using the newhierarchy_t
andISolverModelView&
types, which is consistent with the PR summary.99-103: The method signature change for
allocate
to acceptpatch_t&
is consistent with the PR summary and reflects the refactoring towards the new type aliases.108-116: The addition of the
make_view
method and the constructor change forISolver
are consistent with the PR summary. The constructor now takes a string parameter, which is a change from the previous version.src/amr/solvers/solver_mhd.hpp (2)
17-19: The addition of type aliases
patch_t
,level_t
, andhierarchy_t
is consistent with the PR's objective of refactoring and aligns with the broader transition to a grid-based system. These aliases will help standardize types across the codebase.41-56: The changes in method signatures for
allocate
andadvanceLevel
and the addition of themake_view
method are consistent with the PR's objective. However, themake_view
method is not implemented and throws a runtime error. Ensure that this is the intended behavior and that there is a plan to implement this method in the future.src/amr/solvers/solver_ppc.hpp (7)
11-17: The inclusion of
"amr/solvers/solver_ppc_model_view.hpp"
and the addition ofFaraday_t faraday_1;
suggest that theSolverPPC
class is being extended to use a model view for the Faraday update step, which aligns with the PR title "hierarchy views". This change should be verified across the codebase to ensure consistency.99-101: The addition of the
make_view
function is a significant change as it introduces a new way of creating views for the solver. This function should be checked to ensure that it is being used correctly whereverSolverPPC
instances are created and that the dynamic cast is safe and appropriate.205-215: The
restoreState_
function now usesstd::move
to restore particle states. This is an efficient way to transfer ownership of the particle data without copying. However, it should be ensured that thetmpDomain
andpatchGhost
maps are properly managed after the move operation to avoid accessing moved-from objects.227-250: The
advanceLevel
function orchestrates the sequence of operations for advancing the solver's state. The changes here seem to reflect the new model view system and should be checked to ensure that the order of operations is correct and that all necessary state is preserved between steps.269-275: The
faraday_1
operation withinpredictor1_
is a new addition and should be checked for correctness. It's important to ensure that the lambda passed tofaraday_1
correctly captures the necessary state and that thenewTime
parameter is used appropriately within the function.401-427: The
_debug_log_move_ions
function is a new debug utility. It's important to ensure that this function is only compiled in debug builds to avoid performance overhead in release builds. The use ofPHARE_DEBUG_DO
macro suggests this, but it should be verified.433-463: The
moveIons_
function has been updated, and it's crucial to ensure that the sequence of updates and ghost fills is correct and that theUpdaterMode
is used appropriately. The changes should be checked against the model's requirements for ion movement.src/amr/solvers/solver_ppc_model_view.hpp (1)
- 35-48: The
AmpereTransformer
andOhmTransformer
classes are defined but do not contain any implementation. Please verify if this is intentional or if the implementation is pending.src/amr/tagging/default_hybrid_tagger_strategy.hpp (1)
- 42-46: The changes to the
NdArrayView
instantiation are consistent with the broader refactoring from aField
-based to aGrid
-based system and the removal of thePointer
template parameter as described in the PR summary. This change should be verified across the codebase to ensure that all instances ofNdArrayView
instantiation have been updated accordingly.src/core/data/electrons/electrons.hpp (7)
10-10: The addition of
#include "core/logger.hpp"
is consistent with the changes and may be necessary for logging within the file.139-140: The change from references to objects for
ions_
andJ_
inStandardHybridElectronFluxComputer
alters the ownership and lifecycle management of these members. Ensure that this change is intentional and that all necessary adjustments have been made throughout the codebase to accommodate this new ownership model.157-160: The constructor of
IsothermalElectronPressureClosure
now takes anIons
object instead of aFluxComputer
object. Verify that all instantiations of this class have been updated to pass the correct type of argument.169-171: The
isUsable
andisSettable
methods inIsothermalElectronPressureClosure
are now const, which is a good practice as it indicates that these methods do not modify the object state.219-220: The
computePressure
method inIsothermalElectronPressureClosure
now requires aGridLayout
parameter. Ensure that all calls to this method have been updated to include this new parameter.252-255: The constructor of
ElectronMomentModel
now takes anIons
object instead of a reference. This change in parameter type could have implications on object management and ownership. Verify that this change is intentional and that all necessary adjustments have been made throughout the codebase.324-324: The move constructor for
Electrons
is explicitly deleted. Ensure that this is intentional and that there are no attempts to moveElectrons
objects within the codebase, as this would now result in a compilation error.src/core/data/field/field.hpp (2)
58-68: The summary states that the
average
function has been moved outside thecore
namespace, but the hunk shows it is still within thecore
namespace. Please verify this discrepancy.31-38: The new constructor for the
Field
class is correctly implemented, initializing the base class and member variables as expected.src/core/data/grid/grid.hpp (8)
- 34-35: The move assignment operator is deleted, which is inconsistent with the default move constructor. Consider providing a default move assignment operator to maintain consistency with move semantics.
- Grid& operator=(Grid&& source) = delete; + Grid& operator=(Grid&& source) = default;
- 86-87: The
average
function uses a hard-codeddouble
type, which may not match thevalue_type
of theGrid
. Consider using thevalue_type
of theGrid
in thestd::plus
operation.- std::plus<double>()); + std::plus<typename Grid<NdArrayImpl, PhysicalQuantity>::value_type>());
82-90: The
average
function does not check if the sizes of the inputGrid
objects are the same before performing the operation. Consider adding a size check to prevent undefined behavior.73-73: The
Grid
class initializes thename_
member with a default value of "No Name". Consider enforcing the name to be provided during construction to avoid objects without meaningful names.64-64: The
copyData
method usesassert
to check the size of theGrid
objects, which will not be performed in release builds. Consider using a runtime check that remains in release builds.69-70: The overloaded
operator&
returns the address offield_
, which could be misleading. Consider providing a more explicit method to get the address offield_
.20-75: The
Grid
class does not provide any documentation comments. Adding documentation would improve code readability and maintainability.20-75: Given the significant refactoring from
Field
toGrid
, ensure that all related changes are consistent across the codebase and that dependent modules are updated accordingly.src/core/data/grid/gridlayout.hpp (6)
328-332: The function
physicalStartIndex
has been templated withField_t
to generalize its use, which aligns with the refactoring goal of making the code more generic.370-374: The function
physicalEndIndex
has been templated withField_t
to generalize its use, which aligns with the refactoring goal of making the code more generic.407-413: The function
ghostStartIndex
has been templated withField_t
to generalize its use, which aligns with the refactoring goal of making the code more generic.450-453: The function
ghostEndIndex
has been templated withField_t
to generalize its use, which aligns with the refactoring goal of making the code more generic.467-473: The function
fieldNodeCoordinates
has been templated withField_t
to generalize its use, which aligns with the refactoring goal of making the code more generic. However, the static assertion ensures that the number of indices provided matches the dimension, which is a good practice for compile-time error checking.961-965: The function
fieldCentering
has been templated withField_t
to generalize its use, which aligns with the refactoring goal of making the code more generic.src/core/data/ions/ion_population/ion_population.hpp (5)
24-30: The addition of
grid_type
andfield_type
type aliases, as well as thedimension
constant, aligns with the PR's objective to transition to a grid-based system. These changes are consistent with the overall refactoring effort and should be beneficial for standardizing data representation.151-157: The addition of
levelGhostParticlesOld
andlevelGhostParticlesNew
member functions is consistent with the PR's objective to enhance theIonPopulation
class's functionality. These methods provide access to different states of ghost particles, which could be important for AMR functionalities.170-176: The
const
and non-const
overloads forlevelGhostParticlesNew
are correctly implemented, following the established pattern in the class for providing access to particle arrays.192-198: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [180-196]
The changes to the
density
member function, addingconst
qualifiers, are consistent with best practices for const-correctness. This ensures that the function does not modify the object state, which is a good practice for accessor methods.
- 151-161: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [24-197]
The changes in the
IonPopulation
class are consistent with the PR's objective to refactor the codebase to a grid-based system. The new member functions and type aliases support this transition and are likely to improve the codebase's maintainability and performance.src/core/data/ions/ions.hpp (3)
26-31: The introduction of
grid_type
as a type alias is consistent with the PR's objective of transitioning to aGrid
-based system. This change should be reflected in all places whereIonPopulation::grid_type
is used within theIons
class.40-41: The addition of default move and copy constructors is a good practice for classes that manage resources, which can help ensure that instances of
Ions
are copied and moved correctly. This is especially important given the presence of pointers likerho_
andmassDensity_
within the class.37-44: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [26-44]
The changes to the
Ions
class are consistent with the PR's objective of transitioning to aGrid
-based system and do not appear to introduce any new issues or regressions. The addition of default move and copy constructors is a good practice and likely to improve the maintainability and readability of the code. These changes are likely to have a significant impact on the codebase, requiring updates to dependent modules and potentially affecting the behavior of the software.src/core/data/ndarray/ndarray_vector.hpp (7)
131-150: The changes to the
NdArrayView
class reflect the removal of thePointer
template parameter and the introduction ofpointer_type
. The constructors have been updated accordingly, and new methods for iterator support and zeroing the array have been added. These changes are consistent with the summary provided.184-189: The
fill_from
method correctly checks for size compatibility before copying data, which is a good error handling practice.197-197: The
zero
method is implemented efficiently usingstd::fill
to zero out the array.191-195: The
begin
andend
methods are correctly provided in both const and non-const versions to support iteration over the array.153-159: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [153-169]
The
operator()
overloads for element access are updated to use theviewer
alias and are consistent with the removal of thePointer
template parameter.
200-200: The
ptr_
member is safely initialized tonullptr
, ensuring a valid state upon default construction.201-201: The
nCells_
member is not default-initialized, but this is mitigated by the fact that the constructors ofNdArrayView
always initialize it.src/core/data/vecfield/vecfield.hpp (4)
23-40: The changes to the
VecField
class template, including the renaming of the template parameter fromNdArrayImpl
toGrid_t
, the addition of new member declarations, and the change from deleted to defaulted copy and move constructors and assignment operators, are consistent with the PR's objective of transitioning to a grid-based system. These changes should be verified across the codebase to ensure that all instances ofVecField
and related classes are updated accordingly.66-71: The
getFieldNamesAndQuantities
method's implementation is consistent with the PR's objective and the summary. It is now using theVecFieldProperties
struct to return the properties of the field components, which aligns with the refactoring towards a more grid-centric approach.127-130: The change in the return type of the
getComponent
method toauto&
is consistent with the PR's objective of transitioning to a grid-based system and the summary. This change simplifies the method signature and is in line with modern C++ practices.144-147: The change in the return type of the
getComponent
method toauto const&
for the const version of the method is consistent with the PR's objective and the summary. This change simplifies the method signature and is in line with modern C++ practices.src/core/models/hybrid_state.hpp (1)
- 75-83: The changes to
getCompileTimeResourcesUserList
to include theJ
variable in the returned tuple are consistent with the PR's objective of transitioning to a grid-based system. Ensure that all dependent code that uses this function is updated to handle the additional tuple element.src/core/numerics/faraday/faraday.hpp (1)
- 50-60: The new
operator()
method does not appear to be related to the PR's objective of transitioning from aField
-based representation to aGrid
-based system. If this method is part of the refactoring, ensure that it aligns with the new grid-based architecture and that any necessary updates are made to use grid types instead of field types.src/core/utilities/types.hpp (3)
72-76: The addition of the
Tuple
alias within thetype_list
struct is a straightforward enhancement that allows for easier use ofstd::tuple
with the types provided totype_list
.330-346: The change to make
all
,any
, andnone
functionsconstexpr
is a good improvement, enabling compile-time evaluation where possible.360-462: The introduction of the
Apply
struct and related functions for compile-time iteration is a sophisticated addition that can enhance the metaprogramming capabilities of the codebase.src/diagnostic/detail/types/fluid.hpp (1)
- 192-197: The change from
&(*field.begin())
tofield.data()
in thewriteDS
lambda function simplifies the way the address of the data buffer is obtained and is consistent with standard C++ behavior for contiguous storage. This change should be verified to ensure that it does not alter the expected behavior of the program, especially if thefield
object'sdata()
method has been overridden or behaves differently from the standard library containers.src/phare_core.hpp (7)
5-5: The inclusion of "core/data/grid/grid.hpp" is consistent with the PR's objective of refactoring to a grid-based system.
38-46: The introduction of
Grid_t
andArrayView_t
types and their usage inVecField_t
andField_t
is consistent with the PR's objective of transitioning to a grid-based system.35-46: No code removals or replacements are observed in this hunk, which is consistent with the summary provided.
44-44: The
Electromag_t
type alias has been updated to use the newVecField_t
which now uses theGrid_t
type, reflecting the changes in the underlying data structure for electromagnetic fields.45-46: The
YeeLayout_t
andGridLayout_t
type aliases remain unchanged, indicating that the grid layout implementation details are not affected by the transition to the new grid system.50-55: The introduction of
ParticleArray_t
andParticleSoA_t
type aliases is consistent with the PR's objective of refactoring to accommodate the new grid structures.55-55: The
IonPopulation_t
type alias has been updated to useVecField_t
andGridLayout_t
, which have been updated to use the new grid types, reflecting the changes in the underlying data structure for ion populations.src/simulator/phare_types.hpp (1)
- 19-24: The addition of the
Grid_t
type alias aligns with the PR's objective of refactoring the codebase to a grid-based system. Ensure that the introduction of this alias is reflected in all relevant parts of the codebase whereGrid_t
should be used.tests/amr/data/field/coarsening/test_linear_coarsen.hpp (4)
5-11: The inclusion of new headers and the removal of old ones is consistent with the transition from
Field
toGrid
as mentioned in the PR objectives and summaries. Ensure that the removed headers are no longer needed and that the new headers are correctly providing the necessary functionality.55-61: The change from
Field
toGrid
in theEMData
struct's type definition is consistent with the PR's objective to transition to a grid-based system. Ensure that all usages ofEMData
and itsField_t
type are updated accordingly.91-97: The change from
Field
toGrid
in theFieldCoarsenTestData
struct's type definition is consistent with the PR's objective. Ensure that all usages ofFieldCoarsenTestData
and itsField_t
type are updated accordingly.55-61: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [55-97]
Given the user's preference for minimal and efficient code, it's important to ensure that the changes made here do not introduce unnecessary complexity or redundancy. The changes appear to be straightforward type updates, but it's worth double-checking that these updates have not led to any redundant code or missed opportunities for further optimization.
tests/amr/data/field/copy_pack/field_data_test_param.hpp (2)
15-25: The changes align with the PR's objective of transitioning to a grid-based system, as indicated by the inclusion of the grid header and the update to the type alias.
281-284: The type aliases are updated to reflect the transition to the grid-based system, which is consistent with the PR's objective and the summary.
tests/amr/data/field/geometry/test_field_geometry.cpp (2)
11-15: The inclusion of "core/data/grid/grid.hpp" and related grid headers is consistent with the PR's objective to refactor the codebase to use a grid-based system.
35-35: The change of the type alias "Field1D" to use the new
Grid
class is in line with the PR's objective of transitioning from aField
-based to aGrid
-based system.tests/amr/data/field/refine/test_field_refine.cpp (1)
- 78-84: The change from
Field
toGrid
in the type aliasFieldT
is consistent with the PR's objective of refactoring the codebase to use a grid-based system. Ensure that any test logic that depends on the behavior of the originalField
type is updated to work with the newGrid
type if there are differences in behavior or interface.tests/amr/data/field/refine/test_field_refinement_on_hierarchy.cpp (2)
22-23: The change from
Field
toGrid
in the type aliasFieldND
is consistent with the PR objective and the summary provided, indicating a shift to a grid-based system.53-54: The change from
Field
toGrid
in the type aliasFieldND
within the test case is consistent with the PR objective and the summary provided, indicating a shift to a grid-based system.tests/amr/data/field/refine/test_field_refinement_on_hierarchy.hpp (2)
6-10: The addition of the include statement for "core/data/grid/grid.hpp" is consistent with the PR's objective of refactoring the codebase to use a
Grid
-based system instead of aField
-based representation. This change is expected as part of the transition and should be reflected in the logic of the test suite.6-12: Please verify that the rest of the test suite has been updated to reflect the transition from
Field
toGrid
and that the newGrid
class is being utilized as intended. This may involve checking for updates to test cases, type aliases, and logic within the test suite to ensure compatibility with the new grid-based system.tests/amr/data/field/time_interpolate/test_field_data_time_interpolate.cpp (3)
13-18: The changes in the includes reflect the transition from
Field
toGrid
as outlined in the PR objectives and summary. This is consistent with the broader refactoring effort across the codebase.48-54: The update of the type alias
FieldND
to useGrid
instead ofField
is consistent with the PR's objective of refactoring the codebase to use a grid-based system.12-18: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [12-54]
Overall, the changes in the test file are consistent with the PR's objective of transitioning to a grid-based system, and no further issues are observed within the provided context.
tests/amr/data/field/variable/test_field_variable.cpp (3)
8-15: The changes in the includes and the template alias
FieldVar
are consistent with the PR's objective of refactoring the codebase to use aGrid
-based system instead ofField
.51-53: The update of the template alias
FieldVar
to useGrid
instead ofField
is a key change that aligns with the PR's objective of refactoring the codebase to use aGrid
-based system.50-53: The tests have been updated to use the new
FieldVar
template alias, which now usesGrid
. This ensures that the tests are consistent with the changes made to the codebase.tests/amr/models/test_models.cpp (1)
- 29-49: The changes in the type aliases and class instantiations are consistent with the transition to a
Grid
-based system as outlined in the PR summary. The newGrid1D
,VecField1D
,GridImplYee1D
,ParticleArray1D
,GridYee1D
, and related types are correctly defined and used, which aligns with the objective of refactoring the codebase to use a grid-based representation. This should improve the structure and organization of the code.tests/amr/resources_manager/test_resources_manager.cpp (3)
5-11: The inclusion of "core/data/grid/grid.hpp" is consistent with the PR's objective of refactoring to a Grid-based system.
32-48: The changes in type aliases are consistent with the PR's objective of transitioning to a Grid-based system and do not introduce unnecessary complexity, aligning with the user's preference for minimal and efficient code.
50-51: The updates to
createInitDict
usingInitFunctionT
are consistent with the PR's objective of refactoring and ensure type safety in the initialization dictionary.tests/amr/resources_manager/test_resources_manager_basic_hierarchy.hpp (3)
31-39: Initialization of member variables in the constructor appears correct and aligns with the PR objectives.
54-55: Hard-coded grid size in
init
method. Ensure this is intentional and aligns with the test's design.60-64: Usage of a static variable
counterId
to generate unique IDs for patch levels appears to be a deliberate design choice.tests/amr/tagging/test_tagging.cpp (2)
164-164: The change from
Field
toGrid_t
aligns with the PR's objective of transitioning from aField
-based representation to aGrid
-based system.161-167: Given the significant refactoring from
Field
toGrid_t
, it's important to ensure that the associated tests are updated and that new tests are added to cover the new functionality and data structures.tests/core/data/electrons/test_electrons.cpp (7)
5-5: The addition of
#include "core/data/grid/grid.hpp"
aligns with the PR's objective of transitioning to aGrid
-based system.20-20: The addition of
#include <string_view>
is likely related to the use ofstd::string_view
in the code, which is a more efficient way to handle strings when copies are not needed.127-136: The changes in the
ElectronsTest
struct, including the addition ofdensityName
and updates to type definitions forGridND
andVecFieldND
, are consistent with the PR's objective of refactoring to a grid-based system.146-160: The addition of
GridND
variables and template member functions_ions
and_J
in theElectronsTest
struct is in line with the PR's objective of enhancing the grid-based functionalities.142-204: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [192-219]
The constructor of
ElectronsTest
has been updated to initialize the newGridND
andVecFieldND
variables, which is consistent with the PR's objective of refactoring to a grid-based system.
235-238: The
fill
lambda functions have been updated to initialize the fields for different dimensions, which is necessary due to the changes in the data structures and types.599-601: The
main
function is standard for a test suite and has no issues.tests/core/data/field/test_field.hpp (2)
4-14: The addition of
#include "core/data/ndarray/ndarray_vector.hpp"
and the changes to the template parameters are consistent with the overall refactoring effort described in the PR summary. Ensure that the new dependency does not introduce any circular dependencies and that all affected code has been updated to reflect the new template parameters.173-193: The addition of new template functions for testing different field types is consistent with the refactoring effort and the transition from
Field
toGrid
. Ensure that these new functions are covered by unit tests to verify their correctness and that they do not introduce any unintended side effects.tests/core/data/grid/test_grid.cpp (6)
5-8: The inclusion of "core/data/grid/grid.hpp" aligns with the PR's objective of transitioning to a Grid-based system.
13-53: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [15-59]
The renaming of test classes and the use of
Grid
class in place ofField
is consistent with the PR's objective and the summary provided.
135-168: The tests for the
Grid
class are consistent with the changes made in the previous hunks.192-204: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [173-201]
The tests for the
Grid
class are consistent with the changes made in the previous hunks.
242-251: The test for the
average
function is consistent with the PR's objective of adding new functionalities to theGrid
class.272-281: The tests for the
average
function for 2D and 3D grids are consistent with the PR's objective of adding new functionalities to theGrid
class.tests/core/data/gridlayout/gridlayout_base_params.hpp (5)
24-24: The summary indicates that
std::shared_ptr<GridLayout<GridLayoutImpl>> layout;
should have been replaced withstd::shared_ptr<Grid_t> layout;
, but the code still shows the originallayout
declaration. Please verify if this is an oversight in the summary or if the code change was missed.32-32: The change from
Field
toGrid
for thefield
member is consistent with the PR objectives and the summary.35-39: The update to the
makeIt_
function to useGrid_t
is consistent with the PR objectives and the summary.41-41: The
makeMyField_
function indirectly reflects the transition toGrid
by utilizing the updatedmakeIt_
function.17-41: The refactoring of the
GridLayoutTestParam
struct to use theGrid
class template aligns with the user's preference for minimal and efficient code.tests/core/data/gridlayout/gridlayout_deriv.hpp (4)
5-8: The changes in the header files are consistent with the PR objectives and the summary provided, indicating a shift from
Field
toGrid
in the codebase.27-31: The replacement of
Field
withGrid
for theBy
andEz
variables in thea1DDerivative
class is consistent with the PR objectives and the summary provided.47-51: The replacement of
Field
withGrid
for theBy
andEz
variables in thea2DDerivative
class is consistent with the PR objectives and the summary provided.67-71: The replacement of
Field
withGrid
for theBy
andEz
variables in thea3DDerivative
class is consistent with the PR objectives and the summary provided.tests/core/data/gridlayout/gridlayout_laplacian.hpp (4)
2-8: The changes in the import statements align with the PR objectives and the generated summaries, indicating a shift from
Field
toGrid
based system.25-30: The variable type changes from
Field
toGrid
forJx
,Jy
, andJz
in the 1D case are consistent with the PR objectives and the generated summaries.47-52: The variable type changes from
Field
toGrid
forJx
,Jy
, andJz
in the 2D case are consistent with the PR objectives and the generated summaries.69-74: The variable type changes from
Field
toGrid
forJx
,Jy
, andJz
in the 3D case are consistent with the PR objectives and the generated summaries.tests/core/data/ion_population/test_ion_population.cpp (1)
- 24-30: The addition of
grid_type
within theDummyVecField
struct aligns with the broader refactoring effort fromField
toGrid
and is consistent with the PR objectives. The change is localized to this test file and does not appear to affect external modules.tests/core/data/ions/test_ions.cpp (5)
9-15: The addition of the include statement for "core/data/grid/grid.hpp" aligns with the PR's objective of transitioning to a Grid-based system.
37-38: The modification of the type alias
VecField1D
to useGrid1D
is consistent with the PR's objective of refactoring to a Grid-based system.37-37: The introduction of the type alias
Grid1D
is consistent with the PR's objective of refactoring to a Grid-based system.38-38: The update of the type
VecField1D
to useGrid1D
is consistent with the PR's objective of refactoring to a Grid-based system.41-41: The type
IonPopulation1D
correctly usesVecField1D
as indicated in the PR summary. The summary contains an error in stating thatIonPopulation1D
was changed to useGridYee1D
instead ofVecField1D
.tests/core/data/vecfield/test_main.cpp (6)
6-9: The inclusion of both
grid.hpp
andfield.hpp
headers suggests thatField
related code might still be present in the file or the codebase. Since the PR objective is to transition fromField
toGrid
, verify that the inclusion offield.hpp
is still necessary.27-30: The
VecFieldGeneric
class correctly uses theGrid
class template, aligning with the PR objective to transition fromField
toGrid
.38-39: The introduction of the
VecField_t
template alias is consistent with the PR objective and the summary provided. It replaces theVecField
instances with aGrid
-based type.92-109: The
VecFieldTest
class correctly uses theVecField_t
template alias andGrid
withNdArrayVector
, which is consistent with the PR objective to transition fromField
toGrid
.303-312: The test case
TEST(aVecField, dataCanBeCopiedIntoAnother)
correctly usesVecField_t
andGrid
withNdArrayVector
, which is consistent with the PR objective to transition fromField
toGrid
.318-324: The test case
TEST(aVecField, dataCanBeCopiedIntoAnother)
also correctly usesVecField_t
andGrid
withNdArrayVector
for the second set of grids, aligning with the PR objective to transition fromField
toGrid
.tests/core/numerics/ampere/test_main.cpp (7)
5-11: The inclusion of both
grid.hpp
andfield.hpp
suggests thatField
types may still be in use, which could be inconsistent with the PR's objective to transition fully toGrid
. Verify ifField
types are still needed or if their inclusion is a leftover from before the refactoring.35-40: The refactoring of
GridLayoutMock
structs is not mentioned in the summary. If these changes are significant, the summary should be updated to reflect them.71-72: The introduction of the
Grid_t
alias and its usage in the test classes is consistent with the PR's objective to transition to aGrid
-based system.125-143: The update of the
Ampere
test classes to useGrid_t
andVecField<Grid_t>
is consistent with the PR's objective to transition to aGrid
-based system.167-185: The update of the
Ampere
tests for 2D cases to reflect the newGrid
system is consistent with the PR's objective to transition to aGrid
-based system.209-228: The update of the
Ampere
tests for 3D cases to reflect the newGrid
system is consistent with the PR's objective to transition to aGrid
-based system.5-11: The summary of generated summaries mentions the removal of the pre-increment operator method from the
box_iterator
class in theBox
class. Verify this change in the relevant files.tests/core/numerics/faraday/test_main.cpp (5)
5-11: The inclusion of grid-related headers aligns with the PR objective of transitioning to a
Grid
-based system.29-55: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [29-68]
The
GridLayoutMock
structs still useFieldMock
instead of the newGrid
-based system. Verify ifFieldMock
needs to be updated to align with the newGrid
system.
- 136-160: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [136-270]
The test classes have been updated to use
Grid_t
, which is consistent with the PR objective of transitioning to aGrid
-based system.
- 246-271: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [70-322]
The test cases appear to be correctly testing the
Faraday
functionality with the newGrid
system.
- 5-11: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [322-328]
The main function for running the tests is correctly set up.
using patch_data_type = FieldData<GridLayoutT, typename ResourcesUser::field_type>; | ||
using variable_type = FieldVariable<GridLayoutT, typename ResourcesUser::field_type>; | ||
using patch_data_type = FieldData<GridLayoutT, typename ResourcesUser::grid_type>; | ||
using variable_type = FieldVariable<GridLayoutT, typename ResourcesUser::grid_type>; | ||
using internal_type_ptr = typename ResourcesUser::field_type*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internal_type_ptr
type alias still references typename ResourcesUser::field_type
. If the transition from Field
to Grid
is complete, this might be an oversight and should be updated to use grid_type
instead.
- using internal_type_ptr = typename ResourcesUser::field_type*;
+ using internal_type_ptr = typename ResourcesUser::grid_type*;
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
using internal_type_ptr = typename ResourcesUser::field_type*; | |
using internal_type_ptr = typename ResourcesUser::grid_type*; |
std::transform(std::begin(f1), std::end(f1), std::begin(f2), std::begin(avg), | ||
std::plus<double>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The average
function uses std::plus<double>()
, which assumes the Field
's value type is double
. If Field
can have other value types, this could lead to incorrect behavior. Consider using the value_type
of Field
instead.
auto dim | ||
= static_cast<unsigned short int>(inputDatabase->getDatabase("Main")->getInteger("dim")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant retrieval of dimension
from inputDatabase
in the init
method, as it is already stored in the dimension
member variable.
- auto dim = static_cast<unsigned short int>(inputDatabase->getDatabase("Main")->getInteger("dim"));
+ auto dim = dimension;
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
auto dim | |
= static_cast<unsigned short int>(inputDatabase->getDatabase("Main")->getInteger("dim")); | |
auto dim = dimension; |
increment(dim - 1); | ||
return *this; | ||
} | ||
box_iterator& operator++() const | ||
{ | ||
increment(dim - 1); | ||
return *this; | ||
} | ||
|
||
|
||
bool operator!=(box_iterator const& other) const | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pre-increment operator method box_iterator& operator++()
is no longer marked as const
. This change may affect how the iterator is used with const instances of Box
. Please verify that this change is intentional and does not negatively impact the usage of box_iterator
in contexts where const correctness is expected.
NO_DISCARD ParticleArray const& levelGhostParticlesOld() const | ||
{ | ||
return const_cast<IonPopulation*>(this)->levelGhostParticlesOld(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of const_cast
in the const
overloads of levelGhostParticlesOld
, levelGhostParticlesNew
, and density
is a common pattern to avoid code duplication. However, it's important to ensure that the non-const
versions of these functions do not perform any non-const operations on the object to maintain const-correctness.
Also applies to: 173-175, 193-195
auto gsi_X = this->layout.ghostStartIndex(field, Direction::X); | ||
auto gei_X = this->layout.ghostEndIndex(field, Direction::X); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same copy-paste error is present in the 3D fill
lambda function where Viy
and Jy
are filled twice, and Viz
and Jz
are not filled at all. This should be corrected to ensure that all components are initialized properly.
- fill(Viy, [](double x, double y, double z) {
- return std::cosh(0.4 * x) * std::cosh(0.4 * y) * std::cosh(0.4 * z);
- });
- fill(Jy, [](double x, double y, double z) {
- return std::sinh(0.4 * x) * std::sinh(0.4 * y) * std::sinh(0.4 * z);
- });
+ fill(Viz, [](double x, double y, double z) {
+ return std::cosh(0.4 * x) * std::cosh(0.4 * y) * std::cosh(0.4 * z);
+ });
+ fill(Jz, [](double x, double y, double z) {
+ return std::sinh(0.4 * x) * std::sinh(0.4 * y) * std::sinh(0.4 * z);
+ });
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
auto gsi_X = this->layout.ghostStartIndex(field, Direction::X); | |
auto gei_X = this->layout.ghostEndIndex(field, Direction::X); | |
auto gsi_X = this->layout.ghostStartIndex(field, Direction::X); | |
auto gei_X = this->layout.ghostEndIndex(field, Direction::X); |
@@ -42,7 +42,7 @@ void DefaultHybridTaggerStrategy<HybridModel>::tag(HybridModel& model, | |||
|
|||
// SAMRAI tags int* buffer is FORTRAN ordering so we set false to the view | |||
bool constexpr c_ordering = false; | |||
auto tagsv = core::NdArrayView<dimension, int, int*, c_ordering>(tags, layout.nbrCells()); | |||
auto tagsv = core::NdArrayView<dimension, int, c_ordering>(tags, layout.nbrCells()); | |||
|
|||
if constexpr (dimension == 1 and false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if constexpr
block with the condition dimension == 1 and false
will never execute and appears to be dead code. Consider removing it to clean up the codebase, especially given the preference for minimal and efficient code.
- if constexpr (dimension == 1 and false)
- {
- }
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
if constexpr (dimension == 1 and false) |
operator bool() const | ||
{ | ||
using Tuple = decltype((*this)()); | ||
auto constexpr tuple_size = std::tuple_size_v<Tuple>; | ||
Tuple tup = (*this)(); | ||
|
||
return core::for_N_all<tuple_size>([&](auto i) { | ||
auto const& [k, v] = std::get<i>(tup); | ||
auto isUsable = v->isUsable(); | ||
if (!isUsable) | ||
{ | ||
PHARE_LOG_LINE_STR("NOT USABLE: " << k); | ||
} | ||
return isUsable; | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conversion operator to bool
in PatchState_t
performs a complex check which could be a performance concern if used frequently. Consider optimizing this if it's a common operation.
auto& operator*() | ||
{ | ||
assert(view.states[idx] == true); | ||
return view.states[idx]; | ||
} | ||
auto& operator*() const | ||
{ | ||
assert(view.states[idx] == true); | ||
return view.states[idx]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assert statement in the iterator's dereference operator is good for debug builds but might be unnecessary overhead in release builds. Consider using a debug-only assert or providing a way to disable it in release builds.
return *this; | ||
} | ||
|
||
bool operator!=(iterator const& that) const { return &view != &that.view or idx != that.idx; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The not-equal operator in the iterator class template should only compare the index if the views are the same, not the pointers to the views.
- bool operator!=(iterator const& that) const { return &view != &that.view or idx != that.idx; }
+ bool operator!=(iterator const& that) const { return &view == &that.view && idx != that.idx; }
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
bool operator!=(iterator const& that) const { return &view != &that.view or idx != that.idx; } | |
bool operator!=(iterator const& that) const { return &view == &that.view && idx != that.idx; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: .coderabbit.yaml
Files selected for processing (1)
- src/amr/solvers/solver_ppc.hpp (6 hunks)
Additional comments: 8
src/amr/solvers/solver_ppc.hpp (8)
11-17: The addition of
solver_ppc_model_view.hpp
aligns with the summary's mention of new include directives and the introduction of model views.56-56: Verify the usage of the new member variable
faraday_1
within the class to ensure it's correctly integrated and utilized.214-215: Ensure that the keys used in
restoreState_
always exist intmpDomain
andpatchGhost
to prevent potential exceptions when keys are not found.227-251: The changes in
advanceLevel
seem to follow a logical sequence of operations for advancing the simulation level. Ensure that the order of operations is correct and aligns with the intended simulation behavior.257-297: The changes in
predictor1_
,predictor2_
, andcorrector_
functions should be verified for correctness, ensuring they align with the intended simulation behavior and the newGrid
class integration.401-429: Verify the usage and invocation of the
_debug_log_move_ions
debug function to ensure it's correctly integrated and can be controlled or disabled as needed.433-463: The changes in
moveIons_
should be verified for correctness, ensuring that ion updates and ghost particle management align with the intended simulation behavior and the newGrid
class integration.219-472: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [1-472]
The provided hunks do not show the shift from
Field
toGrid
as mentioned in the summary. Ensure that the changes in theSolverPPC
class are consistent with the broader refactor across the codebase.
{ | ||
for (auto& patch : level) | ||
for (auto& state : view) | ||
{ | ||
std::stringstream ss; | ||
ss << patch->getGlobalId(); | ||
|
||
auto _ = rm.setOnPatch(*patch, ions); | ||
for (auto& pop : ions) | ||
ss << state.patch->getGlobalId(); | ||
for (auto& pop : state.ions) | ||
{ | ||
auto key = ss.str() + "_" + pop.name(); | ||
if (!tmpDomain.count(key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of stringstream
for string concatenation in saveState_
could be inefficient, especially in a multi-threaded context. Consider using a more efficient string concatenation method if performance is a concern.
closing this while I finish it just to not trigger any builds on commit |
for #778
Summary by CodeRabbit
Refactor
Field
toGrid
across various components, enhancing the data structure and processing efficiency.Bug Fixes
New Features
Grid
class with advanced capabilities and integrated it into the system.Documentation
Field
toGrid
.Tests
Grid
functionality and ensure compatibility.