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);
120 ReservoirCouplingMaster<Scalar>* master_ =
nullptr;
121 ReservoirCouplingSlave<Scalar>* slave_ =
nullptr;
129 bool isSlave() const noexcept {
return false; }
135 throw std::logic_error(
"ReservoirCoupling::Proxy::setMaster() called in non-MPI build");
139 throw std::logic_error(
"ReservoirCoupling::Proxy::setSlave() called in non-MPI build");
149 throw std::logic_error(
"ReservoirCoupling::Proxy::master() called in non-MPI build");
152 throw std::logic_error(
"ReservoirCoupling::Proxy::master() called in non-MPI build");
156 throw std::logic_error(
"ReservoirCoupling::Proxy::slave() called in non-MPI build");
159 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:142
Proxy(Proxy &&) noexcept=default
Proxy & operator=(const Proxy &)=default
bool isMasterGroup(const std::string &) const noexcept
Definition: RescoupProxy.hpp:164
void setMaster(ReservoirCouplingMaster< Scalar > *)
Definition: RescoupProxy.hpp:134
const ReservoirCouplingMaster< Scalar > & master() const
Definition: RescoupProxy.hpp:151
Proxy(const Proxy &)=default
void setSlave(ReservoirCouplingSlave< Scalar > *)
Definition: RescoupProxy.hpp:138
ReservoirCouplingSlave< Scalar > * slavePtr() noexcept
Definition: RescoupProxy.hpp:145
ReservoirCouplingSlave< Scalar > & slave()
Definition: RescoupProxy.hpp:155
bool isEnabled() const noexcept
Definition: RescoupProxy.hpp:127
ReservoirCouplingMaster< Scalar > & master()
Definition: RescoupProxy.hpp:148
bool isMaster() const noexcept
Definition: RescoupProxy.hpp:128
const ReservoirCouplingSlave< Scalar > & slave() const
Definition: RescoupProxy.hpp:158
const ReservoirCouplingSlave< Scalar > * slavePtr() const noexcept
Definition: RescoupProxy.hpp:146
const ReservoirCouplingMaster< Scalar > * masterPtr() const noexcept
Definition: RescoupProxy.hpp:143
bool isSlave() const noexcept
Definition: RescoupProxy.hpp:129
Definition: ReservoirCouplingMaster.hpp:38
Definition: ReservoirCouplingSlave.hpp:40
Definition: blackoilbioeffectsmodules.hh:43