Merge pull request #2036 from blattms/improve-vanguard-layering-violation

Make sure subclass functions are not called before subclass is initia…
This commit is contained in:
Atgeirr Flø Rasmussen 2019-10-02 14:57:00 +02:00 committed by GitHub
commit 2b9e30df33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 22 deletions

View File

@ -81,10 +81,11 @@ private:
static const int dimension = Grid::dimension;
public:
/*!
* \brief Inherit the constructors from the base class.
*/
using EclBaseVanguard<TypeTag>::EclBaseVanguard;
EclAluGridVanguard(Simulator& simulator)
: EclBaseVanguard<TypeTag>(simulator)
{
this->callImplementationInit();
}
~EclAluGridVanguard()
{

View File

@ -373,16 +373,6 @@ public:
int outputInterval = EWOMS_GET_PARAM(TypeTag, int, EclOutputInterval);
if (outputInterval >= 0)
eclState_->getRestartConfig().overrideRestartWriteInterval(outputInterval);
asImp_().createGrids_();
asImp_().filterConnections_();
asImp_().updateOutputDir_();
asImp_().finalizeInit_();
if (enableExperiments) {
Opm::RelpermDiagnostics relpermDiagnostics;
relpermDiagnostics.diagnosis(*eclState_, *deck_, asImp_().grid());
}
}
/*!
@ -538,6 +528,19 @@ public:
std::unordered_set<std::string> defunctWellNames() const
{ return std::unordered_set<std::string>(); }
protected:
void callImplementationInit()
{
asImp_().createGrids_();
asImp_().filterConnections_();
asImp_().updateOutputDir_();
asImp_().finalizeInit_();
if (enableExperiments) {
Opm::RelpermDiagnostics relpermDiagnostics;
relpermDiagnostics.diagnosis(*eclState_, *deck_, asImp_().grid());
}
}
private:
void updateOutputDir_()
{

View File

@ -70,6 +70,7 @@ class EclCpGridVanguard : public EclBaseVanguard<TypeTag>
typedef EclBaseVanguard<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
typedef typename GET_PROP_TYPE(TypeTag, ElementMapper) ElementMapper;
public:
@ -81,10 +82,11 @@ private:
typedef Dune::CartesianIndexMapper<Grid> CartesianIndexMapper;
public:
/*!
* \brief Inherit the constructors from the base class.
*/
using EclBaseVanguard<TypeTag>::EclBaseVanguard;
EclCpGridVanguard(Simulator& simulator)
: EclBaseVanguard<TypeTag>(simulator)
{
this->callImplementationInit();
}
~EclCpGridVanguard()
{

View File

@ -77,10 +77,11 @@ private:
typedef CartesianIndexMapper* CartesianIndexMapperPointer;
public:
/*!
* \brief Inherit the constructors from the base class.
*/
using EclBaseVanguard<TypeTag>::EclBaseVanguard;
EclPolyhedralGridVanguard(Simulator& simulator)
: EclBaseVanguard<TypeTag>(simulator)
{
this->callImplementationInit();
}
~EclPolyhedralGridVanguard()
{