[petsc-users] VecGetArrayF90 vs. VecGetArrayReadF90

Barry Smith bsmith at petsc.dev
Mon May 13 21:33:16 CDT 2024


  It errors in C because the argument is labeled with const, but there does not seem to be a way in Fortran to indicate an array is read only.



> On May 13, 2024, at 10:21 PM, Runjian Wu <wurunjian at gmail.com> wrote:
> 
> I only know the "intent(in)" attribute for the dummy arguments. 
> 
> In the counter function VecGetArrayRead(..), if I write values, will the compiler report an error? 
> 
> Runjian
> 
> On Mon, May 13, 2024 at 9:36 PM Barry Smith <bsmith at petsc.dev <mailto:bsmith at petsc.dev>> wrote:
>> 
>>    I couldn't find a way in Fortran to declare an array as read-only. Is there such support?
>> 
>>    Barry
>> 
>> 
>>> On May 13, 2024, at 7:28 AM, Runjian Wu <wurunjian at gmail.com <mailto:wurunjian at gmail.com>> wrote:
>>> 
>>> This Message Is From an External Sender
>>> This message came from outside your organization.
>>> Hi all,
>>> 
>>> I have a question about VecGetArrayReadF90(...).  If I use VecGetArrayReadF90(...), I can still write entries into the array like VecGetArrayF90(...).  Is it possible to report an error during compile process?
>>> 
>>> Thanks,
>>> 
>>> Runjian Wu
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240513/1a7eeeeb/attachment-0001.html>


More information about the petsc-users mailing list