libMesh
slepc_macro.h
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 #ifndef LIBMESH_SLEPC_MACRO_H
21 #define LIBMESH_SLEPC_MACRO_H
22 
23 // Local includes
24 #include "libmesh/libmesh_config.h"
25 
26 // SLEPc include files. SLEPc can only be used
27 // together with PETSc.
28 #ifdef LIBMESH_HAVE_SLEPC
29 
30 // A convenient macro for comparing SLEPc versions.
31 // Returns 1 if the current SLEPc version is < major.minor.subminor
32 // and zero otherwise.
33 #define SLEPC_VERSION_LESS_THAN(major,minor,subminor) \
34  ((LIBMESH_DETECTED_SLEPC_VERSION_MAJOR < (major) || \
35  (LIBMESH_DETECTED_SLEPC_VERSION_MAJOR == (major) && (LIBMESH_DETECTED_SLEPC_VERSION_MINOR < (minor) || \
36  (LIBMESH_DETECTED_SLEPC_VERSION_MINOR == (minor) && \
37  LIBMESH_DETECTED_SLEPC_VERSION_SUBMINOR < (subminor))))) ? 1 : 0)
38 
39 // Make up for missing extern "C" in old SLEPc versions
40 #if !defined(LIBMESH_USE_COMPLEX_NUMBERS) && SLEPC_VERSION_LESS_THAN(3,0,0)
41 # define EXTERN_C_FOR_SLEPC_BEGIN extern "C" {
42 # define EXTERN_C_FOR_SLEPC_END }
43 #else
44 # define EXTERN_C_FOR_SLEPC_BEGIN
45 # define EXTERN_C_FOR_SLEPC_END
46 #endif
47 
48 #if SLEPC_VERSION_RELEASE && SLEPC_VERSION_LESS_THAN(3,1,1)
49 # define LibMeshEPSDestroy(x) EPSDestroy(*(x))
50 #else
51 # define LibMeshEPSDestroy(x) EPSDestroy(x)
52 #endif
53 
54 #endif // #if LIBMESH_HAVE_SLEPC
55 #endif // LIBMESH_SLEPC_MACRO_H