20#ifndef OPM_RESCOUP_PROXY_HPP
21#define OPM_RESCOUP_PROXY_HPP
24#ifdef RESERVOIR_COUPLING_ENABLED
35#ifndef RESERVOIR_COUPLING_ENABLED
37template <
class Scalar>
class ReservoirCouplingMaster;
38template <
class Scalar>
class ReservoirCouplingSlave;
41namespace ReservoirCoupling {
53template <
class Scalar>
64#ifdef RESERVOIR_COUPLING_ENABLED
68 bool isEnabled() const noexcept {
return master_ || slave_; }
71 bool isMaster() const noexcept {
return master_ !=
nullptr; }
74 bool isSlave() const noexcept {
return slave_ !=
nullptr; }
93 ReservoirCouplingMaster<Scalar>*
masterPtr() noexcept {
return master_; }
94 const ReservoirCouplingMaster<Scalar>*
masterPtr() const noexcept {
return master_; }
97 ReservoirCouplingSlave<Scalar>*
slavePtr() noexcept {
return slave_; }
98 const ReservoirCouplingSlave<Scalar>*
slavePtr() const noexcept {
return slave_; }
103 ReservoirCouplingMaster<Scalar>&
master() {
return *master_; }
104 const ReservoirCouplingMaster<Scalar>&
master()
const {
return *master_; }
107 ReservoirCouplingSlave<Scalar>&
slave() {
return *slave_; }
108 const ReservoirCouplingSlave<Scalar>&
slave()
const {
return *slave_; }
116 return master_ && master_->isMasterGroup(group_name);
122 bool isSlaveGroup(
const std::string& group_name)
const {
123 return slave_ && slave_->isSlaveGroup(group_name);
127 ReservoirCouplingMaster<Scalar>* master_ =
nullptr;
128 ReservoirCouplingSlave<Scalar>* slave_ =
nullptr;
136 bool isSlave() const noexcept {
return false; }
142 throw std::logic_error(
"ReservoirCoupling::Proxy::setMaster() called in non-MPI build");
146 throw std::logic_error(
"ReservoirCoupling::Proxy::setSlave() called in non-MPI build");
156 throw std::logic_error(
"ReservoirCoupling::Proxy::master() called in non-MPI build");
159 throw std::logic_error(
"ReservoirCoupling::Proxy::master() called in non-MPI build");
163 throw std::logic_error(
"ReservoirCoupling::Proxy::slave() called in non-MPI build");
166 throw std::logic_error(
"ReservoirCoupling::Proxy::slave() called in non-MPI build");
Thin proxy for reservoir coupling master/slave pointers.
Definition: RescoupProxy.hpp:54
ReservoirCouplingMaster< Scalar > * masterPtr() noexcept
Definition: RescoupProxy.hpp:149
Proxy(Proxy &&) noexcept=default
Proxy & operator=(const Proxy &)=default
bool isMasterGroup(const std::string &) const noexcept
Definition: RescoupProxy.hpp:171
void setMaster(ReservoirCouplingMaster< Scalar > *)
Definition: RescoupProxy.hpp:141
const ReservoirCouplingMaster< Scalar > & master() const
Definition: RescoupProxy.hpp:158
Proxy(const Proxy &)=default
void setSlave(ReservoirCouplingSlave< Scalar > *)
Definition: RescoupProxy.hpp:145
ReservoirCouplingSlave< Scalar > * slavePtr() noexcept
Definition: RescoupProxy.hpp:152
ReservoirCouplingSlave< Scalar > & slave()
Definition: RescoupProxy.hpp:162
bool isEnabled() const noexcept
Definition: RescoupProxy.hpp:134
ReservoirCouplingMaster< Scalar > & master()
Definition: RescoupProxy.hpp:155
bool isSlaveGroup(const std::string &) const noexcept
Definition: RescoupProxy.hpp:175
bool isMaster() const noexcept
Definition: RescoupProxy.hpp:135
const ReservoirCouplingSlave< Scalar > & slave() const
Definition: RescoupProxy.hpp:165
const ReservoirCouplingSlave< Scalar > * slavePtr() const noexcept
Definition: RescoupProxy.hpp:153
const ReservoirCouplingMaster< Scalar > * masterPtr() const noexcept
Definition: RescoupProxy.hpp:150
bool isSlave() const noexcept
Definition: RescoupProxy.hpp:136
Definition: ReservoirCouplingMaster.hpp:38
Definition: ReservoirCouplingSlave.hpp:40
Definition: blackoilbioeffectsmodules.hh:43