From dfebd46acf5abea4381a5b31b260ade241233922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Wed, 7 Jan 2015 09:49:47 +0100 Subject: [PATCH] Make compilation of class depend on Boost.Heap availablility. If boost version is too old, the API is still the same and the class will build, but throws upon construction. --- opm/core/tof/AnisotropicEikonal.cpp | 29 +++++++++++++++++++++++++++++ opm/core/tof/AnisotropicEikonal.hpp | 11 +++++++++++ 2 files changed, 40 insertions(+) diff --git a/opm/core/tof/AnisotropicEikonal.cpp b/opm/core/tof/AnisotropicEikonal.cpp index 89e04461b..e3840d961 100644 --- a/opm/core/tof/AnisotropicEikonal.cpp +++ b/opm/core/tof/AnisotropicEikonal.cpp @@ -22,6 +22,8 @@ #include #include +#if BOOST_HEAP_AVAILABLE + namespace Opm { @@ -425,3 +427,30 @@ namespace Opm } // namespace Opm + + +#else // BOOST_HEAP_AVAILABLE is false + +namespace Opm +{ + const char* AnisotropicEikonal2derrmsg = + "This library has not been compiled with support for the" + "AnisotropicEikonal2d class, due to too old version of the boost libraries. " + "Boost.Heap from boost version 1.49 or newer is required. " + "To use this class you must recompile opm-core on a system with sufficiently " + "new version of boost."; + + AnisotropicEikonal2d::AnisotropicEikonal2d(const UnstructuredGrid&) + { + OPM_THROW(std::logic_error, AnisotropicEikonal2derrmsg); + } + + void AnisotropicEikonal2d::solve(const double*, + const std::vector&, + std::vector&) + { + OPM_THROW(std::logic_error, AnisotropicEikonal2derrmsg); + } +} + +#endif // BOOST_HEAP_AVAILABLE diff --git a/opm/core/tof/AnisotropicEikonal.hpp b/opm/core/tof/AnisotropicEikonal.hpp index 942c4d970..798869adc 100644 --- a/opm/core/tof/AnisotropicEikonal.hpp +++ b/opm/core/tof/AnisotropicEikonal.hpp @@ -22,7 +22,16 @@ #include #include +#include +#include + +#include + +#define BOOST_HEAP_AVAILABLE ((BOOST_VERSION / 100 % 1000) >= 49) + +#if BOOST_HEAP_AVAILABLE #include +#endif struct UnstructuredGrid; @@ -48,6 +57,7 @@ namespace Opm const std::vector& startcells, std::vector& solution); private: +#if BOOST_HEAP_AVAILABLE // Grid and topology. const UnstructuredGrid& grid_; SparseTable cell_neighbours_; @@ -82,6 +92,7 @@ namespace Opm void computeGridRadius(); void computeAnisoRatio(const double* metric); +#endif // BOOST_HEAP_AVAILABLE }; } // namespace Opm