|
@@ -38,9 +38,9 @@ namespace artis { namespace kernel {
|
|
|
|
|
|
template < typename T, typename U, typename V, typename W >
|
|
|
class AbstractCoupledModel : public AbstractModel < U, V >,
|
|
|
- public States < T, U >,
|
|
|
- public Internals < T, U >,
|
|
|
- public Externals < T, U >
|
|
|
+ public States < T, U, V >,
|
|
|
+ public Internals < T, U, V >,
|
|
|
+ public Externals < T, U, V >
|
|
|
{
|
|
|
typedef AbstractModel < U, V > type;
|
|
|
typedef std::map < int, type* > Submodels;
|
|
@@ -77,13 +77,13 @@ public:
|
|
|
<< "AFTER - "
|
|
|
<< AbstractCoupledModel < T, U, V, W >::path(this);
|
|
|
utils::Trace < utils::DoubleTime >::trace().flush();
|
|
|
- for (size_t i = 0; i < Internals < T, U >::size(); ++i) {
|
|
|
- if (not Internals < T, U >::get(i).is_null()) {
|
|
|
+ for (size_t i = 0; i < Internals < T, U, V >::size(); ++i) {
|
|
|
+ if (not Internals < T, U, V >::get(i).is_null()) {
|
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
|
<< utils::TraceElement < utils::DoubleTime >("KERNEL", t,
|
|
|
utils::KERNEL)
|
|
|
- << Internals < T, U >::name(i) << " = "
|
|
|
- << Internals < T, U >::get(i).to_string(
|
|
|
+ << Internals < T, U, V >::name(i) << " = "
|
|
|
+ << Internals < T, U, V >::get(i).to_string(
|
|
|
dynamic_cast < const T* >(this));
|
|
|
utils::Trace < utils::DoubleTime >::trace().flush();
|
|
|
}
|
|
@@ -116,13 +116,13 @@ public:
|
|
|
<< "BEFORE - "
|
|
|
<< AbstractCoupledModel < T, U, V, W >::path(this);
|
|
|
utils::Trace < utils::DoubleTime >::trace().flush();
|
|
|
- for (size_t i = 0; i < Internals < T, U >::size(); ++i) {
|
|
|
- if (not Internals < T, U >::get(i).is_null()) {
|
|
|
+ for (size_t i = 0; i < Internals < T, U, V >::size(); ++i) {
|
|
|
+ if (not Internals < T, U, V >::get(i).is_null()) {
|
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
|
<< utils::TraceElement < utils::DoubleTime >("KERNEL", t,
|
|
|
utils::KERNEL)
|
|
|
- << Internals < T, U >::name(i) << " = "
|
|
|
- << Internals < T, U >::get(i).to_string(
|
|
|
+ << Internals < T, U, V >::name(i) << " = "
|
|
|
+ << Internals < T, U, V >::get(i).to_string(
|
|
|
dynamic_cast < const T* >(this));
|
|
|
utils::Trace < utils::DoubleTime >::trace().flush();
|
|
|
}
|
|
@@ -141,7 +141,7 @@ public:
|
|
|
{ }
|
|
|
|
|
|
virtual bool check(typename U::type t) const
|
|
|
- { return Externals < T, U >::check(t); }
|
|
|
+ { return Externals < T, U, V >::check(t); }
|
|
|
|
|
|
virtual void compute(typename U::type t, bool update) = 0;
|
|
|
|
|
@@ -154,7 +154,7 @@ public:
|
|
|
if (type::last_time != t) {
|
|
|
throw utils::InvalidGet("Variable not computed");
|
|
|
}
|
|
|
- return Internals < T, U >::get(index);
|
|
|
+ return Internals < T, U, V >::get(index);
|
|
|
} else {
|
|
|
return it->second.first->get(t, it->second.second);
|
|
|
}
|
|
@@ -170,7 +170,7 @@ public:
|
|
|
if (type::last_time != t) {
|
|
|
throw utils::InvalidGet("Variable not computed");
|
|
|
}
|
|
|
- const Any& value = Internals < T, U >::get(index);
|
|
|
+ const Any& value = Internals < T, U, V >::get(index);
|
|
|
|
|
|
return static_cast < const T* >(this)->*(value.get < T, Z >());
|
|
|
} else {
|
|
@@ -189,7 +189,7 @@ public:
|
|
|
submodel_internals.find(index);
|
|
|
|
|
|
if (it == submodel_internals.end()) {
|
|
|
- Any value = Internals < T, U >::get(index);
|
|
|
+ Any value = Internals < T, U, V >::get(index);
|
|
|
|
|
|
switch (value_type) {
|
|
|
case DOUBLE:
|
|
@@ -240,7 +240,7 @@ public:
|
|
|
}
|
|
|
|
|
|
virtual bool is_updated() const
|
|
|
- { return Externals < T, U >::updated; }
|
|
|
+ { return Externals < T, U, V >::updated; }
|
|
|
|
|
|
virtual const Node < U >* get_submodel(unsigned int index) const
|
|
|
{
|
|
@@ -314,8 +314,9 @@ public:
|
|
|
it->second->restore(state.get_substate(it->first));
|
|
|
++it;
|
|
|
}
|
|
|
- States < T, U >::restore(state);
|
|
|
- Internals < T, U >::restore(state);
|
|
|
+ States < T, U, V >::restore(this, state);
|
|
|
+ Internals < T, U, V >::restore(this, state);
|
|
|
+ Externals < T, U, V >::restore(this, state);
|
|
|
}
|
|
|
|
|
|
virtual void save(context::State < U >& state) const
|
|
@@ -330,12 +331,13 @@ public:
|
|
|
state.add_substate(it->first, substate);
|
|
|
++it;
|
|
|
}
|
|
|
- States < T, U >::save(state);
|
|
|
- Internals < T, U >::save(state);
|
|
|
+ States < T, U, V >::save(this, state);
|
|
|
+ Internals < T, U, V >::save(this, state);
|
|
|
+ Externals < T, U, V >::save(this, state);
|
|
|
}
|
|
|
|
|
|
virtual void stable()
|
|
|
- { Externals < T, U >::updated = false; }
|
|
|
+ { Externals < T, U, V >::updated = false; }
|
|
|
|
|
|
void submodel(unsigned int index, type* model)
|
|
|
{
|
|
@@ -348,23 +350,23 @@ public:
|
|
|
}
|
|
|
|
|
|
protected:
|
|
|
- void change_internal(unsigned int index, double T::* var)
|
|
|
- {
|
|
|
- submodel_internals.erase(index);
|
|
|
- Internals < T, U >::internal(index, var);
|
|
|
- }
|
|
|
-
|
|
|
- void change_internal(unsigned int index, int T::* var)
|
|
|
- {
|
|
|
- submodel_internals.erase(index);
|
|
|
- Internals < T, U >::internalI(index, var);
|
|
|
- }
|
|
|
-
|
|
|
- void change_internal(unsigned int index, bool T::* var)
|
|
|
- {
|
|
|
- submodel_internals.erase(index);
|
|
|
- Internals < T, U >::internalB(index, var);
|
|
|
- }
|
|
|
+ // void change_internal(unsigned int index, double T::* var)
|
|
|
+ // {
|
|
|
+ // submodel_internals.erase(index);
|
|
|
+ // Internals < T, U, V >::internal(index, var);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // void change_internal(unsigned int index, int T::* var)
|
|
|
+ // {
|
|
|
+ // submodel_internals.erase(index);
|
|
|
+ // Internals < T, U, V >::internalI(index, var);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // void change_internal(unsigned int index, bool T::* var)
|
|
|
+ // {
|
|
|
+ // submodel_internals.erase(index);
|
|
|
+ // Internals < T, U, V >::internalB(index, var);
|
|
|
+ // }
|
|
|
|
|
|
void internal_(unsigned int index, type* model, int sub_index)
|
|
|
{
|