-
Notifications
You must be signed in to change notification settings - Fork 22
Particle Container: Runtime Arguments #222
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
Conversation
84a3a78 to
ea955b1
Compare
| .def("assign", [](PODVector_type & pv, T const & value){ | ||
| pv.assign(pv.size(), value); | ||
| }, py::arg("value"), "assign the same value to every element") |
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.
Overloaded because vector.assign(vector.size(), 42) to set a value is a bit cumbersome.
https://github.com/AMReX-Codes/amrex/blob/47347f785f5c26f1f9e65bef8e10f2d383406ef7/Src/Base/AMReX_PODVector.H#L480-L513
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.
Could also call this set_value in symmetry with MultiFab, please let me know what you prefer @WeiqunZhang @atmyers
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.
Waiting for AMReX-Codes/amrex#3866
src/Particle/ParticleContainer.H
Outdated
|
|
||
| .def_property_readonly("num_runtime_real_comps", &ParticleContainerType::NumRuntimeRealComps) | ||
| .def_property_readonly("num_runtime_int_comps", &ParticleContainerType::NumRuntimeIntComps) | ||
| .def_property_readonly("num_real_comps", &ParticleContainerType::NumRealComps) |
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.
So once this is merged we can clean up the WarpXparticleContainer.cpp file, for example the line at https://github.com/ECP-WarpX/WarpX/blob/b3ba07df16de4e9736b01a8cc7024740714dcad6/Source/Python/Particles/WarpXParticleContainer.cpp#L88, right?
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.
Yes, def!
|
Looks like something does not deallocate PC runtime components in time. |
6c95aa1 to
b35493b
Compare
dc334e7 to
630a156
Compare
35c19c9 to
e44ff54
Compare
e44ff54 to
069fd62
Compare
069fd62 to
ef4557e
Compare
faf529e to
b534827
Compare
b534827 to
f0b4a64
Compare
## Summary When adding new `Real`/`Int` runtime components, they could be made available without additional calls. The cost should be the same as calling it explicitly later, but clarifies the usage. Alternatively, we should add API contract details to the `AddRealComp`/`AddIntComp` doc strings to make sure people use it right. ## Additional background - AMReX-Codes/pyamrex#220 - AMReX-Codes/pyamrex#222 ## Checklist The proposed changes: - [ ] fix a bug or incorrect behavior in AMReX - [x] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [ ] include documentation in the code and/or rst files, if appropriate
7f3d297 to
1e44d7b
Compare
1e44d7b to
67cd6cf
Compare
## Summary ``` vector.assign(vector.size(), 42); ``` is a bit verbose for a standard operation, even if it mirrors https://en.cppreference.com/w/cpp/container/vector/assign Add another overload similar to `setVal(ue)` used in other AMReX containers. ## Additional background AMReX-Codes/pyamrex#222 (comment) ## Checklist The proposed changes: - [ ] fix a bug or incorrect behavior in AMReX - [x] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [ ] include documentation in the code and/or rst files, if appropriate
Follow-up to #220
X-ref: AMReX-Codes/amrex#3615