@@ -44,6 +44,9 @@ class ReactorAccessor
4444 // ! by Reactor::eval, this method should be called in either a "replace" or "after"
4545 // ! delegate for Reactor::evalWalls().
4646 virtual void setHeatRate (double q) = 0;
47+
48+ // ! @copydoc ReactorBase::surfaceProductionRates
49+ virtual vector<double >& surfaceProductionRates () = 0;
4750};
4851
4952// ! Delegate methods of the Reactor class to external functions
@@ -52,8 +55,9 @@ template <class R>
5255class ReactorDelegator : public Delegator , public R , public ReactorAccessor
5356{
5457public:
55- ReactorDelegator (shared_ptr<Solution> phase, bool clone, const string& name=" (none)" )
56- : R(phase, clone, name)
58+ template <class ... Args>
59+ ReactorDelegator (Args&&... args)
60+ : R(std::forward<Args>(args)...)
5761 {
5862 install (" initialize" , m_initialize, [this ](double t0) { R::initialize (t0); });
5963 install (" getState" , m_getState,
@@ -67,7 +71,9 @@ class ReactorDelegator : public Delegator, public R, public ReactorAccessor
6771 R::eval (t, LHS, RHS);
6872 }
6973 );
70- install (" evalWalls" , m_evalWalls, [this ](double t) { R::evalWalls (t); });
74+ if constexpr (std::is_base_of<Reactor, R>::value) {
75+ install (" evalWalls" , m_evalWalls, [this ](double t) { R::evalWalls (t); });
76+ }
7177 install (" componentName" , m_componentName,
7278 [this ](size_t k) { return R::componentName (k); });
7379 install (" componentIndex" , m_componentIndex,
@@ -104,7 +110,11 @@ class ReactorDelegator : public Delegator, public R, public ReactorAccessor
104110 }
105111
106112 void evalWalls (double t) override {
107- m_evalWalls (t);
113+ if constexpr (std::is_base_of<Reactor, R>::value) {
114+ m_evalWalls (t);
115+ } else {
116+ ReactorBase::evalWalls (t);
117+ }
108118 }
109119
110120 string componentName (size_t k) override {
@@ -122,19 +132,43 @@ class ReactorDelegator : public Delegator, public R, public ReactorAccessor
122132 }
123133
124134 double expansionRate () const override {
125- return R::m_vdot;
135+ if constexpr (std::is_base_of<Reactor, R>::value) {
136+ return R::m_vdot;
137+ } else {
138+ throw NotImplementedError (" ReactorDelegator::expansionRate" ,
139+ " Expansion rate is undefined for reactors of type '{}'." , type ());
140+ }
126141 }
127142
128143 void setExpansionRate (double v) override {
129- R::m_vdot = v;
144+ if constexpr (std::is_base_of<Reactor, R>::value) {
145+ R::m_vdot = v;
146+ } else {
147+ throw NotImplementedError (" ReactorDelegator::setExpansionRate" ,
148+ " Expansion rate is undefined for reactors of type '{}'." , type ());
149+ }
130150 }
131151
132152 double heatRate () const override {
133- return R::m_Qdot;
153+ if constexpr (std::is_base_of<Reactor, R>::value) {
154+ return R::m_Qdot;
155+ } else {
156+ throw NotImplementedError (" ReactorDelegator::heatRate" ,
157+ " Heat rate is undefined for reactors of type '{}'." , type ());
158+ }
134159 }
135160
136161 void setHeatRate (double q) override {
137- R::m_Qdot = q;
162+ if constexpr (std::is_base_of<Reactor, R>::value) {
163+ R::m_Qdot = q;
164+ } else {
165+ throw NotImplementedError (" ReactorDelegator::setHeatRate" ,
166+ " Heat rate is undefined for reactors of type '{}'." , type ());
167+ }
168+ }
169+
170+ vector<double >& surfaceProductionRates () override {
171+ return R::m_sdot;
138172 }
139173
140174private:
0 commit comments