[petsc-users] MATLAB viewer

Sun, Hui hus003 at ucsd.edu
Sun Jul 27 18:38:10 CDT 2014


Thank you Barry and Patrick. 

________________________________________
From: Barry Smith [bsmith at mcs.anl.gov]
Sent: Sunday, July 27, 2014 10:51 AM
To: Patrick Sanan
Cc: Sun, Hui; petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] MATLAB viewer

On Jul 27, 2014, at 6:19 AM, Patrick Sanan <patrick.sanan at gmail.com> wrote:

> A simple way to proceed is to use http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerBinaryOpen.html
>
> On Jul 27, 2014, at 10:18 AM, Sun, Hui <hus003 at ucsd.edu> wrote:
>
>> I try to create some binary output for MATLAB with the following code.
>>
>> PetscViewer viewer = PETSC_VIEWER_BINARY(PETSC_COMM_WORLD);

   or you are missing the _ at the end of PETSC_VIEWER_BINARY_


>> MatView(A,viewer);
>> VecView(v,viewer);
>> PetscViewerDestroy(&viewer);
>>
>> However it gives me an error, which is the following:
>>
>> interface_fs.c:215:26: warning: implicit declaration of function 'PETSC_VIEWER_MATLAB' is invalid in C99 [-Wimplicit-function-declaration]
>>    PetscViewer viewer = PETSC_VIEWER_MATLAB(PETSC_COMM_WORLD);
>>                         ^
>> interface_fs.c:215:17: warning: incompatible integer to pointer conversion initializing 'PetscViewer' (aka 'struct _p_PetscViewer *') with an expression of type 'int'
>>      [-Wint-conversion]
>>    PetscViewer viewer = PETSC_VIEWER_MATLAB(PETSC_COMM_WORLD);
>>
>>
>> I'm wondering what is the correct way to do this? Thank you!
>



More information about the petsc-users mailing list