Fix unintended sweep copying introduced in !486
In !486 (merged), program execution is aborted when multiple sweeps (with the same selectors) are added to a
SweepTimeloop at once.
However, if the execution continued, instead of using a pointer to the sweep's object (as done before !486 (merged)), a reference is used. With this reference, an internal copy is created such that the sweep's object is copied in every time step. This issue was introduced mainly by convenience, as
SelectableObject provides a function that returns the number of matching selectors and a reference to the matching object.
With this MR, !486 (merged) is partially reverted such that a pointer to a sweep's object is used again.
getNumberOfMatching(selector) is implemented that returns the number of objects matching the
Additionally, two tests are included to check if:
- adding multiple sweeps with the same selectors aborts the program (as expected and resolved by !486 (merged))
- adding multiple sweeps with different selectors works