diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index 69259a9ea..3f2b0e5a0 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -223,7 +223,7 @@ namespace detail { // TODO: put this for now to avoid modify the following code. // TODO: this code can be fragile. - const Wells* wells_arg = &(asImpl().well_model_.wells()); + const Wells* wells_arg = asImpl().well_model_.wellsPointer(); #if HAVE_MPI if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) ) diff --git a/opm/autodiff/MultisegmentWells.cpp b/opm/autodiff/MultisegmentWells.cpp index 5a98b201e..7cb88b49b 100644 --- a/opm/autodiff/MultisegmentWells.cpp +++ b/opm/autodiff/MultisegmentWells.cpp @@ -294,6 +294,12 @@ namespace Opm { } + const Wells* + MultisegmentWells::wellsPointer() const + { + return wells_; + } + diff --git a/opm/autodiff/MultisegmentWells.hpp b/opm/autodiff/MultisegmentWells.hpp index e1e9976ba..0d8e5aece 100644 --- a/opm/autodiff/MultisegmentWells.hpp +++ b/opm/autodiff/MultisegmentWells.hpp @@ -102,6 +102,8 @@ namespace Opm { const Wells& wells() const; + const Wells* wellsPointer() const; + int numPhases() const { return num_phases_; }; int numWells() const { return wells_multisegment_.size(); } diff --git a/opm/autodiff/StandardWells.hpp b/opm/autodiff/StandardWells.hpp index 9f4bc7917..7b367f43a 100644 --- a/opm/autodiff/StandardWells.hpp +++ b/opm/autodiff/StandardWells.hpp @@ -74,6 +74,8 @@ namespace Opm { const Wells& wells() const; + const Wells* wellsPointer() const; + /// return true if wells are available in the reservoir bool wellsActive() const; void setWellsActive(const bool wells_active); diff --git a/opm/autodiff/StandardWells_impl.hpp b/opm/autodiff/StandardWells_impl.hpp index 5d34c4789..e7f39aaa1 100644 --- a/opm/autodiff/StandardWells_impl.hpp +++ b/opm/autodiff/StandardWells_impl.hpp @@ -115,6 +115,10 @@ namespace Opm } + const Wells* StandardWells::wellsPointer() const + { + return wells_; + }