Line data Source code
1 : // The libMesh Finite Element Library. 2 : // Copyright (C) 2002-2025 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_solver_exception.h" 21 : 22 : #ifdef LIBMESH_HAVE_PETSC 23 : 24 : #if !PETSC_VERSION_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" 34 29400 : PetscErrorCode DMlibMeshSetSystem(DM dm, libMesh::NonlinearImplicitSystem & sys) 35 : { 36 29400 : PetscErrorCode (*f)(DM,libMesh::NonlinearImplicitSystem &) = nullptr; 37 : 38 : PetscFunctionBegin; 39 : PetscValidHeaderSpecific(dm,DM_CLASSID,1); 40 29400 : LibmeshPetscCallQ(PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshSetSystem_C",&f)); 41 29400 : if (!f) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "DM has no implementation for DMlibMeshSetSystem"); 42 29400 : LibmeshPetscCallQ((*f)(dm,sys)); 43 840 : PetscFunctionReturn(LIBMESH_PETSC_SUCCESS); 44 : } 45 : 46 : #undef __FUNCT__ 47 : #define __FUNCT__ "DMlibMeshGetSystem" 48 14140 : PetscErrorCode DMlibMeshGetSystem(DM dm, libMesh::NonlinearImplicitSystem *& sys) 49 : { 50 14140 : PetscErrorCode (*f)(DM,libMesh::NonlinearImplicitSystem *&) = nullptr; 51 : 52 : PetscFunctionBegin; 53 : PetscValidHeaderSpecific(dm,DM_CLASSID,1); 54 14140 : LibmeshPetscCallQ(PetscObjectQueryFunction((PetscObject)dm,"DMlibMeshGetSystem_C",&f)); 55 14140 : if (!f) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "DM has no implementation for DMlibMeshGetSystem"); 56 14140 : LibmeshPetscCallQ((*f)(dm,sys)); 57 404 : PetscFunctionReturn(LIBMESH_PETSC_SUCCESS); 58 : } 59 : 60 : #endif // LIBMESH_HAVE_PETSC