Return a nullptr to the EclMaterialLawManager

Define a method materialLawManagerPtr() that returns a nullpointer
to EclMaterialLawManager, but that can be overridden in derived classes
e.g. EclProblem
This commit is contained in:
Håkon Hægland 2022-09-23 00:05:09 +02:00
parent a941ba49c0
commit f36aa67804
2 changed files with 16 additions and 3 deletions

View File

@ -661,8 +661,8 @@ private:
// mobility_ class attribute. the division by the phase viscosity happens later.
MaterialLaw::relativePermeabilities(mobility, materialParams, fluidState);
Valgrind::CheckDefined(mobility);
const auto& materialLawManager = problem.materialLawManager();
if (materialLawManager->hasDirectionalRelperms()) {
const auto* materialLawManager = problem.materialLawManagerPtr();
if (materialLawManager && materialLawManager->hasDirectionalRelperms()) {
auto satnumIdx = materialLawManager->satnumRegionIdx(globalSpaceIdx);
using Dir = FaceDir::DirEnum;
constexpr int ndim = 3;

View File

@ -40,7 +40,13 @@
#include <dune/common/fmatrix.hh>
namespace Opm {
// TODO: This hack is used to be able compile blackoilintensitivequantities.hh (see the function updateRelperms()) when
// the problem is not an EclProblem. For example if the problem is a ReservoirBlackOilVcfvProblem, the problem will not
// have a materialLawManager pointer (as the EclProblem has). Since this class MuitPhaseBaseProblem (see below) is a parent
// class for both those problem types, we can solve this problem by forward declaring EclMaterialLawManager<Traits> here
// and defining a method materialLawManagerPtr() here that returns a nullptr, but is overridden in EclProblem to
// return the real EclMaterialManager pointer.
template <class TraitsT> class EclMaterialLawManager;
/*!
* \ingroup Discretization
*
@ -246,6 +252,13 @@ public:
return dummy;
}
// TODO: See the comment at the top of this file for the reason why we need this method
template <class TraitsT>
const ::Opm::EclMaterialLawManager<TraitsT>* materialLawManagerPtr() const
{
return nullptr;
}
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ within a control volume.
*