|
@@ -49,6 +49,11 @@ class AbstractCoupledModel : public AbstractModel < U, V >,
|
|
typedef std::map < int, std::pair < type*,
|
|
typedef std::map < int, std::pair < type*,
|
|
int > > SubModelInternals;
|
|
int > > SubModelInternals;
|
|
|
|
|
|
|
|
+#ifdef WITH_TRACE
|
|
|
|
+ template < typename T, typename U, typename V, typename W >
|
|
|
|
+ friend class Simulator;
|
|
|
|
+#endif
|
|
|
|
+
|
|
public:
|
|
public:
|
|
struct Var
|
|
struct Var
|
|
{
|
|
{
|
|
@@ -70,6 +75,7 @@ public:
|
|
#ifdef WITH_TRACE
|
|
#ifdef WITH_TRACE
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
|
|
+ true,
|
|
boost::core::demangle(typeid(T).name()).erase(0,6),
|
|
boost::core::demangle(typeid(T).name()).erase(0,6),
|
|
utils::DoubleTime::null,
|
|
utils::DoubleTime::null,
|
|
utils::CONSTRUCT);
|
|
utils::CONSTRUCT);
|
|
@@ -80,7 +86,7 @@ public:
|
|
virtual ~AbstractCoupledModel()
|
|
virtual ~AbstractCoupledModel()
|
|
{
|
|
{
|
|
#ifdef WITH_TRACE
|
|
#ifdef WITH_TRACE
|
|
- trace_element(utils::DoubleTime::null,
|
|
|
|
|
|
+ trace_element(true, utils::DoubleTime::null,
|
|
utils::DESTRUCT);
|
|
utils::DESTRUCT);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
@@ -89,8 +95,8 @@ public:
|
|
{
|
|
{
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
#ifdef WITH_TRACE
|
|
- trace_element(t, utils::AFTER_COMPUTE);
|
|
|
|
- trace_internals(t, utils::AFTER_COMPUTE);
|
|
|
|
|
|
+ trace_element(true, t, utils::AFTER_COMPUTE);
|
|
|
|
+ trace_internals(true, t, utils::AFTER_COMPUTE);
|
|
#else
|
|
#else
|
|
(void) t;
|
|
(void) t;
|
|
#endif
|
|
#endif
|
|
@@ -113,9 +119,9 @@ public:
|
|
{
|
|
{
|
|
|
|
|
|
#ifdef WITH_TRACE
|
|
#ifdef WITH_TRACE
|
|
- trace_element(t, utils::BEFORE_COMPUTE);
|
|
|
|
- trace_internals(t, utils::BEFORE_COMPUTE);
|
|
|
|
- trace_externals(t, utils::BEFORE_COMPUTE);
|
|
|
|
|
|
+ trace_element(true, t, utils::BEFORE_COMPUTE);
|
|
|
|
+ trace_internals(true, t, utils::BEFORE_COMPUTE);
|
|
|
|
+ trace_externals(true, t, utils::BEFORE_COMPUTE);
|
|
#else
|
|
#else
|
|
(void) t;
|
|
(void) t;
|
|
#endif
|
|
#endif
|
|
@@ -324,22 +330,50 @@ public:
|
|
Externals < T, U, V >::save(this, state);
|
|
Externals < T, U, V >::save(this, state);
|
|
}
|
|
}
|
|
|
|
|
|
- virtual void trace_element(typename U::type t, utils::TraceType type = utils::KERNEL, std::string comment = "") const
|
|
|
|
|
|
+ virtual void stable()
|
|
|
|
+ { Externals < T, U, V >::updated = false; }
|
|
|
|
+
|
|
|
|
+ void submodel(unsigned int index, type* model)
|
|
|
|
+ {
|
|
|
|
+ if (model) {
|
|
|
|
+ submodels[index] = model;
|
|
|
|
+ model->set_parent(this);
|
|
|
|
+ } else {
|
|
|
|
+ submodels[index] = 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ virtual void trace_element(typename U::type t, utils::TraceType type = utils::NONE, std::string comment = "") const
|
|
|
|
+ {trace_element(false, t, type, comment);}
|
|
|
|
+
|
|
|
|
+ virtual void trace_internals(typename U::type t, utils::TraceType type) const
|
|
|
|
+ {trace_internals(false, t, type);}
|
|
|
|
+
|
|
|
|
+ virtual void trace_externals(typename U::type t, utils::TraceType type = utils::NONE) const
|
|
|
|
+ {trace_externals(false, t, type);}
|
|
|
|
+
|
|
|
|
+ virtual void trace_model(typename U::type t, utils::TraceType type = utils::NONE) const
|
|
|
|
+ {trace_model(false, t, type);}
|
|
|
|
+
|
|
|
|
+private:
|
|
|
|
+ void trace_element(bool from_kernel, typename U::type t, utils::TraceType type = utils::NONE, std::string comment = "") const
|
|
{
|
|
{
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
|
|
+ from_kernel,
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
t, type)
|
|
t, type)
|
|
<< comment;
|
|
<< comment;
|
|
utils::Trace < utils::DoubleTime >::trace().flush();
|
|
utils::Trace < utils::DoubleTime >::trace().flush();
|
|
}
|
|
}
|
|
|
|
|
|
- virtual void trace_internals(typename U::type t, utils::TraceType type) const
|
|
|
|
|
|
+ void trace_internals(bool from_kernel, typename U::type t, utils::TraceType type) const
|
|
{
|
|
{
|
|
for (size_t i = 0; i < Internals < T, U, V >::size(); ++i) {
|
|
for (size_t i = 0; i < Internals < T, U, V >::size(); ++i) {
|
|
if (not Internals < T, U, V >::get(i).is_null()) {
|
|
if (not Internals < T, U, V >::get(i).is_null()) {
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
|
|
+ from_kernel,
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
t, type)
|
|
t, type)
|
|
<< utils::KernelInfo(
|
|
<< utils::KernelInfo(
|
|
@@ -352,12 +386,13 @@ public:
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- virtual void trace_externals(typename U::type t, utils::TraceType type = utils::KERNEL) const
|
|
|
|
|
|
+ void trace_externals(bool from_kernel, typename U::type t, utils::TraceType type = utils::NONE) const
|
|
{
|
|
{
|
|
for (size_t i = 0; i < Externals < T, U, V >::size(); ++i) {
|
|
for (size_t i = 0; i < Externals < T, U, V >::size(); ++i) {
|
|
if (not Externals < T, U, V >::get(i).is_null()) {
|
|
if (not Externals < T, U, V >::get(i).is_null()) {
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
|
|
+ from_kernel,
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
t, type)
|
|
t, type)
|
|
<< utils::KernelInfo(
|
|
<< utils::KernelInfo(
|
|
@@ -370,32 +405,18 @@ public:
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- virtual void trace_model(typename U::type t, utils::TraceType type = utils::KERNEL) const
|
|
|
|
|
|
+ void trace_model(bool from_kernel, typename U::type t, utils::TraceType type = utils::NONE) const
|
|
{
|
|
{
|
|
- trace_element(t, type);
|
|
|
|
- trace_internals(t, type);
|
|
|
|
- trace_externals(t, type);
|
|
|
|
|
|
+ trace_element(from_kernel, t, type);
|
|
|
|
+ trace_internals(from_kernel, t, type);
|
|
|
|
+ trace_externals(from_kernel, t, type);
|
|
typename AbstractCoupledModel::Submodels::const_iterator it =
|
|
typename AbstractCoupledModel::Submodels::const_iterator it =
|
|
submodels.begin();
|
|
submodels.begin();
|
|
|
|
|
|
- while (it != submodels.end()) {
|
|
|
|
- it->second->trace_model(t, type);
|
|
|
|
- ++it;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- virtual void stable()
|
|
|
|
- { Externals < T, U, V >::updated = false; }
|
|
|
|
-
|
|
|
|
- void submodel(unsigned int index, type* model)
|
|
|
|
- {
|
|
|
|
- if (model) {
|
|
|
|
- submodels[index] = model;
|
|
|
|
- model->set_parent(this);
|
|
|
|
- } else {
|
|
|
|
- submodels[index] = 0;
|
|
|
|
- }
|
|
|
|
|
|
+// while (it != submodels.end()) {
|
|
|
|
+// it->second->trace_model(from_kernel, t, type);
|
|
|
|
+// ++it;
|
|
|
|
+// }
|
|
}
|
|
}
|
|
|
|
|
|
protected:
|
|
protected:
|
|
@@ -425,6 +446,7 @@ protected:
|
|
#ifdef WITH_TRACE
|
|
#ifdef WITH_TRACE
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
|
|
+ true,
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
utils::DoubleTime::null,
|
|
utils::DoubleTime::null,
|
|
utils::INTERNAL_LINK)
|
|
utils::INTERNAL_LINK)
|
|
@@ -448,6 +470,7 @@ protected:
|
|
#ifdef WITH_TRACE
|
|
#ifdef WITH_TRACE
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
|
|
+ true,
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
utils::DoubleTime::null,
|
|
utils::DoubleTime::null,
|
|
utils::INTERNAL_LINK)
|
|
utils::INTERNAL_LINK)
|
|
@@ -472,6 +495,7 @@ protected:
|
|
#ifdef WITH_TRACE
|
|
#ifdef WITH_TRACE
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
|
|
+ true,
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
utils::DoubleTime::null,
|
|
utils::DoubleTime::null,
|
|
utils::SUBMODEL_ADD)
|
|
utils::SUBMODEL_ADD)
|
|
@@ -494,6 +518,7 @@ protected:
|
|
#ifdef WITH_TRACE
|
|
#ifdef WITH_TRACE
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
utils::Trace < utils::DoubleTime >::trace()
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
<< utils::TraceElement < utils::DoubleTime >(
|
|
|
|
+ true,
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
AbstractCoupledModel < T, U, V, W >::path(this),
|
|
utils::DoubleTime::null,
|
|
utils::DoubleTime::null,
|
|
utils::SUBMODEL_ADD)
|
|
utils::SUBMODEL_ADD)
|