On Nov 23, 2010, at 8:07 AM, Jed Brown wrote:
> On Tue, Nov 23, 2010 at 04:57, Barry Smith <bsmith at mcs.anl.gov> wrote:
> I think if we removed ALL the increase state from the outer methods (like
> VecScale) we could remove the VecGetArrayPrivate() and always use
> VecGetArray() or write ones and VecGetArrayRead() for read ones inside the
> private methods.
>
> Why is it better for VecScale_Seq to call a private VecScaleUpdateCachedNorms
You misunderstand. VecNorm() would still be calling the update cache
business,. the only difference is it would get the cached values before the
(*v->scale)(...) call and set them back into the Vec after the (*v->scale)(...)
The VecScale_Seq() would be calling the VecGetArray() and (as a result) be
the one increasing the state. But it wouldn't be messing with the cached norms.
Barry
> instead of letting the outer method handle it? Seems like either
> unnecessarily duplicated code, or an extra function, with less obvious
> semantics when you approach the code from the public interface. Having the
> inner method handle the caching logic is only clearer when you start in the
> depths of the implementation and work back towards the user.
>
> Jed