PetscFOpen with mode "a+"

Matthew Knepley knepley at gmail.com
Wed Dec 31 16:38:45 CST 2008


On Wed, Dec 31, 2008 at 2:30 PM, (Rebecca) Xuefei YUAN
<xy2102 at columbia.edu>wrote:

>
> I tried PetscViewerFileSetMode and use the "FILE_MODE_APPEND", but it seems
> that the file has been overwritten,too.
>
> I was not able to find any examples in tutorials, is there one using it?


Here is an example that appends to a file. It works for me.

   Matt


>
> Thanks a lot!
>
>
>
> Quoting Matthew Knepley <knepley at gmail.com>:
>
>  You use a ViewerCreate() and then
>>
>>
>> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Viewer/PetscViewerFileSetMode.html
>>
>> to set append, and then FileSetName() to open the file.
>>
>>  Matt
>>
>> On Wed, Dec 31, 2008 at 10:24 AM, (Rebecca) Xuefei YUAN <
>> xy2102 at columbia.edu
>>
>>> wrote:
>>>
>>
>>  Hi,All,
>>>
>>> I tried to use PetscFOpen to write the numerical result to a file, and I
>>> would like to use the mode "a+" to add my result to the existing content
>>> in
>>> my file. However, whenever the new result comes out, it will overwrite
>>> the
>>> existing content in the file. Is there any problem here?
>>>
>>> Thanks a lot!
>>>
>>> Rebecca
>>>
>>>
>>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments
>> is infinitely more interesting than any results to which their experiments
>> lead.
>> -- Norbert Wiener
>>
>>
>
>
> --
> (Rebecca) Xuefei YUAN
> Department of Applied Physics and Applied Mathematics
> Columbia University
> Tel:917-399-8032
> www.columbia.edu/~xy2102 <http://www.columbia.edu/%7Exy2102>
>
>


-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20081231/2ea87907/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex1.c
Type: text/x-csrc
Size: 828 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20081231/2ea87907/attachment.c>


More information about the petsc-users mailing list