Open damienmarchal opened 8 years ago
From what I know, it is supposed to tell if the indices included in the BoxROI must be updated at each time step or not. So it's not the expected behavior.
I believe it's a hack that is probably no longer required. It was forcing an update at each step, probably from an ancien time when this code was not an Engine or when Engines were not implemented correctly. Now the Engine is automatically updated when someone read its output and any input changed so that this flag should no longer make any difference.
So I deprecate it :)
Would it not make sense to keep a boolean allowing not to recompute the selection within the ROI at each time steps ? For efficiency purposes
I agree with Hugo this make sense to be able to control if the update happens or not.
So I finally fixed the doUpdate behavior. If you want to have a look at this happens in commit: https://github.com/sofa-framework/sofa/commit/111e21cc23a76c7d3c0844ce7b64aa81e381d614
I don't agree, the correct way to have BoxROI not update itself, like any other engine, is to link it to inputs that are not changing, i.e. rest_position instead of position. Otherwise this will break updates after topological changes for instance...
Thanks for the feedbacks,
This seems related to the fact that Engines are designed to be data flow oriented and, keeping that in mind, we shouldn't break the general design of engines.
But, it also appears that in several scenarios, ROIs are used to select features, eg 'position', but not necessarily at initialization time and not necessarily at rest_position and that there may not have an associated 'not changing' data field. My impression is that being able to pick a set of features from data field in a quick way, at controlled instant, is as desirable as not breaking the Engine logics.
What do you think about refactoring that and separate the two behaviors in different components. BoxROISelector and BoxROIEngine ?
DM.
It's something that is too general to make it specific to BoxROI. What about SphereROI, EllipsoidROI, ... ? There are several ways to handle this use case (using an Engine to compute something once or only at specific triggers):
In our codes we use the third option, we added a trivial component that we call ValueStore
, which has a Data value
inside with the ability to copy the value (and implicitly request the update of an Engine linked to it) to another Data manually (but as efficiently as a Link) at specific times (currently after each time step, but it could be customised).
Ok, I am no expert in design and I did not understand this data flow meaning of Engines. Well, third option is ok, and the first one is yet basic but more efficient. Thank you for the discussion.
@hugtalbot as you asked: https://en.wikipedia.org/wiki/Dataflow_programming :)
Whatever I set doUpdate to true or false the BoxROI object seems to update the selected triangles so I wonder what is supposed to be the behavior of this data field ?