[petsc-users] Is it possible to use global variables in Petsc code?

Li, Zhisong (lizs) lizs at mail.uc.edu
Wed Jul 21 18:19:33 CDT 2010

 Hi, Petsc Team,

I wonder if we can utilize a global variable when using PETSc, such as a declaration and definition in the main function:

extern PetscScalar x, y, z;
    x = 1.0;

This should be a regular usage in ANSI C and will help a lot when we have user-defined functions. If it can work, then it will easily replace those functions like DAGetInfo( ) and save running time. But I don't see any examples of using this in PETSc before. And I've tried this but it doesn't work or cannot pass the compiling check.

Thank you.

Zhisong Li
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100721/d495659d/attachment.htm>

More information about the petsc-users mailing list