[petsc-users] questions about DMDAGetNeighbors()

Matthew Knepley knepley at gmail.com
Tue Aug 13 10:35:35 CDT 2013


On Tue, Aug 13, 2013 at 10:31 AM, Roc Wang <pengxwang at hotmail.com> wrote:

> Hi,
>
>     I am confused about calling
>
> PetscErrorCode  DMDAGetNeighbors(DM da,const PetscMPIInt *ranks[]),
>
> I am calling the function like this:
>
> PetscMPIInt ** neighbors;
> DMDAGetNeighbors(da, neighbors);
>
> but the error shows
>
> src/solver.cpp:152: error: invalid conversion from ‘PetscMPIInt**’ to ‘const PetscMPIInt**’
> src/solver.cpp:152: error:   initializing argument 2 of ‘PetscErrorCode DMDAGetNeighbors(_p_DM*, const PetscMPIInt**)’
>
> How should I define the neighbors before calling the function? Sorry it's not a pure Petsc question, but I am new in c++. Thanks for any comments.
>
>
const PetscMPIInt *neighbors;

DMDAGetNeighbors(dm, &neighbors);

   Matt

-- 
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/20130813/2a035bc9/attachment.html>


More information about the petsc-users mailing list