I made the change in the function so I now get this error <br>PetscErrorCode ComputeRho(DMMG *dmmg, Vec rho)<br>{<br> DA             distA = (DA)dmmg-&gt;dm;   <br>    <br>In function ‘PetscErrorCode Myfunc(_n_DMMG**, _p_Vec*)’: <br>
error: request for member ‘dm’ in ‘* dmmg’, which is of non-class type ‘_n_DMMG*’<br><br>It looks like I have a null pointer to _n_DMMG**  instead of _n_DMMG*<br><br>Chris<br><br> <br><br><div class="gmail_quote">On Mon, Nov 22, 2010 at 1:34 PM, Barry Smith <span dir="ltr">&lt;<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
On Nov 22, 2010, at 3:23 PM, Chris Bording wrote:<br>
<br>
&gt; Hi I am trying to pass the DMMG struct to a function similar to what is in the examples.<br>
&gt;<br>
&gt; extern PetscErrorCode Myfunc(DMMG,Vec);<br>
&gt;<br>
&gt;<br>
&gt; int main(int argc,char **argv)<br>
&gt; {<br>
&gt;   DMMG           *dmmg;<br>
</div>                          ^^^^^^ Note this<br>
<div class="im">&gt; ...Vec b;<br>
&gt;<br>
&gt; Myfunc(dmmg,b)<br>
&gt; }<br>
&gt;<br>
&gt; PetscErrorCode Myfunc(DMMG *dmmg, Vec b)<br>
</div>                                                             ^^^   add this<br>
<div><div></div><div class="h5"><br>
&gt; {<br>
&gt;   DA             da = (DA)dmmg-&gt;dm;<br>
&gt; .....<br>
&gt; }<br>
&gt;<br>
&gt; error: cannot convert ‘_n_DMMG**’ to ‘_n_DMMG*’ for argument ‘1’ to ‘PetscErrorCode Myfunc(_n_DMMG*, _p_Vec*)<br>
&gt;<br>
&gt; So how do I pass a DMMG defined structure into my function?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Thanks<br>
&gt; Chris<br>
<br>
</div></div></blockquote></div><br>