<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Oct 31, 2017, at 12:39 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<div class="gmail_extra">
<div class="gmail_quote">On Tue, Oct 31, 2017 at 11:36 AM, Blaise A Bourdin<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:bourdin@lsu.edu" target="_blank" class="">bourdin@lsu.edu</a>></span><span class="Apple-converted-space"> </span>wrote:<br class="">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
<div class="">
<div class="m_-3788323582294446095BodyFragment"><font size="2" class=""><span style="font-size: 10pt;" class="">
<div class="m_-3788323582294446095PlainText">Hi,<br class="">
<br class="">
I am losing my mind over segfaults in DMPlexVecGetClosure.<br class="">
<br class="">
In the example below, I get a segfault whenever cval is not set to NULL before calling DMPlexVecGetClosure. Is this expected?</div>
</span></font></div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">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</div>
<div class="">in (so you can allocate your own temp storage if you are smarter).</div>
<div class=""> </div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
<div class="">
<div class="m_-3788323582294446095BodyFragment"><font size="2" class=""><span style="font-size: 10pt;" class="">
<div class="m_-3788323582294446095PlainText">The documentations says nothing about this<br class="">
</div>
</span></font></div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">That is a problem.</div>
<div class=""> </div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
<div class="">
<div class="m_-3788323582294446095BodyFragment"><font size="2" class=""><span style="font-size: 10pt;" class="">
<div class="m_-3788323582294446095PlainText">Also, after calling DMPlexVecRestoreClosure, the values of cval are discarded and neither global nor coord are changed.<br class="">
</div>
</span></font></div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Ah, GetClosure() is not like GetArray(), in that it is a temp copy. You need SetClosure() in order to change values.</div>
</div>
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div class="">
<div class="">So DMPlexVecGetClosure / DMPlexVecRestoreClosure behaves more like ISCreateGeneral / ISDestroy than as a standard PETSc XXXGet / XXXRestore.</div>
<div class=""><br class="">
</div>
<div class="">I’ll do my best to submit a pull request with an updated man page and an example.</div>
<div class=""><br class="">
</div>
<div class="">Blaise</div>
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<div class="gmail_extra">
<div class="gmail_quote">
<div class=""><br class="">
</div>
<div class=""> Matt</div>
<div class=""> </div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
<div class="">
<div class="m_-3788323582294446095BodyFragment"><font size="2" class=""><span style="font-size: 10pt;" class="">
<div class="m_-3788323582294446095PlainText">I am obviously doing something wrong but cannot figure it out...<span class="HOEnZb"><font color="#888888" class=""><br class="">
<br class="">
Blaise<br class="">
</font></span></div>
<span class="HOEnZb"><font color="#888888" class=""></font></span></span></font></div>
<span class="HOEnZb"><font color="#888888" class="">
<div class="m_-3788323582294446095BodyFragment"><font size="2" class=""><span style="font-size: 10pt;" class="">
<div class="m_-3788323582294446095PlainText"><br class="">
<br class="">
--<span class="Apple-converted-space"> </span><br class="">
Department of Mathematics and Center for Computation & Technology<br class="">
Louisiana State University, Baton Rouge, LA 70803, USA<br class="">
Tel.<span class="Apple-converted-space"> </span><a href="tel:(225)%20578-1612" value="+12255781612" target="_blank" class="">+1 (225) 578 1612</a>, Fax <span class="Apple-converted-space"> </span><a href="tel:(225)%20578-4276" value="+12255784276" target="_blank" class="">+1
(225) 578 4276</a><span class="Apple-converted-space"> </span><a href="http://www.math.lsu.edu/~bourdin" target="_blank" class="">http://www.math.lsu.edu/~<wbr class="">bourdin</a><br class="">
<br class="">
<br class="">
<br class="">
<br class="">
<br class="">
<br class="">
<br class="">
</div>
</span></font></div>
</font></span></div>
</blockquote>
</div>
<br class="">
<br clear="all" class="">
<div class=""><br class="">
</div>
--<span class="Apple-converted-space"> </span><br class="">
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener</div>
<div class=""><br class="">
</div>
<div class=""><a href="http://www.caam.rice.edu/~mk51/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
<div class=""><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; " class="">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; " class="">
<span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; " class="">
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " class="">
-- </div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " class="">
Department of Mathematics and Center for Computation & Technology</div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " class="">
Louisiana State University, Baton Rouge, LA 70803, USA</div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " class="">
Tel. +1 (225) 578 1612, Fax +1 (225) 578 4276 <a href="http://www.math.lsu.edu/~bourdin" class="">
http://www.math.lsu.edu/~bourdin</a></div>
<div class=""><br class="khtml-block-placeholder">
</div>
<div class=""><br class="khtml-block-placeholder">
</div>
<br class="Apple-interchange-newline">
</div>
</span></div>
</span><br class="Apple-interchange-newline">
</div>
</span><br class="Apple-interchange-newline">
</span><br class="Apple-interchange-newline">
</div>
<br class="">
</body>
</html>