[petsc-users] Writing solution data to file when using DMDA.

Åsmund Ervik asmund.ervik at ntnu.no
Wed Mar 19 16:06:33 CDT 2014


Hi Jed,

Yeah, the actual include lines I use are of the form
#include <finclude/petscviewer.h>

It looks like I figured it out in the end:
my main file has many "use" statements at the beginning. One of the files that are "used" has all the #include stuff, and that entire module is public. Thus I can't #include stuff at the top of my main file, that would result in conflicting definitions. This works for 99% of things, so I can call e.g. DMDA routines in the main file and everything is fine. But certain things, e.g. constants like PETSCVIEWERVTK or macros like CHKERRQ don't get pulled in correctly. This is probably due to some Fortran preprocessing subtlety that I don't understand.

What I can do short-term is put the stuff that needs PETSCVIEWERVTK and similar constants inside a function in some other module where I can #include stuff properly. For the long term, I guess it's "to the refactoring-mobile".

Regards,
Åsmund

________________________________________
Fra: Jed Brown [jed at jedbrown.org]
Sendt: 19. mars 2014 00:31
Til: Åsmund Ervik; petsc-users at mcs.anl.gov
Emne: Re: [petsc-users] Writing solution data to file when using DMDA.

Åsmund Ervik <asmund.ervik at ntnu.no> writes:
> I'm also willing to try the VTK way of doing things, but I hit a
> problem when I tried that: even though I include "petscviewer.h" (also
> tried adding "petscviewerdef.h"), when I do
>     call PetscViewerSetType(viewer,PETSCVIEWERVTK,ierr) my compiler
>  complains that PETSCVIEWERVTK is undefined (has no implicit
>  type).

Should be <finclude/petscviewer.h>

Is it actually included?  Are you sure you have v3.4.3?

$ git grep VIEWERVTK v3.4.3 include/finclude/petscviewerdef.h
v3.4.3:include/finclude/petscviewerdef.h:#define PETSCVIEWERVTK 'vtk'


> This is from Fortran90 using preprocessing macros to #include the
> files. I tried PETSCVIEWERASCII as well, same problem. This is with
> 3.4.3. Any hints on this?



More information about the petsc-users mailing list