I made the change in the function so I now get this error
PetscErrorCode ComputeRho(DMMG *dmmg, Vec rho)
{
DA distA = (DA)dmmg->dm;
In function ‘PetscErrorCode Myfunc(_n_DMMG**, _p_Vec*)’:
error: request for member ‘dm’ in ‘* dmmg’, which is of non-class type ‘_n_DMMG*’
It looks like I have a null pointer to _n_DMMG** instead of _n_DMMG*
Chris
^^^^^^ Note this
On Nov 22, 2010, at 3:23 PM, Chris Bording wrote:
> Hi I am trying to pass the DMMG struct to a function similar to what is in the examples.
>
> extern PetscErrorCode Myfunc(DMMG,Vec);
>
>
> int main(int argc,char **argv)
> {
> DMMG *dmmg;
> ...Vec b;^^^ add this
>
> Myfunc(dmmg,b)
> }
>
> PetscErrorCode Myfunc(DMMG *dmmg, Vec b)
> {
> DA da = (DA)dmmg->dm;
> .....
> }
>
> error: cannot convert ‘_n_DMMG**’ to ‘_n_DMMG*’ for argument ‘1’ to ‘PetscErrorCode Myfunc(_n_DMMG*, _p_Vec*)
>
> So how do I pass a DMMG defined structure into my function?
>
>
>
> Thanks
> Chris