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.
This commit is contained in:
Atgeirr Flø Rasmussen 2015-01-07 09:49:47 +01:00
parent 1e39010ba4
commit dfebd46acf
2 changed files with 40 additions and 0 deletions

View File

@ -22,6 +22,8 @@
#include <opm/core/grid.h>
#include <opm/core/utility/RootFinders.hpp>
#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<int>&,
std::vector<double>&)
{
OPM_THROW(std::logic_error, AnisotropicEikonal2derrmsg);
}
}
#endif // BOOST_HEAP_AVAILABLE

View File

@ -22,7 +22,16 @@
#include <opm/core/utility/SparseTable.hpp>
#include <vector>
#include <set>
#include <map>
#include <boost/version.hpp>
#define BOOST_HEAP_AVAILABLE ((BOOST_VERSION / 100 % 1000) >= 49)
#if BOOST_HEAP_AVAILABLE
#include <boost/heap/fibonacci_heap.hpp>
#endif
struct UnstructuredGrid;
@ -48,6 +57,7 @@ namespace Opm
const std::vector<int>& startcells,
std::vector<double>& solution);
private:
#if BOOST_HEAP_AVAILABLE
// Grid and topology.
const UnstructuredGrid& grid_;
SparseTable<int> cell_neighbours_;
@ -82,6 +92,7 @@ namespace Opm
void computeGridRadius();
void computeAnisoRatio(const double* metric);
#endif // BOOST_HEAP_AVAILABLE
};
} // namespace Opm