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->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"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></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>
> Hi I am trying to pass the DMMG struct to a function similar to what is in the examples.<br>
><br>
> extern PetscErrorCode Myfunc(DMMG,Vec);<br>
><br>
><br>
> int main(int argc,char **argv)<br>
> {<br>
> DMMG *dmmg;<br>
</div> ^^^^^^ Note this<br>
<div class="im">> ...Vec b;<br>
><br>
> Myfunc(dmmg,b)<br>
> }<br>
><br>
> PetscErrorCode Myfunc(DMMG *dmmg, Vec b)<br>
</div> ^^^ add this<br>
<div><div></div><div class="h5"><br>
> {<br>
> DA da = (DA)dmmg->dm;<br>
> .....<br>
> }<br>
><br>
> error: cannot convert ‘_n_DMMG**’ to ‘_n_DMMG*’ for argument ‘1’ to ‘PetscErrorCode Myfunc(_n_DMMG*, _p_Vec*)<br>
><br>
> So how do I pass a DMMG defined structure into my function?<br>
><br>
><br>
><br>
> Thanks<br>
> Chris<br>
<br>
</div></div></blockquote></div><br>