Bill Hibbard wrote:
> Hi Nicolas,
> > Let's suppose I have a big 3D block and also a 1D view "associated" with,
> > for instance a vertical line passing through the block.
> > If computations modify the 1D data, is there a "simple"
> > way to propagate the changes to the 3D block (the father)?
> > What else if there are 2 views sharing the same 3D block data?
> You can use CellImpls to do this. For each 1-D view of a 3-D block,
> you'd construct a CellImpl whose doAction() method would propagate
> the change to the 3-D block, as well as to the other 1-D views.
> You'd pass a DataReference for the 1-D view to the addReference()
> method of the CellImpl. In a situation with multiple 1-D views,
> this can lead to event loops (i.e., A changes B which changes A
> which changes B ...). So when a doAction changes B, it should
> first test if the new value for B is the same as the old value
> for B, and if they are equal then don't make the change. There
> are various signatures in vsad/util/Util.java for a method
> isApproximatelyEqual() for testing approximate equality between
> floats and doubles.
To efficiently modify a small number of values in a big
3-D block in a FlatField:
float values = field.getFloats(false); // don't copy
. . . // code to modify selected locations in values array
field.setSamples(values, false); // don't copy