<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none"><!-- P { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi Matt,</p>
<p><br>
</p>
<p>Yes, I was using the QuadratureGetData in the past and the results were good. I wasn't sure why that would have changed recently. Looking at the example (in test directory, not tutorial), it looks like the two interesting pointers are pEC and pES. pEC's
target is EC, which is explicitly set. Does pES have no target? In my code, I set (basically the same for q_points as well):<br>
</p>
<p>PetscReal, target, dimension(8) :: q_weights<br>
</p>
<p>PetscReal, pointer :: pq_weights(:)<br>
</p>
<p><br>
</p>
<p>then:<br>
</p>
<p>pq_weights => q_weights<br>
</p>
<p><br>
</p>
<p>Then call: PetscQuadratureGetData()<br>
</p>
<p>When I try to write the quadrature points and weights to see their output, I get values like NaN, 3.0e-310, etc. <br>
</p>
<p><br>
</p>
<p>I tried removing the q_weights target (like pES example in the test) and that returns a segfault. I've attached my example if that helps. You can uncomment the QuadratureView() and see that the points and weights are correct.<br>
</p>
<p><br>
</p>
<p>Thanks again,<br>
</p>
<p><br>
</p>
<p>Justin<br>
</p>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Matthew Knepley <knepley@gmail.com><br>
<b>Sent:</b> Friday, June 2, 2017 9:57 AM<br>
<b>To:</b> Justin Pogacnik<br>
<b>Cc:</b> petsc-users@mcs.anl.gov<br>
<b>Subject:</b> Re: [petsc-users] PetscFECreateDefault in Fortran</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Thu, Jun 1, 2017 at 2:59 PM, Justin Pogacnik <span dir="ltr">
<<a href="mailto:j.pogacnik@auckland.ac.nz" target="_blank">j.pogacnik@auckland.ac.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<p>All good. Thanks Matt. Will keep an eye out for that update. :)</p>
</div>
</blockquote>
<div>I have checked, and I was wrong before. I did write the code for PetscQuadratureGet/RestoreData()</div>
<div>in Fortran. Since it uses array arguments, I used F90. Thus you have to use F90 pointers, in the<br>
</div>
<div>same style as DMPlexGet/RestoreCone() in this example:</div>
<div><br>
</div>
<div> <a href="https://bitbucket.org/petsc/petsc/src/a19fbe4d52f99f875359274419a2d40a87edfba3/src/dm/impls/plex/examples/tutorials/ex1f90.F90?at=master&fileviewer=file-view-default">https://bitbucket.org/petsc/petsc/src/a19fbe4d52f99f875359274419a2d40a87edfba3/src/dm/impls/plex/examples/tutorials/ex1f90.F90?at=master&fileviewer=file-view-default</a></div>
<div><br>
</div>
<div>Let me know if that is not understandable</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<p>-Justin<br>
</p>
<div style="color:rgb(33,33,33)">
<hr style="display:inline-block; width:98%">
<div id="gmail-m_4075970607974121225divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
<b>Sent:</b> Friday, June 2, 2017 12:52 AM
<div>
<div class="gmail-h5"><br>
<b>To:</b> Justin Pogacnik<br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><br>
<b>Subject:</b> Re: [petsc-users] PetscFECreateDefault in Fortran</div>
</div>
</font>
<div> </div>
</div>
<div>
<div class="gmail-h5">
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Wed, May 31, 2017 at 10:00 PM, Justin Pogacnik <span dir="ltr">
<<a href="mailto:j.pogacnik@auckland.ac.nz" target="_blank">j.pogacnik@auckland.ac.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Thanks Matt! That works perfectly now. I have another question regarding accessing the quadrature information.<br>
</p>
<p><br>
</p>
<p>When I use PetscFEGetQuadrature(), then PetscQuadratureView(), I see what I expect regarding point locations, weights.<br>
</p>
<p><br>
</p>
<p>However, when I try to use PetscQuadratureGetData() the pointers seem to point to random memory locations. <br>
</p>
<p><br>
</p>
<p>The exact line from my test problem is: call PetscQuadratureGetData(quad,q_<wbr>nc,q_dim,q_num,pq_points,pq_we<wbr>ights,ierr);<br>
</p>
<p>where the pq_* are the pointers giving strange output. The q_nc, q_dim, and q_num are all giving what I would expect to see. </p>
</div>
</blockquote>
<div>You are clearly the first Fortran user interested in this stuff ;) Handling of arrays in Fortran demands some more work</div>
<div>from us. I need to write a wrapper for that function. I will do it as soon as I can.</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt <br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Happy to send along the file if that helps.<br>
</p>
<p><br>
</p>
<p>Thanks again,<br>
</p>
<p><br>
</p>
<p>Justin<br>
</p>
<div style="color:rgb(33,33,33)">
<hr style="display:inline-block; width:98%">
<div id="gmail-m_4075970607974121225m_-2885720920021194062divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
<b>Sent:</b> Thursday, June 1, 2017 1:34 AM<br>
<b>To:</b> Justin Pogacnik<br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><br>
<b>Subject:</b> Re: [petsc-users] PetscFECreateDefault in Fortran</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Wed, May 31, 2017 at 7:53 AM, Matthew Knepley <span dir="ltr">
<<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote"><span>On Tue, May 30, 2017 at 10:19 PM, Justin Pogacnik <span dir="ltr">
<<a href="mailto:j.pogacnik@auckland.ac.nz" target="_blank">j.pogacnik@auckland.ac.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hello,</p>
<p>I'm developing a finite element code in fortran 90. I recently updated my PETSc and am now getting the following error during compile/linking on an existing application:<br>
</p>
<p style="margin-right:0px; margin-left:0px; font-size:11px; line-height:normal; font-family:Menlo">
<span>Undefined symbols for architecture x86_64:</span></p>
<p style="margin-right:0px; margin-left:0px; font-size:11px; line-height:normal; font-family:Menlo">
<span> "_petscfecreatedefault_", referenced from:</span></p>
<p style="margin-right:0px; margin-left:0px; font-size:11px; line-height:normal; font-family:Menlo">
<span> _MAIN__ in fe_test.o</span></p>
<p style="margin-right:0px; margin-left:0px; font-size:11px; line-height:normal; font-family:Menlo">
<span>ld: symbol(s) not found for architecture x86_64</span></p>
<p style="margin-right:0px; margin-left:0px; font-size:11px; line-height:normal; font-family:Menlo">
<span>collect2: error: ld returned 1 exit status</span></p>
<p style="margin-right:0px; margin-left:0px; font-size:11px; line-height:normal; font-family:Menlo">
<span>make: *** [dist/fe_test] Error 1</span></p>
<p><br>
</p>
<p>I'm running Mac OS X Yosemite (10.10.5). I've created a "minimum working example" (attached) that re-creates the problem. It's basically just dm/impls/plex/examples/tu<wbr>torials/ex3f90, but tries to create a PetscFE object. Everything goes fine and the
DM looks like what is expected if PetscFECreateDefault is commented out. Any idea what am I missing?</p>
</div>
</blockquote>
</span>
<div>Yes, I had not made a Fortran binding for this function. I will do it now.</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>I have merged it to the 'next' branch, and it will be in 'master' soon.</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<div> <br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif">
<div><font size="3">Many thanks!</font></div>
<span class="gmail-m_4075970607974121225m_-2885720920021194062m_-7360822853962826608m_8823127664598162381HOEnZb"><font color="#888888">
<div><font size="3"><br>
</font></div>
<div><font size="3">Justin</font></div>
<p><br>
</p>
<p><br>
</p>
<br>
<span class="gmail-m_4075970607974121225m_-2885720920021194062m_-7360822853962826608HOEnZb"><font color="#888888"></font></span></font></span></div>
<span class="gmail-m_4075970607974121225m_-2885720920021194062m_-7360822853962826608HOEnZb"><font color="#888888"></font></span></blockquote>
</div>
<span class="gmail-m_4075970607974121225m_-2885720920021194062m_-7360822853962826608HOEnZb"><font color="#888888"><br>
<br clear="all">
<span class="gmail-m_4075970607974121225HOEnZb"><font color="#888888">
<div><br>
</div>
-- <br>
<div class="gmail-m_4075970607974121225m_-2885720920021194062m_-7360822853962826608m_8823127664598162381gmail_signature">
<div dir="ltr">
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</div>
<div><br>
</div>
<div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~mk51<wbr>/</a><br>
</div>
</div>
</div>
</font></span></font></span></div>
<span class="gmail-m_4075970607974121225HOEnZb"><font color="#888888"></font></span></div>
<span class="gmail-m_4075970607974121225HOEnZb"><font color="#888888"></font></span></blockquote>
<span class="gmail-m_4075970607974121225HOEnZb"><font color="#888888"></font></span></div>
<span class="gmail-m_4075970607974121225HOEnZb"><font color="#888888"><br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail-m_4075970607974121225m_-2885720920021194062m_-7360822853962826608gmail_signature">
<div dir="ltr">
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</div>
<div><br>
</div>
<div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~mk51<wbr>/</a><br>
</div>
</div>
</div>
</font></span></div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail-m_4075970607974121225gmail_signature">
<div dir="ltr">
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</div>
<div><br>
</div>
<div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~<wbr>mk51/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</div>
<div><br>
</div>
<div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~mk51/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>