Simple question. I have a few vectors which hold the states of a list of particles. I update these with broadcast (which is nice since the vectors are on the GPU). For example:
position⁰ .= position
position .+= integrate.(position⁰, ...)
I need to check the states and potentially reset them, but I don’t know how to reset them all at the same time. I can do this
position .= enforce_bounds(position,...)
But now I need to set position⁰ = position only for the positions that were reset. Is there something like:
that will let me conditionally reset them both at once?
In this example, I could do the check in the other order, but in my code there are a bunch of other states and conditions so I’m looking for a general way to do this.
True, I could make one struct with all the states and then use a vector of those. I think I would loose the easy broadcast update of each state like I have in the example, but I could refactor.