You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If have the feeling, if we implemented #370 guards via mf.grow() / mf.with_guard_cells() then we would also have a clear answer for the guard/non-guard question here.
mf=MultiFab() # from somewheremf*=2.# on valid cellsmf.with_guard_cells()
mf*=2.0# on valid and guard cells
We are looking to in-place update the value of each cell, in each component, including guard cells.
For that, we would implement:
__iadd__(self, v)
__isub__(self, v)
__imul__(self, v)
__itruediv__(self, v)
__ifloordiv__(self, v) (for //=)
__imod__(self, v) (for %)
__ipow__(self, v)
Example:
.def("__iadd__",
[](MultiFab & self, amrex::Real v) { /* ... */ },
py::is_operator(),
"Adds in-place to the value of each cell, in each component, including guard cells."
)
We need to implement scalar and other multifabs for v.
For pyAMReX'
MultiFab
, we can overload the operators+=
*=
/=
, etc. to call the underlying optimized, element-wise AMReX functions.Similar for
[...]
and other set-all ellipsis, we should specialize to AMReX'setVal
.@RemiLehe @roelof-groenewald @dpgrote @atmyers et al.: should we always operate on valid and guard cells for those?
The text was updated successfully, but these errors were encountered: