There is also VecGetLocalVector() and VecRestoreLocalVector() . You
should be able to use those to (copy-free, hopefully) obtain the local
entries of a global vector as a local vector which you could call the
usual VecNorm() on.


On Fri, Jul 29, 2016 at 4:41 PM, Barry Smith <[email protected]> wrote:
>
>> On Jul 27, 2016, at 4:42 PM, Xiangdong <[email protected]> wrote:
>>
>> Hello everyone,
>>
>> I have a global dmda vector vg. On each processor, if I want to know the 
>> norm of local portion of vg, which function should I call?
>>
>> So far I am thinking of using DMDAVecGetArray and then write a loop to 
>> compute the norm of this local array.
>>
>> Is there a simple function available to call? like 
>> *vg->ops->norm_local(vg,NORM_2, &normlocal)?
>
> There isn't a public interface to this call because it really isn't a 
> mathematically well defined object; the subdomains in the decomposition of 
> the array are arbitrary based on the number of processes used.
>
>    Anyways if you want it and it is the NON-overlapping portion then yes, you 
> can write a little routine (basically just cut and paste VecNorm()) call it 
> say VecNormLocal() and have it call the function pointer you indicated above. 
> Note for the 2 norm the norm_local() returns the square of the norm so you 
> need to take the square root.
>
>    If you want the overlapping portion of the vector then you should just do 
> the DMDAVecGetArray() as you already do.
>
>    Barry
>
>
>
>>
>> Thanks.
>>
>> Best,
>> Xiangdong
>>
>

Reply via email to