Implement Dune::CpGrid operations when needed only

The functions

    multiplyFaceNormalWithArea
    maybeFreeFaceNormal

operating on Dune::CpGrids must not be implemented unless they are
actually used.  Otherwise we get link failures if (e.g.,)
opm-autodiff is being built without CpGrid support.

Hide the definitions behind "#ifdef HAVE_DUNE_CORNERPOINT".
This commit is contained in:
Bård Skaflestad 2014-04-10 00:03:10 +02:00
parent 51c664800f
commit 89f282f19f

View File

@ -21,6 +21,7 @@ double faceArea(const Dune::CpGrid&, int);
namespace
{
#ifdef HAVE_DUNE_CORNERPOINT
const double* multiplyFaceNormalWithArea(const Dune::CpGrid& grid, int face_index, const double* in)
{
int d=Opm::UgGridHelpers::dimensions(grid);
@ -32,15 +33,16 @@ const double* multiplyFaceNormalWithArea(const Dune::CpGrid& grid, int face_inde
return out;
}
inline const double* multiplyFaceNormalWithArea(const UnstructuredGrid&, int, const double* in)
{
return in;
}
inline void maybeFreeFaceNormal(const Dune::CpGrid&, const double* array)
{
delete[] array;
}
#endif // HAVE_DUNE_CORNERPOINT
inline const double* multiplyFaceNormalWithArea(const UnstructuredGrid&, int, const double* in)
{
return in;
}
inline void maybeFreeFaceNormal(const UnstructuredGrid&, const double*)
{}