libMesh
petscdmlibmesh.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #include "libmesh/petsc_macro.h"
21 // This only works with petsc-3.3 and above.
22 #if !PETSC_VERSION_LESS_THAN(3,3,0)
23 
24 #if !PETSC_RELEASE_LESS_THAN(3,6,0)
25 # include <petsc/private/petscimpl.h>
26 #else
27 # include <petsc-private/petscimpl.h>
28 #endif
29 
30 #include "libmesh/petscdmlibmesh.h"
31 
32 #undef __FUNCT__
33 #define __FUNCT__ "DMlibMeshSetSystem"
35 {
36  PetscErrorCode (*f)(DM,libMesh::NonlinearImplicitSystem &) = libmesh_nullptr;
37  PetscErrorCode ierr;
38 
39  PetscFunctionBegin;
40  PetscValidHeaderSpecific(dm,DM_CLASSID,1);
41 #if PETSC_RELEASE_LESS_THAN(3,4,0)
42  ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshSetSystem_C",(PetscVoidFunction*)&f);CHKERRQ(ierr);
43 #else
44  ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshSetSystem_C",&f);CHKERRQ(ierr);
45 #endif
46  if (!f) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "DM has no implementation for DMlibMeshSetSystem");
47  ierr = (*f)(dm,sys);CHKERRQ(ierr);
49 }
50 
51 #undef __FUNCT__
52 #define __FUNCT__ "DMlibMeshGetSystem"
54 {
55  PetscErrorCode (*f)(DM,libMesh::NonlinearImplicitSystem *&) = libmesh_nullptr;
56  PetscErrorCode ierr;
57 
58  PetscFunctionBegin;
59  PetscValidHeaderSpecific(dm,DM_CLASSID,1);
60 #if PETSC_RELEASE_LESS_THAN(3,4,0)
61  ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshGetSystem_C",(PetscVoidFunction*)&f);CHKERRQ(ierr);
62 #else
63  ierr = PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshGetSystem_C",&f);CHKERRQ(ierr);
64 #endif
65  if (!f) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "DM has no implementation for DMlibMeshGetSystem");
66  ierr = (*f)(dm,sys);CHKERRQ(ierr);
68 }
69 
70 
71 #endif // #if !PETSC_VERSION_LESS_THAN(3,3,0)
ImplicitSystem & sys
const class libmesh_nullptr_t libmesh_nullptr
This class provides a specific system class.
PetscErrorCode DMlibMeshSetSystem(DM dm, libMesh::NonlinearImplicitSystem &sys)
Any functional implementation of the DMlibMesh API must compose the following functions with the DM o...
PetscErrorCode ierr
PetscErrorCode DMlibMeshGetSystem(DM dm, libMesh::NonlinearImplicitSystem *&sys)
PetscFunctionReturn(0)
CHKERRQ(ierr)