[petsc-users] A question of DMPlexGetAdjacency

leejearl leejearl at 126.com
Mon Nov 14 18:51:33 CST 2016


Hi, Lawrence:
     Thank you for your kind reply. I have modified by codes following 
your advices.
Now, it works well.
     Many thanks for your helps.
leejearl

On 2016年11月14日 23:09, Lawrence Mitchell wrote:
>> On 14 Nov 2016, at 14:59, leejearl <leejearl at 126.com> wrote:
>>
>> Hi all:
>>
>>     I am not sure the using of the function "DMPlexGetAdjacency".
>>
>>     My codes are as follows:
>>
>>     PetscInt adj, *adjSize=NULL;
>>
>>     ierr = DMPlexGetAdjacency(dm, p,  &adj, &adj);
>
> Your calling sequence is wrong:
>
> PetscInt adjSize;
> PetscInt *adj = NULL;
>
> ierr = DMPlexGetAdjacency(dm, p, &adjSize, &adj); CHKERRQ(ierr);
>
> adjSize is now the size of the adj array.  You should remember to free it afterwards:
>
> /* use adj here *
> ...
>
> ierr = PetscFree(adj); CHKERRQ(ierr);
>
> Lawrence




More information about the petsc-users mailing list