On Mon, Aug 1, 2011 at 12:07 PM, Roy Stogner <[email protected]> wrote:
>
> On Mon, 1 Aug 2011, John Peterson wrote:
>
>> I can commit these patches unless someone else is already in the
>> process of doing it...
>
> I'm still catching up on older stuff, and at first glance don't see
> any problems here; go for it.

The second patch is giving me some problems.  I'm compiling against PETSc 2.3.3.

Compiling C++ (in debug mode) src/numerics/numeric_vector.C...
In file included from
/opt/packages/petsc/gnu-opt/petsc-2.3.3-p13/include/petscvec.h:9,
                 from
/Users/petejw/projects/libmesh_git/include/numerics/petsc_vector.h:44,
                 from src/numerics/numeric_vector.C:29:
/opt/packages/petsc/gnu-opt/petsc-2.3.3-p13/include/petscis.h:33:
warning: ‘ISDestroy’ initialized and declared ‘extern’
/opt/packages/petsc/gnu-opt/petsc-2.3.3-p13/include/petscis.h:33:
error: expected primary-expression before ‘)’ token
In file included from
/Users/petejw/projects/libmesh_git/include/numerics/petsc_vector.h:44,
                 from src/numerics/numeric_vector.C:29:
/opt/packages/petsc/gnu-opt/petsc-2.3.3-p13/include/petscvec.h:72:
warning: ‘VecDestroy’ initialized and declared ‘extern’
/opt/packages/petsc/gnu-opt/petsc-2.3.3-p13/include/petscvec.h:72:
error: expected primary-expression before ‘)’ token
/opt/packages/petsc/gnu-opt/petsc-2.3.3-p13/include/petscvec.h:325:
warning: ‘VecScatterDestroy’ initialized and declared ‘extern’
/opt/packages/petsc/gnu-opt/petsc-2.3.3-p13/include/petscvec.h:325:
error: expected primary-expression before ‘)’ token
In file included from src/numerics/numeric_vector.C:29:
/Users/petejw/projects/libmesh_git/include/numerics/petsc_vector.h: In
member function ‘void libMesh::PetscVector<T>::clear()’:
/Users/petejw/projects/libmesh_git/include/numerics/petsc_vector.h:934:
error: ‘VecDestroy’ cannot be used as a function
/Users/petejw/projects/libmesh_git/include/numerics/petsc_vector.h: In
member function ‘void libMesh::PetscVector<T>::clear() [with T =
double]’:
src/numerics/numeric_vector.C:368:   instantiated from here
/Users/petejw/projects/libmesh_git/include/numerics/petsc_vector.h:934:
error: ‘VecDestroy’ cannot be used as a function



I think it's because petsc_macro.h is #include'd *before* the relevant
petsc header, so the macro is defined before the extern XXDestroy
functions are declared, at which point they get macro-fied...?

Anyway, we can fix this by having a different name for our macro:

#if PETSC_VERSION_RELEASE && PETSC_VERSION_LESS_THAN(3,1,1)
#  define LibMeshVecDestroy(x)         VecDestroy(*(x))
#  define LibMeshVecScatterDestroy(x)  VecScatterDestroy(*(x))
#  define LibMeshMatDestroy(x)         MatDestroy(*(x))
#  define LibMeshISDestroy(x)          ISDestroy(*(x))
#  define LibMeshKSPDestroy(x)         KSPDestroy(*(x))
#  define LibMeshSNESDestroy(x)        SNESDestroy(*(x))
#  define LibMeshPetscViewerDestroy(x) PetscViewerDestroy(*(x))
#else
#  define LibMeshVecDestroy(x)         VecDestroy(x)
#  define LibMeshVecScatterDestroy(x)  VecScatterDestroy(x)
#  define LibMeshMatDestroy(x)         MatDestroy(x)
#  define LibMeshISDestroy(x)          ISDestroy(x)
#  define LibMeshKSPDestroy(x)         KSPDestroy(x)
#  define LibMeshSNESDestroy(x)        SNESDestroy(x)
#  define LibMeshPetscViewerDestroy(x) PetscViewerDestroy(x)
#endif

I've implemented the above, but am open to suggestions on macro names
and/or other solutions to the problem.

-- 
John

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to