[petsc-dev] Segfault in DMPlexVecGetClosure

Matthew Knepley knepley at gmail.com
Tue Oct 31 12:39:04 CDT 2017


On Tue, Oct 31, 2017 at 11:36 AM, Blaise A Bourdin <bourdin at lsu.edu> wrote:

> Hi,
>
> I am losing my mind over segfaults in DMPlexVecGetClosure.
>
> In the example below, I get a segfault whenever cval is not set to NULL
> before calling DMPlexVecGetClosure. Is this expected?
>

Yes. If cval is NULL, it allocates the necessary space and passes back the
array. If it is not NULL, it uses the pointer that you passed
in (so you can allocate your own temp storage if you are smarter).


> The documentations says nothing about this
>

That is a problem.


> Also, after calling DMPlexVecRestoreClosure, the values of cval are
> discarded and neither global nor coord are changed.
>

Ah, GetClosure() is not like GetArray(), in that it is a temp copy. You
need SetClosure() in order to change values.

   Matt


> I am obviously doing something wrong but cannot figure it out...
>
> Blaise
>
>
> --
> Department of Mathematics and Center for Computation & Technology
> Louisiana State University, Baton Rouge, LA 70803, USA
> Tel. +1 (225) 578 1612 <(225)%20578-1612>, Fax  +1 (225) 578 4276
> <(225)%20578-4276> http://www.math.lsu.edu/~bourdin
>
>
>
>
>
>
>
>


-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20171031/dde2b3a3/attachment.html>


More information about the petsc-dev mailing list