[petsc-dev] VecRestoreArrayRead and const

Barry Smith bsmith at mcs.anl.gov
Mon Jun 14 12:07:23 CDT 2010


On Jun 14, 2010, at 11:28 AM, Jed Brown wrote:

> On Mon, 14 Jun 2010 11:21:32 -0500, Barry Smith <bsmith at mcs.anl.gov> wrote:
>> 
>>   I added it quickly as a bit of a hack. Eventually it needs a lot of cleaning up.
>> 
>>   It is not actually readonly so shouldn't be listed as a const; it is not a good name. 
> 
> When would it be correct to modify the array without incrementing state?
> I must be missing something.

    Yes you are. If you look at the Vec routines line VecAXPY(), VecScale() etc they manage the update of state themselves (in order to preserve norms). Thus VecAXPY_Seq(), VecScale_Seq() etc should not be updating state. So I want a set of routines that access the arrays and allow changes but do not increase the state; but I don't want to use the pure vec->array to access the data. 

   I fear in the end we need three sets of VecGetArray() a read, a write and a private that allows writes but does not increase state. Don't have a good name for the private one. This is all made more complicated by the fact that sometimes two or three vector arguments to a routine could be the same.

   Barry

> 
>>   Can we worry about it later, not now?
> 
> Of course.
> 
> Jed




More information about the petsc-dev mailing list