$extrastylesheet
petscdmlibmesh.C
Go to the documentation of this file.
00001 #include "libmesh/petsc_macro.h"
00002 // This only works with petsc-3.3 and above.
00003 #if !PETSC_VERSION_LESS_THAN(3,3,0)
00004 
00005 #include <petsc-private/petscimpl.h>
00006 #include "libmesh/petscdmlibmesh.h"
00007 
00008 #undef  __FUNCT__
00009 #define __FUNCT__ "DMlibMeshSetSystem"
00010 PetscErrorCode DMlibMeshSetSystem(DM dm, libMesh::NonlinearImplicitSystem& sys)
00011 {
00012   PetscErrorCode (*f)(DM,libMesh::NonlinearImplicitSystem&) = NULL;
00013   PetscErrorCode ierr;
00014 
00015   PetscFunctionBegin;
00016   PetscValidHeaderSpecific(dm,DM_CLASSID,1);
00017 #if PETSC_RELEASE_LESS_THAN(3,4,0)
00018   ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshSetSystem_C",(PetscVoidFunction*)&f);CHKERRQ(ierr);
00019 #else
00020   ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshSetSystem_C",&f);CHKERRQ(ierr);
00021 #endif
00022   if(!f) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "DM has no implementation for DMlibMeshSetSystem");
00023   ierr = (*f)(dm,sys);CHKERRQ(ierr);
00024   PetscFunctionReturn(0);
00025 }
00026 
00027 #undef  __FUNCT__
00028 #define __FUNCT__ "DMlibMeshGetSystem"
00029 PetscErrorCode DMlibMeshGetSystem(DM dm, libMesh::NonlinearImplicitSystem*& sys)
00030 {
00031   PetscErrorCode (*f)(DM,libMesh::NonlinearImplicitSystem*&) = NULL;
00032   PetscErrorCode ierr;
00033 
00034   PetscFunctionBegin;
00035   PetscValidHeaderSpecific(dm,DM_CLASSID,1);
00036 #if PETSC_RELEASE_LESS_THAN(3,4,0)
00037   ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshGetSystem_C",(PetscVoidFunction*)&f);CHKERRQ(ierr);
00038 #else
00039   ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshGetSystem_C",&f);CHKERRQ(ierr);
00040 #endif
00041   if(!f) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "DM has no implementation for DMlibMeshGetSystem");
00042   ierr = (*f)(dm,sys);CHKERRQ(ierr);
00043   PetscFunctionReturn(0);
00044 }
00045 
00046 
00047 #endif // #if !PETSC_VERSION_LESS_THAN(3,3,0)