<div class="gmail_quote"> <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>
><br>
> Maybe I'm just being dense, but I don't see how or where I set these at each level within<br>
> the DMMG framework. Isn't all that buried within the DMMG routines, or is there some<br>
> way for me to specify this?<br>
<br>
</div>It's kinda raw:<br>
<br>
for (i=0; i<DMMGGetLevels(dmmg); i++) {<br>
DA da = (DA)dmmg[i]->dm;<br>
/* Set coordinates */<br>
}<br>
</blockquote></div><br><br>I'm trying to write a wrapper in c to do this, but as a first step I'm just trying to set<br>uniform coordinates at each level. However, I am simultaneously trying to learn c, learn about pointers,<br>
and figure out how this all works with PETSc, and I am having a problem which is probably<br>very obvious to you expert c programmers, but not obvious to me (a long-time fortran programmer).<br><br>Here is what I have so far, which is based largely on what Jed wrote above and zdmmg.c which<br>
is one of the Fortran wrappers you guys have written:<br><br><br>#include "private/fortranimpl.h"<br>#include "petscda.h"<br>#include "petscdmmg.h"<br><br>#if defined(PETSC_HAVE_FORTRAN_CAPS)<br>
#define dasetcoords_ DASETCOORDS<br>#elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)<br>#define dasetcoords_ dasetcoords<br>#endif<br><br>EXTERN_C_BEGIN<br><br>void PETSC_STDCALL dasetcoords_(DMMG **dmmg, PetscErrorCode *ierr)<br>
{<br> PetscInt i, nlev;<br><br> nlev = DMMGGetLevels(*dmmg);<br> printf("The number of levels is %d \n",nlev);<br><br> for (i=0; i < nlev; i++){<br> DA da = (DA)dmmg[i]->dm;<br> *ierr = DASetUniformCoordinates(da,0.0,1.0,0.0,1.0,0.0,1.0); <br>
}<br>}<br><br>EXTERN_C_END<br><br><br>But when I compile it I get:<br><br>dasetcoords.c(22): error: expression must have pointer-to-struct-or-union type<br> DA da = (DA)dmmg[i]->dm;<br> ^<br><br><br>
So, I've tried various things, but can't figure out how to do this correctly. Can someone who<br>is a c expert help me here on how to get the DA set for each level?<br><br>Thanks, Randy M.<br>