make the PETSc code compile even if PETSc is not available

if PETSc is not available, the .cpp file will compile fine because it
will be reduced to be empty, but trying to include
LinearSolverPetsc.hpp in this case will result in an error.
This commit is contained in:
Andreas Lauser 2017-10-12 17:27:46 +02:00
parent 9796066199
commit fbec8c2300
2 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,9 @@
*/ */
#include "config.h" #include "config.h"
#if HAVE_PETSC
#include <cstring> #include <cstring>
#include <opm/core/linalg/LinearSolverPetsc.hpp> #include <opm/core/linalg/LinearSolverPetsc.hpp>
#include <unordered_map> #include <unordered_map>
@ -287,3 +290,4 @@ namespace{
} // namespace Opm } // namespace Opm
#endif // HAVE_PETSC

View File

@ -20,6 +20,11 @@
#ifndef OPM_LINEARSOLVERPETSC_HEADER_INCLUDED #ifndef OPM_LINEARSOLVERPETSC_HEADER_INCLUDED
#define OPM_LINEARSOLVERPETSC_HEADER_INCLUDED #define OPM_LINEARSOLVERPETSC_HEADER_INCLUDED
#if !HAVE_PETSC
#error "LinearSolverPetsc.hpp included, but the PETSc libraries are not available!"
#endif
#include <opm/core/linalg/LinearSolverInterface.hpp> #include <opm/core/linalg/LinearSolverInterface.hpp>
#include <opm/core/utility/parameters/ParameterGroup.hpp> #include <opm/core/utility/parameters/ParameterGroup.hpp>
#include <string> #include <string>