MFEM  v4.5.1
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
petscinternals.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef MFEM_PETSCINTERNALS
13 #define MFEM_PETSCINTERNALS
14 
15 #include "../general/error.hpp"
16 #include "petsc.h"
17 
18 // Error handling
19 // Prints PETSc's stacktrace and then calls MFEM_ABORT
20 // We cannot use PETSc's CHKERRQ since it returns a PetscErrorCode
21 #define PCHKERRQ(obj,err) do { \
22  if ((err)) \
23  { \
24  PetscError(PetscObjectComm((PetscObject)(obj)),__LINE__,_MFEM_FUNC_NAME, \
25  __FILE__,(err),PETSC_ERROR_REPEAT,NULL); \
26  MFEM_ABORT("Error in PETSc. See stacktrace above."); \
27  } \
28  } while(0);
29 #define CCHKERRQ(comm,err) do { \
30  if ((err)) \
31  { \
32  PetscError(comm,__LINE__,_MFEM_FUNC_NAME, \
33  __FILE__,(err),PETSC_ERROR_REPEAT,NULL); \
34  MFEM_ABORT("Error in PETSc. See stacktrace above."); \
35  } \
36  } while(0);
37 
38 #endif