On Oct 31, 2017, at 12:39 PM, Matthew Knepley <[email protected]<mailto:[email protected]>> wrote:
On Tue, Oct 31, 2017 at 11:36 AM, Blaise A Bourdin <[email protected]<mailto:[email protected]>> 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. So DMPlexVecGetClosure / DMPlexVecRestoreClosure behaves more like ISCreateGeneral / ISDestroy than as a standard PETSc XXXGet / XXXRestore. I’ll do my best to submit a pull request with an updated man page and an example. Blaise 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<tel:(225)%20578-1612>, Fax +1 (225) 578 4276<tel:(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/> -- Department of Mathematics and Center for Computation & Technology Louisiana State University, Baton Rouge, LA 70803, USA Tel. +1 (225) 578 1612, Fax +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin
