Quellcode durchsuchen

New coding style

Eric Ramat vor 5 Jahren
Ursprung
Commit
730907bc6b

Datei-Diff unterdrückt, da er zu groß ist
+ 2377 - 2314
src/tests/catch.hpp


+ 10 - 12
src/tests/common/multithreading-tests.cpp

@@ -30,20 +30,18 @@
 
 using namespace artis::common;
 
-TEST_CASE("message queue", "multithreading")
-{
-    MessageQueue queue;
-    int msg;
+TEST_CASE("message queue", "multithreading") {
+  MessageQueue queue;
+  int msg;
 
-    queue.push(msg);
-    REQUIRE(true);
+  queue.push(msg);
+  REQUIRE(true);
 }
 
-TEST_CASE("sender", "multithreading")
-{
-    Sender sender;
-    int msg;
+TEST_CASE("sender", "multithreading") {
+  Sender sender;
+  int msg;
 
-    sender.send(msg);
-    REQUIRE(true);
+  sender.send(msg);
+  REQUIRE(true);
 }

+ 23 - 26
src/tests/common/time-tests.cpp

@@ -34,37 +34,34 @@
 
 using namespace artis::common;
 
-TEST_CASE("double time", "common")
-{
-    artis::common::DoubleTime::type t1 = 0;
-    artis::common::DoubleTime::type t2 = artis::common::DoubleTime::infinity;
+TEST_CASE("double time", "common") {
+  artis::common::DoubleTime::type t1 = 0;
+  artis::common::DoubleTime::type t2 = artis::common::DoubleTime::infinity;
 
-    REQUIRE(t1 != artis::common::DoubleTime::infinity);
-    REQUIRE(t1 == artis::common::DoubleTime::null);
-    REQUIRE(t2 == artis::common::DoubleTime::infinity);
-    REQUIRE(t2 != artis::common::DoubleTime::null);
+  REQUIRE(t1 != artis::common::DoubleTime::infinity);
+  REQUIRE(t1 == artis::common::DoubleTime::null);
+  REQUIRE(t2 == artis::common::DoubleTime::infinity);
+  REQUIRE(t2 != artis::common::DoubleTime::null);
 }
 
-TEST_CASE("integer time", "common")
-{
-    artis::common::IntegerTime::type t1 = 0;
-    artis::common::IntegerTime::type t2 = artis::common::IntegerTime::infinity;
+TEST_CASE("integer time", "common") {
+  artis::common::IntegerTime::type t1 = 0;
+  artis::common::IntegerTime::type t2 = artis::common::IntegerTime::infinity;
 
-    REQUIRE(t1 != artis::common::IntegerTime::infinity);
-    REQUIRE(t1 == artis::common::IntegerTime::null);
-    REQUIRE(t2 == artis::common::IntegerTime::infinity);
-    REQUIRE(t2 != artis::common::IntegerTime::null);
+  REQUIRE(t1 != artis::common::IntegerTime::infinity);
+  REQUIRE(t1 == artis::common::IntegerTime::null);
+  REQUIRE(t2 == artis::common::IntegerTime::infinity);
+  REQUIRE(t2 != artis::common::IntegerTime::null);
 }
 
-TEST_CASE("rational time", "common")
-{
-    artis::common::RationalTime::type t1 = 0;
-    artis::common::RationalTime::type t2 = artis::common::RationalTime::infinity;
+TEST_CASE("rational time", "common") {
+  artis::common::RationalTime::type t1 = 0;
+  artis::common::RationalTime::type t2 = artis::common::RationalTime::infinity;
 
-    REQUIRE(t1 != artis::common::RationalTime::infinity);
-    REQUIRE(t1 == artis::common::RationalTime::null);
-    REQUIRE(t2 == artis::common::RationalTime::infinity);
-    REQUIRE(t2 != artis::common::RationalTime::null);
-    REQUIRE(t1 + 1 == 1);
-    REQUIRE(t1 + artis::common::RationalTime::type(1, 2) == artis::common::RationalTime::type(1, 2));
+  REQUIRE(t1 != artis::common::RationalTime::infinity);
+  REQUIRE(t1 == artis::common::RationalTime::null);
+  REQUIRE(t2 == artis::common::RationalTime::infinity);
+  REQUIRE(t2 != artis::common::RationalTime::null);
+  REQUIRE(t1 + 1 == 1);
+  REQUIRE(t1 + artis::common::RationalTime::type(1, 2) == artis::common::RationalTime::type(1, 2));
 }

+ 40 - 42
src/tests/devs/graph_manager.hpp

@@ -34,56 +34,54 @@
 #include <artis-star/kernel/devs/Simulator.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace devs {
+namespace tests {
+namespace devs {
 
-            class FlatGraphManager :
-                    public artis::devs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    FirstA, SecondA,
-                    FirstB, SecondB
-                };
+class FlatGraphManager :
+    public artis::devs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    FirstA, SecondA,
+    FirstB, SecondB
+  };
 
-                FlatGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::devs::GraphManager<common::DoubleTime>(coordinator, parameters,
-                                graph_parameters),
-                        a1("a1", parameters), b1("b1", parameters),
-                        a2("a2", parameters), b2("b2", parameters)
-                {
-                    add_child(FirstA, &a1);
-                    add_child(FirstB, &b1);
-                    add_child(SecondA, &a2);
-                    add_child(SecondB, &b2);
+  FlatGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                   const artis::common::NoParameters &parameters,
+                   const artis::common::NoParameters &graph_parameters)
+      :
+      artis::devs::GraphManager<common::DoubleTime>(coordinator, parameters,
+                                                    graph_parameters),
+      a1("a1", parameters), b1("b1", parameters),
+      a2("a2", parameters), b2("b2", parameters) {
+    add_child(FirstA, &a1);
+    add_child(FirstB, &b1);
+    add_child(SecondA, &a2);
+    add_child(SecondB, &b2);
 
-                    add_link(&a1, &b1);
-                    add_link(&b1, &a2);
-                    add_link(&a2, &b2);
-                }
+    add_link(&a1, &b1);
+    add_link(&b1, &a2);
+    add_link(&a2, &b2);
+  }
 
-                ~FlatGraphManager() override = default;
+  ~FlatGraphManager() override = default;
 
-            private:
-                artis::devs::Simulator<common::DoubleTime, A> a1;
-                artis::devs::Simulator<common::DoubleTime, B> b1;
-                artis::devs::Simulator<common::DoubleTime, A> a2;
-                artis::devs::Simulator<common::DoubleTime, B> b2;
-            };
+private:
+  artis::devs::Simulator<common::DoubleTime, A> a1;
+  artis::devs::Simulator<common::DoubleTime, B> b1;
+  artis::devs::Simulator<common::DoubleTime, A> a2;
+  artis::devs::Simulator<common::DoubleTime, B> b2;
+};
 
-            class Select {
-            public:
-                Select() = default;
+class Select {
+public:
+  Select() = default;
 
-                common::Model<common::DoubleTime>*
-                operator()(const common::Models<common::DoubleTime>& list) const
-                { return list.at(0); }
-            };
+  common::Model<common::DoubleTime> *
+  operator()(const common::Models<common::DoubleTime> &list) const { return list.at(0); }
+};
 
-        }
-    }
+}
+}
 } // namespace artis tests devs
 
 #endif

+ 197 - 209
src/tests/devs/models.hpp

@@ -36,298 +36,286 @@
 #include <iostream>
 
 namespace artis {
-    namespace tests {
-        namespace devs {
+namespace tests {
+namespace devs {
 
-            struct data {
-                double x;
-                double y;
+struct data {
+  double x;
+  double y;
 
-                data()
-                        :x(0), y(0) { }
+  data()
+      : x(0), y(0) {}
 
-                data(double _x, double _y)
-                        :x(_x), y(_y) { }
-            };
+  data(double _x, double _y)
+      : x(_x), y(_y) {}
+};
 
-            class A : public artis::devs::Dynamics<common::DoubleTime, A> {
-            public:
-                A(const std::string& name,
-                        const artis::devs::Context<common::DoubleTime, A, artis::common::NoParameters>& context)
-                        :
-                        artis::devs::Dynamics<common::DoubleTime, A>(name, context)
-                {
-                }
+class A : public artis::devs::Dynamics<common::DoubleTime, A> {
+public:
+  A(const std::string &name,
+    const artis::devs::Context<common::DoubleTime, A, artis::common::NoParameters> &context)
+      :
+      artis::devs::Dynamics<common::DoubleTime, A>(name, context) {
+  }
 
-                ~A() override = default;
+  ~A() override = default;
 
-                void dint(typename common::DoubleTime::type t) override
-                {
+  void dint(typename common::DoubleTime::type t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #else
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DEVS,
-                                    common::FunctionType::DELTA_INT,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DEVS,
+                                                    common::FunctionType::DELTA_INT,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == WAIT) {
-                        ++_value.x;
-                        --_value.y;
-                        _phase = SEND;
-                    } else if (_phase == SEND) {
-                        _phase = WAIT;
-                    }
-                }
+    if (_phase == WAIT) {
+      ++_value.x;
+      --_value.y;
+      _phase = SEND;
+    } else if (_phase == SEND) {
+      _phase = WAIT;
+    }
+  }
 
-                void
-                dext(typename common::DoubleTime::type t, typename common::DoubleTime::type /* e */,
-                        const common::ExternalEvent<common::DoubleTime>& msg) override
-                {
+  void
+  dext(typename common::DoubleTime::type t, typename common::DoubleTime::type /* e */,
+       const common::ExternalEvent<common::DoubleTime> &msg) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)msgs;
+    (void)t;
+    (void)msgs;
 #else
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DEVS,
-                                    common::FunctionType::DELTA_EXT,
-                                    common::LevelType::USER)
-                            << "event = " << msg.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DEVS,
+                                                    common::FunctionType::DELTA_EXT,
+                                                    common::LevelType::USER)
+        << "event = " << msg.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = SEND;
-                }
+    _phase = SEND;
+  }
 
-                void start(typename common::DoubleTime::type t) override
-                {
+  void start(typename common::DoubleTime::type t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #else
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DEVS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DEVS,
+                                                    common::FunctionType::START,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = SEND;
-                }
+    _phase = SEND;
+  }
 
-                typename common::DoubleTime::type
-                ta(typename common::DoubleTime::type t) const override
-                {
+  typename common::DoubleTime::type
+  ta(typename common::DoubleTime::type t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #else
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DEVS,
-                                    common::FunctionType::TA,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DEVS,
+                                                    common::FunctionType::TA,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == WAIT) {
-                        return 1;
-                    } else {
-                        return 0;
-                    }
-                }
+    if (_phase == WAIT) {
+      return 1;
+    } else {
+      return 0;
+    }
+  }
 
-                common::ExternalEvent<common::DoubleTime>
-                lambda(typename common::DoubleTime::type t) const override
-                {
+  common::ExternalEvent<common::DoubleTime>
+  lambda(typename common::DoubleTime::type t) const override {
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
-                    if (_phase == SEND) {
-                        artis::common::ExternalEvent<common::DoubleTime> msg(_value);
+    if (_phase == SEND) {
+      artis::common::ExternalEvent<common::DoubleTime> msg(_value);
 
 #ifdef WITH_TRACE
-                        common::Trace<common::DoubleTime>::trace()
-                                << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                        common::FormalismType::DEVS,
-                                        common::FunctionType::LAMBDA,
-                                        common::LevelType::USER)
-                                << "event = " << msg.to_string();
-                        common::Trace<common::DoubleTime>::trace().flush();
+      common::Trace<common::DoubleTime>::trace()
+          << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                      common::FormalismType::DEVS,
+                                                      common::FunctionType::LAMBDA,
+                                                      common::LevelType::USER)
+          << "event = " << msg.to_string();
+      common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                        return msg;
-                    } else {
+      return msg;
+    } else {
 
 #ifdef WITH_TRACE
-                        common::Trace<common::DoubleTime>::trace()
-                                << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                        common::FormalismType::DEVS,
-                                        common::FunctionType::LAMBDA,
-                                        common::LevelType::USER)
-                                << "no event";
-                        common::Trace<common::DoubleTime>::trace().flush();
+      common::Trace<common::DoubleTime>::trace()
+          << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                      common::FormalismType::DEVS,
+                                                      common::FunctionType::LAMBDA,
+                                                      common::LevelType::USER)
+          << "no event";
+      common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                        return artis::common::ExternalEvent<common::DoubleTime>::Void;
-                    }
-                }
+      return artis::common::ExternalEvent<common::DoubleTime>::Void;
+    }
+  }
 
-            private:
-                enum Phase {
-                    WAIT, SEND
-                };
+private:
+  enum Phase {
+    WAIT, SEND
+  };
 
-                Phase _phase;
-                data _value;
-            };
+  Phase _phase;
+  data _value;
+};
 
-            class B : public artis::devs::Dynamics<common::DoubleTime, B> {
-            public:
-                B(const std::string& name,
-                        const artis::devs::Context<common::DoubleTime, B, artis::common::NoParameters>& context)
-                        :
-                        artis::devs::Dynamics<common::DoubleTime, B>(name, context),
-                        _value(0)
-                {
-                }
+class B : public artis::devs::Dynamics<common::DoubleTime, B> {
+public:
+  B(const std::string &name,
+    const artis::devs::Context<common::DoubleTime, B, artis::common::NoParameters> &context)
+      :
+      artis::devs::Dynamics<common::DoubleTime, B>(name, context),
+      _value(0) {
+  }
 
-                ~B() override = default;
+  ~B() override = default;
 
-                void dint(typename common::DoubleTime::type t) override
-                {
+  void dint(typename common::DoubleTime::type t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #else
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DEVS,
-                                    common::FunctionType::DELTA_INT,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DEVS,
+                                                    common::FunctionType::DELTA_INT,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == SEND) {
-                        _phase = WAIT;
-                    }
-                }
+    if (_phase == SEND) {
+      _phase = WAIT;
+    }
+  }
 
-                void
-                dext(typename common::DoubleTime::type t, typename common::DoubleTime::type /* e */,
-                        const common::ExternalEvent<common::DoubleTime>& msg) override
-                {
+  void
+  dext(typename common::DoubleTime::type t, typename common::DoubleTime::type /* e */,
+       const common::ExternalEvent<common::DoubleTime> &msg) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)msgs;
+    (void)t;
+    (void)msgs;
 #else
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DEVS,
-                                    common::FunctionType::DELTA_EXT,
-                                    common::LevelType::USER)
-                            << "event = " << msg.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DEVS,
+                                                    common::FunctionType::DELTA_EXT,
+                                                    common::LevelType::USER)
+        << "event = " << msg.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = SEND;
-                }
+    _phase = SEND;
+  }
 
-                void start(typename common::DoubleTime::type t) override
-                {
+  void start(typename common::DoubleTime::type t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #else
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DEVS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DEVS,
+                                                    common::FunctionType::START,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = WAIT;
-                }
+    _phase = WAIT;
+  }
 
-                typename common::DoubleTime::type ta(
-                        typename common::DoubleTime::type t) const override
-                {
+  typename common::DoubleTime::type ta(
+      typename common::DoubleTime::type t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #else
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DEVS,
-                                    common::FunctionType::TA,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DEVS,
+                                                    common::FunctionType::TA,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == WAIT) {
-                        return common::DoubleTime::infinity;
-                    } else {
-                        return 0;
-                    }
-                }
+    if (_phase == WAIT) {
+      return common::DoubleTime::infinity;
+    } else {
+      return 0;
+    }
+  }
 
-                common::ExternalEvent<common::DoubleTime> lambda(
-                        typename common::DoubleTime::type t) const override
-                {
+  common::ExternalEvent<common::DoubleTime> lambda(
+      typename common::DoubleTime::type t) const override {
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
-                    if (_phase == SEND) {
-                        artis::common::ExternalEvent<common::DoubleTime> msg(_value);
+    if (_phase == SEND) {
+      artis::common::ExternalEvent<common::DoubleTime> msg(_value);
 
 #ifdef WITH_TRACE
-                        common::Trace<common::DoubleTime>::trace()
-                                << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                        common::FormalismType::DEVS,
-                                        common::FunctionType::LAMBDA,
-                                        common::LevelType::USER)
-                                << "event = " << msg.to_string();
-                        common::Trace<common::DoubleTime>::trace().flush();
+      common::Trace<common::DoubleTime>::trace()
+          << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                      common::FormalismType::DEVS,
+                                                      common::FunctionType::LAMBDA,
+                                                      common::LevelType::USER)
+          << "event = " << msg.to_string();
+      common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                        return msg;
-                    } else {
+      return msg;
+    } else {
 
 #ifdef WITH_TRACE
-                        common::Trace<common::DoubleTime>::trace()
-                                << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                        common::FormalismType::DEVS,
-                                        common::FunctionType::LAMBDA,
-                                        common::LevelType::USER)
-                                << "no event";
-                        common::Trace<common::DoubleTime>::trace().flush();
+      common::Trace<common::DoubleTime>::trace()
+          << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                      common::FormalismType::DEVS,
+                                                      common::FunctionType::LAMBDA,
+                                                      common::LevelType::USER)
+          << "no event";
+      common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                        return artis::common::ExternalEvent<common::DoubleTime>::Void;
-                    }
-                }
+      return artis::common::ExternalEvent<common::DoubleTime>::Void;
+    }
+  }
 
-            private:
-                enum Phase {
-                    WAIT, SEND
-                };
+private:
+  enum Phase {
+    WAIT, SEND
+  };
 
-                Phase _phase;
-                double _value;
-            };
+  Phase _phase;
+  double _value;
+};
 
-        }
-    }
+}
+}
 } // namespace artis tests devs
 
 #endif

+ 116 - 117
src/tests/devs/tests.cpp

@@ -36,135 +36,134 @@
 using namespace artis::tests::devs;
 using namespace artis::common;
 
-TEST_CASE("devs/flat", "run")
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
-    artis::common::RootCoordinator<
-            DoubleTime, artis::devs::Coordinator<
-                    DoubleTime,
-                    FlatGraphManager,
-                    Select>
-    > rc(context, "root", artis::common::NoParameters(), artis::common::NoParameters());
-
-    artis::common::Trace<DoubleTime>::trace().clear();
-    rc.run(context);
-
-    std::cout << artis::common::Trace<DoubleTime>::trace().elements().filter_level_type(
-            LevelType::USER).to_string() << std::endl;
-
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
+TEST_CASE("devs/flat", "run") {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
+  artis::common::RootCoordinator<
+      DoubleTime, artis::devs::Coordinator<
+          DoubleTime,
+          FlatGraphManager,
+          Select>
+  > rc(context, "root", artis::common::NoParameters(), artis::common::NoParameters());
+
+  artis::common::Trace<DoubleTime>::trace().clear();
+  rc.run(context);
+
+  std::cout << artis::common::Trace<DoubleTime>::trace().elements().filter_level_type(
+      LevelType::USER).to_string() << std::endl;
+
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("b1").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("b2").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").
+      filter_function_type(artis::common::FunctionType::DELTA_EXT).empty());
+  // at t = 0
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").filter_time(0).
+      filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").filter_time(0).
+      filter_function_type(artis::common::FunctionType::TA).size() == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").filter_time(0).
+      filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+
+  // at t > 0
+  for (unsigned int t = 1; t <= 10; ++t) {
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("b1").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
+        filter_model_name("a1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
+        filter_model_name("a1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("b2").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
+        filter_model_name("a1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::TA).size() == 2);
+  }
 
+  for (unsigned int t = 0; t <= 10; ++t) {
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").
-            filter_function_type(artis::common::FunctionType::DELTA_EXT).empty());
-    // at t = 0
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").filter_time(0).
-            filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
+        filter_model_name("b1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").filter_time(0).
-            filter_function_type(artis::common::FunctionType::TA).size() == 2);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").filter_time(0).
-            filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-
-    // at t > 0
-    for (unsigned int t = 1; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::TA).size() == 2);
-    }
-
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
-        if (t == 0) {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b1").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 3);
-        } else {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b1").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 2);
-        }
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+        filter_model_name("b1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
+    if (t == 0) {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b1").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 3);
+    } else {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b1").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 2);
     }
-
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_function_type(
-            artis::common::FunctionType::DELTA_CONF).empty());
-
-    // at t = 0
+        filter_model_name("b1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+  }
+
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_function_type(
+      artis::common::FunctionType::DELTA_CONF).empty());
+
+  // at t = 0
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::TA).size() == 4);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+
+  // at t > 0
+  for (unsigned int t = 1; t <= 10; ++t) {
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 3);
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 3);
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::TA).size() == 4);
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::TA).size() == 4);
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
-
-    // at t > 0
-    for (unsigned int t = 1; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 3);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 3);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::TA).size() == 4);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
-    }
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+  }
 
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
-        if (t == 0) {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b2").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 5);
-        } else {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b2").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 4);
-        }
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 2);
+  for (unsigned int t = 0; t <= 10; ++t) {
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
+    if (t == 0) {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b2").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 5);
+    } else {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b2").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 4);
     }
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 2);
+  }
 }

+ 105 - 104
src/tests/dsde/graph_manager.hpp

@@ -34,135 +34,136 @@
 #include <tests/dsde/models.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace dsde {
-
-            class FlatGraphManager :
-                    public artis::dsde::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    BEEP = 1
-                };
-
-                FlatGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::dsde::GraphManager<common::DoubleTime>(coordinator, parameters,
-                                graph_parameters),
-                        _beep("beep", parameters)
-                {
-                    add_child(BEEP, &_beep);
-                }
-
-                ~FlatGraphManager() override = default;
-
-            private:
-                artis::pdevs::Simulator<common::DoubleTime, Beep> _beep;
-            };
-
-            class Executive :
-                    public artis::dsde::Executive<common::DoubleTime, Executive> {
-            public:
-                Executive(
-                        const artis::dsde::ExecutiveContext<common::DoubleTime, Executive, artis::common::NoParameters, artis::common::NoParameters>& context,
-                        artis::dsde::GraphManager<common::DoubleTime, artis::common::NoParameters, artis::common::NoParameters>& graph_manager)
-                        :
-                        artis::dsde::Executive<common::DoubleTime, Executive>(context,
-                                graph_manager), _index(0), _up(true) { }
-
-                ~Executive() override = default;
-
-                void dint(typename common::DoubleTime::type t) override
-                {
+namespace tests {
+namespace dsde {
+
+class FlatGraphManager :
+    public artis::dsde::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    BEEP = 1
+  };
+
+  FlatGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                   const artis::common::NoParameters &parameters,
+                   const artis::common::NoParameters &graph_parameters)
+      :
+      artis::dsde::GraphManager<common::DoubleTime>(coordinator, parameters,
+                                                    graph_parameters),
+      _beep("beep", parameters) {
+    add_child(BEEP, &_beep);
+  }
+
+  ~FlatGraphManager() override = default;
+
+private:
+  artis::pdevs::Simulator<common::DoubleTime, Beep> _beep;
+};
+
+class Executive :
+    public artis::dsde::Executive<common::DoubleTime, Executive> {
+public:
+  Executive(
+      const artis::dsde::ExecutiveContext<common::DoubleTime,
+                                          Executive,
+                                          artis::common::NoParameters,
+                                          artis::common::NoParameters> &context,
+      artis::dsde::GraphManager<common::DoubleTime,
+                                artis::common::NoParameters,
+                                artis::common::NoParameters> &graph_manager)
+      :
+      artis::dsde::Executive<common::DoubleTime, Executive>(context,
+                                                            graph_manager), _index(0), _up(true) {}
+
+  ~Executive() override = default;
+
+  void dint(typename common::DoubleTime::type t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DSDE,
-                                    common::FunctionType::DELTA_INT,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DSDE,
+                                                    common::FunctionType::DELTA_INT,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_up) {
-                        ++_index;
-                    } else {
-                        --_index;
-                    }
-                    if (_index == 4 and _up) {
-                        _up = false;
-                        --_index;
-                    }
-                    if (_up) {
-                        graph_manager().add_dynamic_child(_index,
-                                new artis::pdevs::Simulator<common::DoubleTime, Beep>(
-                                        "beep" + std::to_string(_index),
-                                        artis::common::NoParameters()));
-                        graph_manager().add_link(FlatGraphManager::BEEP, Beep::OUT, _index,
-                                Beep::IN);
-                    } else {
-                        if (_index == 3) {
-                            graph_manager().remove_dynamic_child(t, _index);
-                        } else if (_index == 2) {
-                            graph_manager().remove_link(FlatGraphManager::BEEP, Beep::OUT, _index,
+    if (_up) {
+      ++_index;
+    } else {
+      --_index;
+    }
+    if (_index == 4 and _up) {
+      _up = false;
+      --_index;
+    }
+    if (_up) {
+      graph_manager().add_dynamic_child(_index,
+                                        new artis::pdevs::Simulator<common::DoubleTime, Beep>(
+                                            "beep" + std::to_string(_index),
+                                            artis::common::NoParameters()));
+      graph_manager().add_link(FlatGraphManager::BEEP, Beep::OUT, _index,
+                               Beep::IN);
+    } else {
+      if (_index == 3) {
+        graph_manager().remove_dynamic_child(t, _index);
+      } else if (_index == 2) {
+        graph_manager().remove_link(FlatGraphManager::BEEP, Beep::OUT, _index,
                                     Beep::IN);
-                        }
-                    }
-                }
+      }
+    }
+  }
 
-                typename common::DoubleTime::type
-                start(typename common::DoubleTime::type t) override
-                {
+  typename common::DoubleTime::type
+  start(typename common::DoubleTime::type t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DSDE,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DSDE,
+                                                    common::FunctionType::START,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _index = 1;
-                    _up = true;
-                    return 1;
-                }
+    _index = 1;
+    _up = true;
+    return 1;
+  }
 
-                typename common::DoubleTime::type
-                ta(typename common::DoubleTime::type t) const override
-                {
+  typename common::DoubleTime::type
+  ta(typename common::DoubleTime::type t) const override {
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DSDE,
-                                    common::FunctionType::TA,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DSDE,
+                                                    common::FunctionType::TA,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    return 2;
-                }
+    return 2;
+  }
 
-            private:
-                int _index;
-                bool _up;
-            };
+private:
+  int _index;
+  bool _up;
+};
 
-        }
-    }
+}
+}
 } // namespace artis tests dsde
 
 #endif

+ 112 - 119
src/tests/dsde/models.hpp

@@ -37,176 +37,169 @@
 #include <tests/dsde/graph_manager.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace dsde {
-
-            class Beep :
-                    public artis::pdevs::Dynamics<common::DoubleTime, Beep> {
-            public:
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                Beep(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, Beep, artis::common::NoParameters>& context)
-                        :
-                        artis::pdevs::Dynamics<common::DoubleTime, Beep>(name, context), _value(0)
-                {
-                    input_ports({{IN, "in"}});
-                    output_ports({{OUT, "out"}});
-                }
-
-                ~Beep() override = default;
-
-                void dint(const typename common::DoubleTime::type& t) override
-                {
+namespace tests {
+namespace dsde {
+
+class Beep :
+    public artis::pdevs::Dynamics<common::DoubleTime, Beep> {
+public:
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  Beep(const std::string &name,
+       const artis::pdevs::Context<common::DoubleTime, Beep, artis::common::NoParameters> &context)
+      :
+      artis::pdevs::Dynamics<common::DoubleTime, Beep>(name, context), _value(0) {
+    input_ports({{IN, "in"}});
+    output_ports({{OUT, "out"}});
+  }
+
+  ~Beep() override = default;
+
+  void dint(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_INT,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_INT,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == SEND or _phase == INIT) {
-                        _phase = WAIT;
-                    }
-                }
+    if (_phase == SEND or _phase == INIT) {
+      _phase = WAIT;
+    }
+  }
 
-                void
-                dext(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& /* e */,
-                        const common::Bag<common::DoubleTime>& bag) override
-                {
+  void
+  dext(const typename common::DoubleTime::type &t,
+       const typename common::DoubleTime::type & /* e */,
+       const common::Bag <common::DoubleTime> &bag) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)bag;
+    (void)t;
+    (void)bag;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_EXT,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_EXT,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = SEND;
-                }
+    _phase = SEND;
+  }
 
-                void dconf(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& /* e */,
-                        const common::Bag<common::DoubleTime>& bag) override
-                {
+  void dconf(const typename common::DoubleTime::type &t,
+             const typename common::DoubleTime::type & /* e */,
+             const common::Bag <common::DoubleTime> &bag) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)bag;
+    (void)t;
+    (void)bag;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_CONF,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_CONF,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                }
+  }
 
-                void
-                start(const typename common::DoubleTime::type& t) override
-                {
+  void
+  start(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::START,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = INIT;
-                }
+    _phase = INIT;
+  }
 
-                typename common::DoubleTime::type
-                ta(const typename common::DoubleTime::type& t) const override
-                {
+  typename common::DoubleTime::type
+  ta(const typename common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::TA,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::TA,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == WAIT) {
-                        return (rand() % 10) / 2. + 1;
-                    } else {
-                        return 0;
-                    }
-                }
+    if (_phase == WAIT) {
+      return (rand() % 10) / 2. + 1;
+    } else {
+      return 0;
+    }
+  }
 
-                common::Bag<common::DoubleTime>
-                lambda(const typename common::DoubleTime::type& t) const override
-                {
+  common::Bag <common::DoubleTime>
+  lambda(const typename common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
-                    common::Bag<common::DoubleTime> bag;
+    common::Bag<common::DoubleTime> bag;
 
-                    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
+    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::LAMBDA,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::LAMBDA,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    return bag;
-                }
+    return bag;
+  }
 
-            private:
-                enum Phase {
-                    INIT, WAIT, SEND
-                };
+private:
+  enum Phase {
+    INIT, WAIT, SEND
+  };
 
-                Phase _phase;
-                double _value;
-            };
+  Phase _phase;
+  double _value;
+};
 
-        }
-    }
+}
+}
 } // namespace artis tests dsde
 
 #endif

+ 63 - 64
src/tests/dsde/tests.cpp

@@ -36,75 +36,74 @@
 using namespace artis::tests::dsde;
 using namespace artis::common;
 
-TEST_CASE("dsde/flat", "run")
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
-    artis::common::RootCoordinator<
-            DoubleTime, artis::dsde::Coordinator<
-                    DoubleTime,
-                    artis::tests::dsde::FlatGraphManager,
-                    artis::tests::dsde::Executive>
-    > rc(context, "root");
+TEST_CASE("dsde/flat", "run") {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
+  artis::common::RootCoordinator<
+      DoubleTime, artis::dsde::Coordinator<
+          DoubleTime,
+          artis::tests::dsde::FlatGraphManager,
+          artis::tests::dsde::Executive>
+  > rc(context, "root");
 
-    artis::common::Trace<DoubleTime>::trace().clear();
-    rc.run(context);
+  artis::common::Trace<DoubleTime>::trace().clear();
+  rc.run(context);
 
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep").filter_function_type(artis::common::FunctionType::START).filter_time(0).size()
-            == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep2").filter_function_type(artis::common::FunctionType::START).filter_time(1).size()
-            == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep3").filter_function_type(artis::common::FunctionType::START).filter_time(3).size()
-            == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep").filter_function_type(artis::common::FunctionType::START).filter_time(0).size()
+              == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep2").filter_function_type(artis::common::FunctionType::START).filter_time(1).size()
+              == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep3").filter_function_type(artis::common::FunctionType::START).filter_time(3).size()
+              == 1);
 
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep2").filter_function_type(artis::common::FunctionType::DELTA_INT).filter_time(
-            1).size()
-            == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep2").filter_function_type(artis::common::FunctionType::TA).filter_time(1).size()
-            == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep2").filter_function_type(artis::common::FunctionType::DELTA_INT).filter_time(
+      1).size()
+              == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep2").filter_function_type(artis::common::FunctionType::TA).filter_time(1).size()
+              == 2);
 
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep2").filter_function_type(artis::common::FunctionType::DELTA_INT).filter_time(
-            2.5).size()
-            == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep2").filter_function_type(artis::common::FunctionType::DELTA_EXT).filter_time(
-            2.5).size()
-            == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep2").filter_function_type(artis::common::FunctionType::TA).filter_time(2.5).size()
-            == 2);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep2").filter_function_type(artis::common::FunctionType::LAMBDA).filter_time(2.5).size()
-            == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep2").filter_function_type(artis::common::FunctionType::DELTA_INT).filter_time(
+      2.5).size()
+              == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep2").filter_function_type(artis::common::FunctionType::DELTA_EXT).filter_time(
+      2.5).size()
+              == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep2").filter_function_type(artis::common::FunctionType::TA).filter_time(2.5).size()
+              == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep2").filter_function_type(artis::common::FunctionType::LAMBDA).filter_time(2.5).size()
+              == 1);
 
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep2").filter_function_type(artis::common::FunctionType::DELTA_INT).filter_time(
-            6).size()
-            == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep2").filter_function_type(artis::common::FunctionType::TA).filter_time(6).size()
-            == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep2").filter_function_type(artis::common::FunctionType::LAMBDA).filter_time(6).size()
-            == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep2").filter_function_type(artis::common::FunctionType::DELTA_INT).filter_time(
+      6).size()
+              == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep2").filter_function_type(artis::common::FunctionType::TA).filter_time(6).size()
+              == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep2").filter_function_type(artis::common::FunctionType::LAMBDA).filter_time(6).size()
+              == 1);
 
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep3").filter_function_type(artis::common::FunctionType::DELTA_INT).filter_time(
-            3).size()
-            == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep3").filter_function_type(artis::common::FunctionType::TA).filter_time(3).size()
-            == 2);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep3").filter_function_type(artis::common::FunctionType::LAMBDA).filter_time(3).size()
-            == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep3").filter_function_type(artis::common::FunctionType::DELTA_INT).filter_time(
+      3).size()
+              == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep3").filter_function_type(artis::common::FunctionType::TA).filter_time(3).size()
+              == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep3").filter_function_type(artis::common::FunctionType::LAMBDA).filter_time(3).size()
+              == 1);
 
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
-            "beep3").filter_function_type(artis::common::FunctionType::FINISH).filter_time(5).size()
-            == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().filter_model_name(
+      "beep3").filter_function_type(artis::common::FunctionType::FINISH).filter_time(5).size()
+              == 1);
 }

+ 50 - 52
src/tests/dtss/graph_manager.hpp

@@ -34,71 +34,69 @@
 #include <artis-star/kernel/dtss/Simulator.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace dtss {
+namespace tests {
+namespace dtss {
 
-            class OnlyOneGraphManager :
-                    public artis::dtss::GraphManager<common::DoubleTime,
-                            artis::dtss::Parameters<common::DoubleTime>,
-                            artis::common::NoParameters> {
-            public:
-                enum submodels {
-                    OneA
-                };
+class OnlyOneGraphManager :
+    public artis::dtss::GraphManager<common::DoubleTime,
+                                     artis::dtss::Parameters<common::DoubleTime>,
+                                     artis::common::NoParameters> {
+public:
+  enum submodels {
+    OneA
+  };
 
-                OnlyOneGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::dtss::Parameters<common::DoubleTime>& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::dtss::GraphManager<common::DoubleTime,
+  OnlyOneGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                      const artis::dtss::Parameters<common::DoubleTime> &parameters,
+                      const artis::common::NoParameters &graph_parameters)
+      :
+      artis::dtss::GraphManager<common::DoubleTime,
                                 artis::dtss::Parameters<common::DoubleTime>,
                                 artis::common::NoParameters>(
-                                coordinator, parameters, graph_parameters),
-                        a("a", parameters)
-                {
-                    add_child(OneA, &a);
-                }
+          coordinator, parameters, graph_parameters),
+      a("a", parameters) {
+    add_child(OneA, &a);
+  }
 
-                ~OnlyOneGraphManager() override = default;
+  ~OnlyOneGraphManager() override = default;
 
-            private:
-                artis::dtss::Simulator<common::DoubleTime, A, artis::dtss::Parameters<common::DoubleTime>> a;
-            };
+private:
+  artis::dtss::Simulator<common::DoubleTime, A, artis::dtss::Parameters<common::DoubleTime>> a;
+};
 
-            class TwoGraphManager :
-                    public artis::dtss::GraphManager<common::DoubleTime,
-                            artis::dtss::Parameters<common::DoubleTime>,
-                            artis::common::NoParameters> {
-            public:
-                enum submodels {
-                    OneA, OneB
-                };
+class TwoGraphManager :
+    public artis::dtss::GraphManager<common::DoubleTime,
+                                     artis::dtss::Parameters<common::DoubleTime>,
+                                     artis::common::NoParameters> {
+public:
+  enum submodels {
+    OneA, OneB
+  };
 
-                TwoGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::dtss::Parameters<common::DoubleTime>& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::dtss::GraphManager<common::DoubleTime,
+  TwoGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                  const artis::dtss::Parameters<common::DoubleTime> &parameters,
+                  const artis::common::NoParameters &graph_parameters)
+      :
+      artis::dtss::GraphManager<common::DoubleTime,
                                 artis::dtss::Parameters<common::DoubleTime>,
                                 artis::common::NoParameters>(
-                                coordinator, parameters, graph_parameters),
-                        a("a", parameters),
-                        b("b", parameters)
-                {
-                    add_child(OneA, &a);
-                    add_child(OneB, &b);
-                    out({&a, A::OUT}) >> in({&b, B::IN});
-                }
+          coordinator, parameters, graph_parameters),
+      a("a", parameters),
+      b("b", parameters) {
+    add_child(OneA, &a);
+    add_child(OneB, &b);
+    out({&a, A::OUT}) >> in({&b, B::IN});
+  }
 
-                ~TwoGraphManager() override = default;
+  ~TwoGraphManager() override = default;
 
-            private:
-                artis::dtss::Simulator<common::DoubleTime, A, artis::dtss::Parameters<common::DoubleTime>> a;
-                artis::dtss::Simulator<common::DoubleTime, B, artis::dtss::Parameters<common::DoubleTime>> b;
-            };
+private:
+  artis::dtss::Simulator<common::DoubleTime, A, artis::dtss::Parameters<common::DoubleTime>> a;
+  artis::dtss::Simulator<common::DoubleTime, B, artis::dtss::Parameters<common::DoubleTime>> b;
+};
 
-        }
-    }
+}
+}
 } // namespace artis tests dtss
 
 #endif

+ 138 - 134
src/tests/dtss/models.hpp

@@ -34,191 +34,195 @@
 #include <artis-star/kernel/dtss/Dynamics.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace dtss {
-
-            class A
-                    : public artis::dtss::Dynamics<artis::common::DoubleTime, A, artis::dtss::Parameters<common::DoubleTime>> {
-            public:
-                enum outputs {
-                    OUT
-                };
-
-                A(const std::string& name,
-                        const artis::dtss::Context<artis::common::DoubleTime, A, artis::dtss::Parameters<common::DoubleTime>>& context)
-                        :
-                        artis::dtss::Dynamics<artis::common::DoubleTime, A, artis::dtss::Parameters<common::DoubleTime>>(
-                                name, context),
-                        _value(0)
-                {
-                    output_ports({{OUT, "out"}});
-                }
-
-                ~A() override = default;
-
-                void transition(const artis::common::Bag<artis::common::DoubleTime>& /* x */,
-                        const artis::common::DoubleTime::type& t) override
-                {
+namespace tests {
+namespace dtss {
+
+class A
+    : public artis::dtss::Dynamics<artis::common::DoubleTime,
+                                   A,
+                                   artis::dtss::Parameters<common::DoubleTime>> {
+public:
+  enum outputs {
+    OUT
+  };
+
+  A(const std::string &name,
+    const artis::dtss::Context<artis::common::DoubleTime,
+                               A,
+                               artis::dtss::Parameters<common::DoubleTime>> &context)
+      :
+      artis::dtss::Dynamics<artis::common::DoubleTime,
+                            A,
+                            artis::dtss::Parameters<common::DoubleTime>>(
+          name, context),
+      _value(0) {
+    output_ports({{OUT, "out"}});
+  }
+
+  ~A() override = default;
+
+  void transition(const artis::common::Bag<artis::common::DoubleTime> & /* x */,
+                  const artis::common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    artis::common::Trace<artis::common::DoubleTime>::trace()
-                            << artis::common::TraceElement<artis::common::DoubleTime>(
-                                    get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::TRANSITION,
-                                    common::LevelType::USER);
-                    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
+    artis::common::Trace<artis::common::DoubleTime>::trace()
+        << artis::common::TraceElement<artis::common::DoubleTime>(
+            get_name(), t,
+            common::FormalismType::DTSS,
+            common::FunctionType::TRANSITION,
+            common::LevelType::USER);
+    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
 #endif
 
-                }
+  }
 
-                void start(const artis::common::DoubleTime::type& t) override
-                {
+  void start(const artis::common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    artis::common::Trace<artis::common::DoubleTime>::trace()
-                            << artis::common::TraceElement<artis::common::DoubleTime>(
-                                    get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
+    artis::common::Trace<artis::common::DoubleTime>::trace()
+        << artis::common::TraceElement<artis::common::DoubleTime>(
+            get_name(), t,
+            common::FormalismType::DTSS,
+            common::FunctionType::START,
+            common::LevelType::USER);
+    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
 #endif
 
-                }
+  }
 
-                artis::common::Bag<artis::common::DoubleTime> lambda(const artis::common::DoubleTime::type& t) const override
-                {
+  artis::common::Bag<artis::common::DoubleTime> lambda(const artis::common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
-                    artis::common::Bag<artis::common::DoubleTime> msgs;
+    artis::common::Bag<artis::common::DoubleTime> msgs;
 
-                    msgs.push_back(artis::common::ExternalEvent<artis::common::DoubleTime>(OUT, _value));
+    msgs.push_back(artis::common::ExternalEvent<artis::common::DoubleTime>(OUT, _value));
 
 #ifdef WITH_TRACE
-                    artis::common::Trace<artis::common::DoubleTime>::trace()
-                            << artis::common::TraceElement<artis::common::DoubleTime>(
-                                    get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::LAMBDA,
-                                    common::LevelType::USER)
-                            << "messages = " << msgs.to_string();
-                    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
+    artis::common::Trace<artis::common::DoubleTime>::trace()
+        << artis::common::TraceElement<artis::common::DoubleTime>(
+            get_name(), t,
+            common::FormalismType::DTSS,
+            common::FunctionType::LAMBDA,
+            common::LevelType::USER)
+        << "messages = " << msgs.to_string();
+    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
 #endif
 
-                    return msgs;
-                }
-
-            private:
-                double _value;
-            };
-
-            class B
-                    : public artis::dtss::Dynamics<artis::common::DoubleTime, B, artis::dtss::Parameters<common::DoubleTime>> {
-            public:
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                B(const std::string& name,
-                        const artis::dtss::Context<artis::common::DoubleTime, B, artis::dtss::Parameters<common::DoubleTime>>& context)
-                        :
-                        artis::dtss::Dynamics<artis::common::DoubleTime, B, artis::dtss::Parameters<common::DoubleTime>>(
-                                name, context),
-                        _value(0)
-                {
-                    input_ports({{IN, "in"}});
-                    output_ports({{OUT, "out"}});
-                }
-
-                ~B() override = default;
-
-                void transition(const artis::common::Bag<artis::common::DoubleTime>& x,
-                        const artis::common::DoubleTime::type& t) override
-                {
+    return msgs;
+  }
+
+private:
+  double _value;
+};
+
+class B
+    : public artis::dtss::Dynamics<artis::common::DoubleTime,
+                                   B,
+                                   artis::dtss::Parameters<common::DoubleTime>> {
+public:
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  B(const std::string &name,
+    const artis::dtss::Context<artis::common::DoubleTime,
+                               B,
+                               artis::dtss::Parameters<common::DoubleTime>> &context)
+      :
+      artis::dtss::Dynamics<artis::common::DoubleTime,
+                            B,
+                            artis::dtss::Parameters<common::DoubleTime>>(
+          name, context),
+      _value(0) {
+    input_ports({{IN, "in"}});
+    output_ports({{OUT, "out"}});
+  }
+
+  ~B() override = default;
+
+  void transition(const artis::common::Bag<artis::common::DoubleTime> &x,
+                  const artis::common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)x;
-                    (void)t;
+    (void)x;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    artis::common::Trace<artis::common::DoubleTime>::trace()
-                            << artis::common::TraceElement<artis::common::DoubleTime>(
-                                    get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::TRANSITION,
-                                    common::LevelType::USER)
-                            << "x = " << x.to_string();
-                    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
+    artis::common::Trace<artis::common::DoubleTime>::trace()
+        << artis::common::TraceElement<artis::common::DoubleTime>(
+            get_name(), t,
+            common::FormalismType::DTSS,
+            common::FunctionType::TRANSITION,
+            common::LevelType::USER)
+        << "x = " << x.to_string();
+    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
 #endif
-                }
+  }
 
-                void start(const artis::common::DoubleTime::type& t) override
-                {
+  void start(const artis::common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    artis::common::Trace<artis::common::DoubleTime>::trace()
-                            << artis::common::TraceElement<artis::common::DoubleTime>(
-                                    get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
+    artis::common::Trace<artis::common::DoubleTime>::trace()
+        << artis::common::TraceElement<artis::common::DoubleTime>(
+            get_name(), t,
+            common::FormalismType::DTSS,
+            common::FunctionType::START,
+            common::LevelType::USER);
+    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
 #endif
 
-                }
+  }
 
-                artis::common::Bag<artis::common::DoubleTime> lambda(
-                        const artis::common::DoubleTime::type& t) const override
-                {
+  artis::common::Bag<artis::common::DoubleTime> lambda(
+      const artis::common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
-                    artis::common::Bag<artis::common::DoubleTime> msgs;
+    artis::common::Bag<artis::common::DoubleTime> msgs;
 
-                    msgs.push_back(artis::common::ExternalEvent<artis::common::DoubleTime>(OUT, _value));
+    msgs.push_back(artis::common::ExternalEvent<artis::common::DoubleTime>(OUT, _value));
 
 #ifdef WITH_TRACE
-                    artis::common::Trace<artis::common::DoubleTime>::trace()
-                            << artis::common::TraceElement<artis::common::DoubleTime>(
-                                    get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::LAMBDA,
-                                    common::LevelType::USER)
-                            << "messages = " << msgs.to_string();
-                    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
+    artis::common::Trace<artis::common::DoubleTime>::trace()
+        << artis::common::TraceElement<artis::common::DoubleTime>(
+            get_name(), t,
+            common::FormalismType::DTSS,
+            common::FunctionType::LAMBDA,
+            common::LevelType::USER)
+        << "messages = " << msgs.to_string();
+    artis::common::Trace<artis::common::DoubleTime>::trace().flush();
 #endif
 
-                    return msgs;
-                }
+    return msgs;
+  }
 
-            private:
-                double _value;
-            };
+private:
+  double _value;
+};
 
-        }
-    }
+}
+}
 } // namespace artis tests dtss
 
 #endif

+ 61 - 63
src/tests/dtss/tests.cpp

@@ -37,82 +37,80 @@
 using namespace artis::tests::dtss;
 using namespace artis::common;
 
-TEST_CASE("dtss/only_one", "run")
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
-    artis::dtss::Parameters<DoubleTime> parameters = {1};
-    artis::common::RootCoordinator<
-            DoubleTime, artis::dtss::Coordinator<
-                    DoubleTime,
-                    artis::dtss::LastBagPolicy,
-                    OnlyOneGraphManager,
-                    artis::dtss::Parameters<DoubleTime>,
-                    artis::common::NoParameters>
-    > rc(context, "root", parameters, artis::common::NoParameters());
+TEST_CASE("dtss/only_one", "run") {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
+  artis::dtss::Parameters<DoubleTime> parameters = {1};
+  artis::common::RootCoordinator<
+      DoubleTime, artis::dtss::Coordinator<
+          DoubleTime,
+          artis::dtss::LastBagPolicy,
+          OnlyOneGraphManager,
+          artis::dtss::Parameters<DoubleTime>,
+          artis::common::NoParameters>
+  > rc(context, "root", parameters, artis::common::NoParameters());
 
-    artis::common::Trace<DoubleTime>::trace().clear();
-    rc.run(context);
+  artis::common::Trace<DoubleTime>::trace().clear();
+  rc.run(context);
 
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-    for (double t = 0; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  for (double t = 0; t <= 10; ++t) {
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("a").filter_time(t).
-                        filter_function_type(artis::common::FunctionType::TRANSITION).size() == 1);
-        REQUIRE(artis::common::Trace<
+                    filter_model_name("a").filter_time(t).
+                    filter_function_type(artis::common::FunctionType::TRANSITION).size() == 1);
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("a").filter_time(t).
-                        filter_level_type(artis::common::LevelType::USER).
-                        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-    }
+                    filter_model_name("a").filter_time(t).
+                    filter_level_type(artis::common::LevelType::USER).
+                    filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+  }
 }
 
-TEST_CASE("dtss/two", "run")
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
-    artis::dtss::Parameters<DoubleTime> parameters = {1};
-    artis::common::RootCoordinator<
-            DoubleTime, artis::dtss::Coordinator<
-                    DoubleTime,
-                    artis::dtss::LastBagPolicy,
-                    TwoGraphManager,
-                    artis::dtss::Parameters<DoubleTime> >
-    > rc(context, "root", parameters, artis::common::NoParameters());
+TEST_CASE("dtss/two", "run") {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
+  artis::dtss::Parameters<DoubleTime> parameters = {1};
+  artis::common::RootCoordinator<
+      DoubleTime, artis::dtss::Coordinator<
+          DoubleTime,
+          artis::dtss::LastBagPolicy,
+          TwoGraphManager,
+          artis::dtss::Parameters<DoubleTime> >
+  > rc(context, "root", parameters, artis::common::NoParameters());
 
-    artis::common::Trace<DoubleTime>::trace().clear();
-    rc.run(context);
+  artis::common::Trace<DoubleTime>::trace().clear();
+  rc.run(context);
 
+  REQUIRE(artis::common::Trace<
+              DoubleTime > ::trace().elements().
+                  filter_model_name("a").
+                  filter_function_type(artis::common::FunctionType::START).size() == 1);
+  for (unsigned int t = 0; t <= 10; ++t) {
     REQUIRE(artis::common::Trace<
-            DoubleTime > ::trace().elements().
-                    filter_model_name("a").
-                    filter_function_type(artis::common::FunctionType::START).size() == 1);
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("a").filter_time(t).
-                        filter_function_type(artis::common::FunctionType::TRANSITION).size() == 1);
-        REQUIRE(artis::common::Trace<
+                    filter_model_name("a").filter_time(t).
+                    filter_function_type(artis::common::FunctionType::TRANSITION).size() == 1);
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("a").filter_time(t).
-                        filter_level_type(artis::common::LevelType::USER).
-                        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-    }
+                    filter_model_name("a").filter_time(t).
+                    filter_level_type(artis::common::LevelType::USER).
+                    filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+  }
 
+  REQUIRE(artis::common::Trace<
+              DoubleTime > ::trace().elements().
+                  filter_model_name("b").
+                  filter_function_type(artis::common::FunctionType::START).size() == 1);
+  for (unsigned int t = 0; t <= 10; ++t) {
     REQUIRE(artis::common::Trace<
-            DoubleTime > ::trace().elements().
-                    filter_model_name("b").
-                    filter_function_type(artis::common::FunctionType::START).size() == 1);
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("b").filter_time(t).
-                        filter_function_type(artis::common::FunctionType::TRANSITION).size() == 1);
-        REQUIRE(artis::common::Trace<
+                    filter_model_name("b").filter_time(t).
+                    filter_function_type(artis::common::FunctionType::TRANSITION).size() == 1);
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("b").filter_time(t).
-                        filter_level_type(artis::common::LevelType::USER).
-                        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-    }
+                    filter_model_name("b").filter_time(t).
+                    filter_level_type(artis::common::LevelType::USER).
+                    filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+  }
 }

+ 29 - 30
src/tests/fddevs/graph_manager.hpp

@@ -34,42 +34,41 @@
 #include <artis-star/kernel/fddevs/Simulator.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace fddevs {
+namespace tests {
+namespace fddevs {
 
-            class FlatGraphManager :
-                    public artis::fddevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    M_BEEP, M_CRC, M_MXR,
-                };
+class FlatGraphManager :
+    public artis::fddevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    M_BEEP, M_CRC, M_MXR,
+  };
 
-                FlatGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::fddevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        _beep("beep", parameters), _crc("crc", parameters), _mxr("mxr", parameters)
-                {
-                    add_child(M_BEEP, &_beep);
-                    add_child(M_CRC, &_crc);
-                    add_child(M_MXR, &_mxr);
+  FlatGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                   const artis::common::NoParameters &parameters,
+                   const artis::common::NoParameters &graph_parameters)
+      :
+      artis::fddevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      _beep("beep", parameters), _crc("crc", parameters), _mxr("mxr", parameters) {
+    add_child(M_BEEP, &_beep);
+    add_child(M_CRC, &_crc);
+    add_child(M_MXR, &_mxr);
 
-                    out({&_beep, Beep::OUT_P}) >> in({&_crc, CRC::IN_P});
-                    out({&_crc, CRC::OUT_G}) >> in({&_mxr, MXR::IN_A});
-                    out({&_crc, CRC::OUT_W}) >> in({&_mxr, MXR::IN_B});
-                }
+    out({&_beep, Beep::OUT_P}) >> in({&_crc, CRC::IN_P});
+    out({&_crc, CRC::OUT_G}) >> in({&_mxr, MXR::IN_A});
+    out({&_crc, CRC::OUT_W}) >> in({&_mxr, MXR::IN_B});
+  }
 
-                ~FlatGraphManager() override = default;
+  ~FlatGraphManager() override = default;
 
-            private:
-                artis::fddevs::Simulator<common::DoubleTime, Beep> _beep;
-                artis::fddevs::Simulator<common::DoubleTime, CRC> _crc;
-                artis::fddevs::Simulator<common::DoubleTime, MXR> _mxr;
-            };
+private:
+  artis::fddevs::Simulator<common::DoubleTime, Beep> _beep;
+  artis::fddevs::Simulator<common::DoubleTime, CRC> _crc;
+  artis::fddevs::Simulator<common::DoubleTime, MXR> _mxr;
+};
 
-        }
-    }
+}
+}
 } // namespace artis tests fddevs
 
 #endif

+ 295 - 302
src/tests/fddevs/models.hpp

@@ -33,320 +33,313 @@
 #include <artis-star/kernel/fddevs/Dynamics.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace fddevs {
-
-            enum CRC_state_values {
-                I0 = 0, I1, G, GR, WW, W, DW
-            };
-
-            class CRC : public artis::fddevs::Dynamics<common::DoubleTime, CRC, CRC_state_values> {
-            public:
-                enum inputs {
-                    IN_P
-                };
-                enum outputs {
-                    OUT_G, OUT_W
-                };
-
-                CRC(const std::string& name,
-                        const artis::fddevs::Context<common::DoubleTime, CRC, artis::common::NoParameters>& context)
-                        :
-                        artis::fddevs::Dynamics<common::DoubleTime, CRC, CRC_state_values>(name,
-                                context)
-                {
-                    input_ports({{IN_P, "p"}});
-                    output_ports({{OUT_G, "g"},
-                                  {OUT_W, "w"}});
-
-                    initial_state(I0);
-                }
-
-                ~CRC() override = default;
-
-                void delta_tau(typename common::DoubleTime::type /* t */) override
-                {
-                    switch (state()) {
-                    case I0: {
-                        state(I1);
-                        break;
-                    }
-                    case I1: {
-                        state(G);
-                        break;
-                    }
-                    case G: {
-                        state(G);
-                        break;
-                    }
-                    case GR: {
-                        state(WW);
-                        break;
-                    }
-                    case WW: {
-                        state(W);
-                        break;
-                    }
-                    case W: {
-                        state(DW);
-                        break;
-                    }
-                    case DW: {
-                        state(G);
-                        break;
-                    }
-                    }
-                }
-
-                void
-                delta_x(typename common::DoubleTime::type /* t */,
-                        typename common::DoubleTime::type /* e */,
-                        const common::Bag<common::DoubleTime>& bag) override
-                {
-                    assert(bag.size() == 1);
-
-                    if (bag.at(0).on_port(IN_P) and state() == G) {
-                        state(GR);
-                    }
-                }
+namespace tests {
+namespace fddevs {
+
+enum CRC_state_values {
+  I0 = 0, I1, G, GR, WW, W, DW
+};
+
+class CRC : public artis::fddevs::Dynamics<common::DoubleTime, CRC, CRC_state_values> {
+public:
+  enum inputs {
+    IN_P
+  };
+  enum outputs {
+    OUT_G, OUT_W
+  };
+
+  CRC(const std::string &name,
+      const artis::fddevs::Context<common::DoubleTime, CRC, artis::common::NoParameters> &context)
+      :
+      artis::fddevs::Dynamics<common::DoubleTime, CRC, CRC_state_values>(name,
+                                                                         context) {
+    input_ports({{IN_P, "p"}});
+    output_ports({{OUT_G, "g"},
+                  {OUT_W, "w"}});
+
+    initial_state(I0);
+  }
+
+  ~CRC() override = default;
+
+  void delta_tau(typename common::DoubleTime::type /* t */) override {
+    switch (state()) {
+    case I0: {
+      state(I1);
+      break;
+    }
+    case I1: {
+      state(G);
+      break;
+    }
+    case G: {
+      state(G);
+      break;
+    }
+    case GR: {
+      state(WW);
+      break;
+    }
+    case WW: {
+      state(W);
+      break;
+    }
+    case W: {
+      state(DW);
+      break;
+    }
+    case DW: {
+      state(G);
+      break;
+    }
+    }
+  }
 
-                common::Bag<common::DoubleTime>
-                lambda(typename common::DoubleTime::type /* t */) const override
-                {
-                    common::Bag<common::DoubleTime> msgs;
+  void
+  delta_x(typename common::DoubleTime::type /* t */,
+          typename common::DoubleTime::type /* e */,
+          const common::Bag<common::DoubleTime> &bag) override {
+    assert(bag.size() == 1);
 
-                    switch (state()) {
-                    case I0:
-                        msgs.push_back(
-                                artis::common::ExternalEvent<common::DoubleTime>(OUT_W, 0));
-                        break;
-                    case I1:
-                        msgs.push_back(
-                                artis::common::ExternalEvent<common::DoubleTime>(OUT_G, 1));
+    if (bag.at(0).on_port(IN_P) and state() == G) {
+      state(GR);
+    }
+  }
+
+  common::Bag<common::DoubleTime>
+  lambda(typename common::DoubleTime::type /* t */) const override {
+    common::Bag<common::DoubleTime> msgs;
+
+    switch (state()) {
+    case I0:
+      msgs.push_back(
+          artis::common::ExternalEvent<common::DoubleTime>(OUT_W, 0));
+      break;
+    case I1:
+      msgs.push_back(
+          artis::common::ExternalEvent<common::DoubleTime>(OUT_G, 1));
+      break;
+    case G:break;
+    case GR:
+      msgs.push_back(
+          artis::common::ExternalEvent<common::DoubleTime>(OUT_G, 0));
+      break;
+    case WW:
+      msgs.push_back(
+          artis::common::ExternalEvent<common::DoubleTime>(OUT_W, 1));
+      break;
+    case W:
+      msgs.push_back(
+          artis::common::ExternalEvent<common::DoubleTime>(OUT_W, 0));
+      break;
+    case DW:
+      msgs.push_back(
+          artis::common::ExternalEvent<common::DoubleTime>(OUT_G, 1));
+      break;
+    }
+    return msgs;
+  }
+
+  bool rho(typename common::DoubleTime::type /* time */,
+           const common::Bag<common::DoubleTime> &bag) const override {
+    return state() == G and bag.at(0).on_port(IN_P);
+  }
+
+  typename common::DoubleTime::type
+  tau(typename common::DoubleTime::type /* t */) const override {
+    switch (state()) {
+    case I0:return 0;
+    case I1:return 0;
+    case G:return 10;
+    case GR:return 5;
+    case WW:return 2;
+    case W:return 26;
+    case DW:return 2;
+    }
+    return common::DoubleTime::infinity;
+  }
+};
+
+enum MXR_state_values {
+  A00 = 0, A01, A10, A11, R11
+};
+
+class MXR : public artis::fddevs::Dynamics<common::DoubleTime, MXR, MXR_state_values> {
+public:
+  enum inputs {
+    IN_A, IN_B
+  };
+
+  MXR(const std::string &name,
+      const artis::fddevs::Context<common::DoubleTime, MXR, artis::common::NoParameters> &context)
+      :
+      artis::fddevs::Dynamics<common::DoubleTime, MXR, MXR_state_values>(name,
+                                                                         context) {
+    input_ports({{IN_A, "a"},
+                 {IN_B, "b"}});
+    initial_state(A00);
+  }
+
+  ~MXR() override = default;
+
+  void delta_tau(typename common::DoubleTime::type /* t */) override {
+    if (state() == A11) {
+      state(R11);
+    }
+  }
+
+  void
+  delta_x(typename common::DoubleTime::type /* t */,
+          typename common::DoubleTime::type /* e */,
+          const common::Bag<common::DoubleTime> &bag) override {
+    std::for_each(bag.begin(), bag.end(),
+                  [this](const artis::common::ExternalEvent<common::DoubleTime> &e) {
+                    int data;
+
+                    e.data()(data);
+                    if (e.on_port(IN_A)) {
+                      switch (state()) {
+                      case A00: {
+                        if (data == 1) {
+                          state(A01);
+                        }
                         break;
-                    case G:
+                      }
+                      case A01: {
+                        if (data == 0) {
+                          state(A00);
+                        }
                         break;
-                    case GR:
-                        msgs.push_back(
-                                artis::common::ExternalEvent<common::DoubleTime>(OUT_G, 0));
+                      }
+                      case A10: {
+                        if (data == 1) {
+                          state(A11);
+                        }
                         break;
-                    case WW:
-                        msgs.push_back(
-                                artis::common::ExternalEvent<common::DoubleTime>(OUT_W, 1));
+                      }
+                      case A11: {
+                        if (data == 0) {
+                          state(A10);
+                        }
                         break;
-                    case W:
-                        msgs.push_back(
-                                artis::common::ExternalEvent<common::DoubleTime>(OUT_W, 0));
+                      }
+                      case R11:break;
+                      }
+                    } else if (e.on_port(IN_B)) {
+                      switch (state()) {
+                      case A00: {
+                        if (data == 1) {
+                          state(A10);
+                        }
                         break;
-                    case DW:
-                        msgs.push_back(
-                                artis::common::ExternalEvent<common::DoubleTime>(OUT_G, 1));
+                      }
+                      case A01: {
+                        if (data == 1) {
+                          state(A11);
+                        }
                         break;
-                    }
-                    return msgs;
-                }
-
-                bool rho(typename common::DoubleTime::type /* time */,
-                        const common::Bag<common::DoubleTime>& bag) const override
-                {
-                    return state() == G and bag.at(0).on_port(IN_P);
-                }
-
-                typename common::DoubleTime::type
-                tau(typename common::DoubleTime::type /* t */) const override
-                {
-                    switch (state()) {
-                    case I0:
-                        return 0;
-                    case I1:
-                        return 0;
-                    case G:
-                        return 10;
-                    case GR:
-                        return 5;
-                    case WW:
-                        return 2;
-                    case W:
-                        return 26;
-                    case DW:
-                        return 2;
-                    }
-                    return common::DoubleTime::infinity;
-                }
-            };
-
-            enum MXR_state_values {
-                A00 = 0, A01, A10, A11, R11
-            };
-
-            class MXR : public artis::fddevs::Dynamics<common::DoubleTime, MXR, MXR_state_values> {
-            public:
-                enum inputs {
-                    IN_A, IN_B
-                };
-
-                MXR(const std::string& name,
-                        const artis::fddevs::Context<common::DoubleTime, MXR, artis::common::NoParameters>& context)
-                        :
-                        artis::fddevs::Dynamics<common::DoubleTime, MXR, MXR_state_values>(name,
-                                context)
-                {
-                    input_ports({{IN_A, "a"},
-                                 {IN_B, "b"}});
-                    initial_state(A00);
-                }
-
-                ~MXR() override = default;
-
-                void delta_tau(typename common::DoubleTime::type /* t */) override
-                {
-                    if (state() == A11) { state(R11); }
-                }
-
-                void
-                delta_x(typename common::DoubleTime::type /* t */,
-                        typename common::DoubleTime::type /* e */,
-                        const common::Bag<common::DoubleTime>& bag) override
-                {
-                    std::for_each(bag.begin(), bag.end(),
-                            [this](const artis::common::ExternalEvent<common::DoubleTime>& e) {
-                                int data;
-
-                                e.data()(data);
-                                if (e.on_port(IN_A)) {
-                                    switch (state()) {
-                                    case A00: {
-                                        if (data == 1) { state(A01); }
-                                        break;
-                                    }
-                                    case A01: {
-                                        if (data == 0) { state(A00); }
-                                        break;
-                                    }
-                                    case A10: {
-                                        if (data == 1) { state(A11); }
-                                        break;
-                                    }
-                                    case A11: {
-                                        if (data == 0) { state(A10); }
-                                        break;
-                                    }
-                                    case R11:
-                                        break;
-                                    }
-                                } else if (e.on_port(IN_B)) {
-                                    switch (state()) {
-                                    case A00: {
-                                        if (data == 1) { state(A10); }
-                                        break;
-                                    }
-                                    case A01: {
-                                        if (data == 1) { state(A11); }
-                                        break;
-                                    }
-                                    case A10: {
-                                        if (data == 0) { state(A00); }
-                                        break;
-                                    }
-                                    case A11: {
-                                        if (data == 0) { state(A01); }
-                                        break;
-                                    }
-                                    case R11:
-                                        break;
-                                    }
-                                }
-                            });
-                }
-
-                common::Bag<common::DoubleTime>
-                lambda(typename common::DoubleTime::type /* t */) const override
-                {
-                    common::Bag<common::DoubleTime> msgs;
-
-                    return msgs;
-                }
-
-                bool rho(typename common::DoubleTime::type /* time */,
-                        const common::Bag<common::DoubleTime>& /* bag */) const override
-                {
-                    return false;
-                }
-
-                typename common::DoubleTime::type
-                tau(typename common::DoubleTime::type /* t */) const override
-                {
-                    if (state() == A11) { return 0.01; }
-                    else { return common::DoubleTime::infinity; }
-                }
-            };
-
-            enum Beep_state_values {
-                INIT = 0, SEND
-            };
-
-            class Beep
-                    : public artis::fddevs::Dynamics<common::DoubleTime, Beep, Beep_state_values> {
-            public:
-                enum outputs {
-                    OUT_P
-                };
-
-                Beep(const std::string& name,
-                        const artis::fddevs::Context<common::DoubleTime, Beep, artis::common::NoParameters>& context)
-                        :
-                        artis::fddevs::Dynamics<common::DoubleTime, Beep, Beep_state_values>(name,
-                                context)
-                {
-                    output_ports({{OUT_P, "p"}});
-
-                    initial_state(INIT);
-                }
-
-                ~Beep() override = default;
-
-                void delta_tau(typename common::DoubleTime::type /* t */) override
-                {
-                    if (state() == INIT) { state(SEND); }
-                }
-
-                common::Bag<common::DoubleTime>
-                lambda(typename common::DoubleTime::type /* t */) const override
-                {
-                    common::Bag<common::DoubleTime> msgs;
-
-                    switch (state()) {
-                    case INIT:
-                        msgs.push_back(
-                                artis::common::ExternalEvent<common::DoubleTime>(OUT_P, 1));
+                      }
+                      case A10: {
+                        if (data == 0) {
+                          state(A00);
+                        }
                         break;
-                    case SEND:
+                      }
+                      case A11: {
+                        if (data == 0) {
+                          state(A01);
+                        }
                         break;
+                      }
+                      case R11:break;
+                      }
                     }
-                    return msgs;
-                }
-
-                bool rho(typename common::DoubleTime::type /* time */,
-                        const common::Bag<common::DoubleTime>& /* bag */) const override
-                {
-                    return false;
-                }
-
-                typename common::DoubleTime::type
-                tau(typename common::DoubleTime::type /* t */) const override
-                {
-                    switch (state()) {
-                    case INIT:
-                        return 27;
-                    case SEND:
-                        return common::DoubleTime::infinity;
-                    }
-                    return common::DoubleTime::infinity;
-                }
-            };
-
-        }
+                  });
+  }
+
+  common::Bag<common::DoubleTime>
+  lambda(typename common::DoubleTime::type /* t */) const override {
+    common::Bag<common::DoubleTime> msgs;
+
+    return msgs;
+  }
+
+  bool rho(typename common::DoubleTime::type /* time */,
+           const common::Bag<common::DoubleTime> & /* bag */) const override {
+    return false;
+  }
+
+  typename common::DoubleTime::type
+  tau(typename common::DoubleTime::type /* t */) const override {
+    if (state() == A11) {
+      return 0.01;
+    } else {
+      return common::DoubleTime::infinity;
     }
+  }
+};
+
+enum Beep_state_values {
+  INIT = 0, SEND
+};
+
+class Beep
+    : public artis::fddevs::Dynamics<common::DoubleTime, Beep, Beep_state_values> {
+public:
+  enum outputs {
+    OUT_P
+  };
+
+  Beep(const std::string &name,
+       const artis::fddevs::Context<common::DoubleTime, Beep, artis::common::NoParameters> &context)
+      :
+      artis::fddevs::Dynamics<common::DoubleTime, Beep, Beep_state_values>(name,
+                                                                           context) {
+    output_ports({{OUT_P, "p"}});
+
+    initial_state(INIT);
+  }
+
+  ~Beep() override = default;
+
+  void delta_tau(typename common::DoubleTime::type /* t */) override {
+    if (state() == INIT) {
+      state(SEND);
+    }
+  }
+
+  common::Bag<common::DoubleTime>
+  lambda(typename common::DoubleTime::type /* t */) const override {
+    common::Bag<common::DoubleTime> msgs;
+
+    switch (state()) {
+    case INIT:
+      msgs.push_back(
+          artis::common::ExternalEvent<common::DoubleTime>(OUT_P, 1));
+      break;
+    case SEND:break;
+    }
+    return msgs;
+  }
+
+  bool rho(typename common::DoubleTime::type /* time */,
+           const common::Bag<common::DoubleTime> & /* bag */) const override {
+    return false;
+  }
+
+  typename common::DoubleTime::type
+  tau(typename common::DoubleTime::type /* t */) const override {
+    switch (state()) {
+    case INIT:return 27;
+    case SEND:return common::DoubleTime::infinity;
+    }
+    return common::DoubleTime::infinity;
+  }
+};
+
+}
+}
 } // namespace artis tests fddevs
 
 #endif

+ 55 - 56
src/tests/fddevs/tests.cpp

@@ -36,65 +36,64 @@
 using namespace artis::tests::fddevs;
 using namespace artis::common;
 
-TEST_CASE("fddevs/cross road system", "run")
-{
-    context::Context<DoubleTime> context(0, 70);
-    RootCoordinator<
-            DoubleTime, artis::fddevs::Coordinator<
-                    DoubleTime,
-                    FlatGraphManager>
-    > rc(context, "root", NoParameters(), NoParameters());
+TEST_CASE("fddevs/cross road system", "run") {
+  context::Context<DoubleTime> context(0, 70);
+  RootCoordinator<
+      DoubleTime, artis::fddevs::Coordinator<
+          DoubleTime,
+          FlatGraphManager>
+  > rc(context, "root", NoParameters(), NoParameters());
 
-    Trace<DoubleTime>::trace().clear();
-    rc.run(context);
+  Trace<DoubleTime>::trace().clear();
+  rc.run(context);
 
-    std::cout << Trace<DoubleTime>::trace().elements().filter_model_name("crc").to_string()
-              << std::endl;
-    std::cout << Trace<DoubleTime>::trace().elements().filter_model_name("mxr").to_string()
-              << std::endl;
+  std::cout << Trace<DoubleTime>::trace().elements().filter_model_name("crc").to_string()
+            << std::endl;
+  std::cout << Trace<DoubleTime>::trace().elements().filter_model_name("mxr").to_string()
+            << std::endl;
 
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE).size() == 18);
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[0].get_comment() == ": BEFORE => tl = 0 ; tn = 0 ; S = 0");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[1].get_comment() == ": AFTER => tl = 0 ; tn = 0 ; S = 1");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[2].get_comment() == ": BEFORE => tl = 0 ; tn = 0 ; S = 1");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[3].get_comment() == ": AFTER => tl = 0 ; tn = 10 ; S = 2");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[4].get_comment() == ": BEFORE => tl = 0 ; tn = 10 ; S = 2");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[5].get_comment() == ": AFTER => tl = 10 ; tn = 20 ; S = 2");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[6].get_comment() == ": BEFORE => tl = 10 ; tn = 20 ; S = 2");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[7].get_comment() == ": AFTER => tl = 20 ; tn = 30 ; S = 2");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[8].get_comment() == ": BEFORE => tl = 20 ; tn = 30 ; S = 2");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[9].get_comment() == ": AFTER => tl = 27 ; tn = 32 ; S = 3");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[10].get_comment() == ": BEFORE => tl = 27 ; tn = 32 ; S = 3");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[11].get_comment() == ": AFTER => tl = 32 ; tn = 34 ; S = 4");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[12].get_comment() == ": BEFORE => tl = 32 ; tn = 34 ; S = 4");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[13].get_comment() == ": AFTER => tl = 34 ; tn = 60 ; S = 5");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[14].get_comment() == ": BEFORE => tl = 34 ; tn = 60 ; S = 5");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[15].get_comment() == ": AFTER => tl = 60 ; tn = 62 ; S = 6");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[16].get_comment() == ": BEFORE => tl = 60 ; tn = 62 ; S = 6");
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
-            FunctionType::S_MESSAGE)[17].get_comment() == ": AFTER => tl = 62 ; tn = 72 ; S = 2");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE).size() == 18);
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[0].get_comment() == ": BEFORE => tl = 0 ; tn = 0 ; S = 0");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[1].get_comment() == ": AFTER => tl = 0 ; tn = 0 ; S = 1");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[2].get_comment() == ": BEFORE => tl = 0 ; tn = 0 ; S = 1");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[3].get_comment() == ": AFTER => tl = 0 ; tn = 10 ; S = 2");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[4].get_comment() == ": BEFORE => tl = 0 ; tn = 10 ; S = 2");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[5].get_comment() == ": AFTER => tl = 10 ; tn = 20 ; S = 2");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[6].get_comment() == ": BEFORE => tl = 10 ; tn = 20 ; S = 2");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[7].get_comment() == ": AFTER => tl = 20 ; tn = 30 ; S = 2");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[8].get_comment() == ": BEFORE => tl = 20 ; tn = 30 ; S = 2");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[9].get_comment() == ": AFTER => tl = 27 ; tn = 32 ; S = 3");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[10].get_comment() == ": BEFORE => tl = 27 ; tn = 32 ; S = 3");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[11].get_comment() == ": AFTER => tl = 32 ; tn = 34 ; S = 4");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[12].get_comment() == ": BEFORE => tl = 32 ; tn = 34 ; S = 4");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[13].get_comment() == ": AFTER => tl = 34 ; tn = 60 ; S = 5");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[14].get_comment() == ": BEFORE => tl = 34 ; tn = 60 ; S = 5");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[15].get_comment() == ": AFTER => tl = 60 ; tn = 62 ; S = 6");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[16].get_comment() == ": BEFORE => tl = 60 ; tn = 62 ; S = 6");
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("crc").filter_function_type(
+      FunctionType::S_MESSAGE)[17].get_comment() == ": AFTER => tl = 62 ; tn = 72 ; S = 2");
 
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("mxr").filter_function_type(
-            FunctionType::S_MESSAGE).size() == 12);
-    REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("mxr").filter_function_type(
-            FunctionType::POST_EVENT).size() == 12);
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("mxr").filter_function_type(
+      FunctionType::S_MESSAGE).size() == 12);
+  REQUIRE(Trace<DoubleTime>::trace().elements().filter_model_name("mxr").filter_function_type(
+      FunctionType::POST_EVENT).size() == 12);
 
 }

+ 233 - 242
src/tests/mixed/graph_manager.hpp

@@ -39,249 +39,240 @@
 #include <artis-star/kernel/pdevs/Simulator.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace mixed {
-
-            class S1GraphManager : public pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneA, OneB
-                };
-                enum outputs {
-                    OUT
-                };
-
-                S1GraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        a("a1", parameters),
-                        b("b1", parameters)
-                {
-                    add_child(OneA, &a);
-                    add_child(OneB, &b);
-
-                    coordinator->output_port({OUT, "out"});
-
-                    out({&a, A1::OUT}) >> in({&b, B1::IN});
-                    out({&b, B1::OUT}) >> out({coordinator, OUT});
-                }
-
-                ~S1GraphManager() override = default;
-
-            private:
-                pdevs::Simulator<common::DoubleTime, A1, artis::common::NoParameters> a;
-                pdevs::Simulator<common::DoubleTime, B1, artis::common::NoParameters> b;
-            };
-
-            class S2GraphManager :
-                    public dtss::GraphManager<common::DoubleTime, artis::dtss::Parameters<common::DoubleTime>> {
-            public:
-                enum submodels {
-                    OneA, OneB
-                };
-                enum inputs {
-                    IN
-                };
-
-                S2GraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::dtss::Parameters<common::DoubleTime>& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        dtss::GraphManager<common::DoubleTime, artis::dtss::Parameters<common::DoubleTime>>(
-                                coordinator, parameters, graph_parameters),
-                        a("a2", parameters), b("b2", parameters)
-                {
-                    add_child(OneA, &a);
-                    add_child(OneB, &b);
-
-                    coordinator->input_port({IN, "in"});
-
-                    out({&a, A2::OUT}) >> in({&b, B2::IN});
-                    in({coordinator, IN}) >> in({&a, A2::IN});
-                }
-
-                ~S2GraphManager() override = default;
-
-            private:
-                dtss::Simulator<common::DoubleTime, A2, artis::dtss::Parameters<common::DoubleTime>> a;
-                dtss::Simulator<common::DoubleTime, B2, artis::dtss::Parameters<common::DoubleTime>> b;
-            };
-
-            class RootGraphManager : public pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneS1, OneS2
-                };
-
-                RootGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        S1("S1", artis::common::NoParameters(), artis::common::NoParameters()),
-                        S2("S2", {2}, artis::common::NoParameters())
-                {
-                    add_child(OneS1, &S1);
-                    add_child(OneS2, &S2);
-
-                    out({&S1, S1GraphManager::OUT}) >> in({&S2, S2GraphManager::IN});
-                }
-
-                ~RootGraphManager() override = default;
-
-            private:
-                artis::pdevs::Coordinator<common::DoubleTime, S1GraphManager> S1;
-                artis::dtss::Coordinator<
-                        common::DoubleTime,
-                        artis::dtss::LastBagPolicy,
-                        S2GraphManager,
-                        artis::dtss::Parameters<common::DoubleTime>> S2;
-            };
-
-            template<int size>
-            class LinearGraphManager : public pdevs::GraphManager<common::DoubleTime> {
-            public:
-                LinearGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters)
-                {
-                    for (unsigned int i = 1; i <= size; ++i) {
-                        std::ostringstream ss;
-
-                        ss << "a" << i;
-                        _models.push_back(
-                                new pdevs::Simulator<common::DoubleTime, Beep, artis::common::NoParameters>(
-                                        ss.str(), artis::common::NoParameters()));
-                    }
-                    for (unsigned int i = 0; i < size; ++i) {
-                        LinearGraphManager<size>::add_child(i, _models[i]);
-                    }
-                    for (unsigned int i = 0; i < size - 1; ++i) {
-                        out({_models[i], Beep::OUT}) >> in({_models[i + 1], B1::IN});
-                    }
-                }
-
-                ~LinearGraphManager() override
-                {
-                    for (unsigned int i = 0; i < size; ++i) {
-                        delete _models[i];
-                    }
-                }
-
-            private:
-                std::vector<pdevs::Simulator<common::DoubleTime, Beep, artis::common::NoParameters>*> _models;
-            };
-
-            class Linear2GraphManager : public pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                Linear2GraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters)
-                {
-                    for (unsigned int i = 1; i <= 100; ++i) {
-                        std::ostringstream ss;
-
-                        ss << "a" << i;
-                        _models.push_back(
-                                new pdevs::Simulator<common::DoubleTime, Beep, artis::common::NoParameters>(
-                                        ss.str(), artis::common::NoParameters()));
-                    }
-                    for (unsigned int i = 0; i < 100; ++i) {
-                        add_child(i, _models[i]);
-                    }
-                    for (unsigned int i = 0; i < 99; ++i) {
-                        out({_models[i], Beep::OUT}) >> in({_models[i + 1], B1::IN});
-                    }
-
-                    coordinator->input_port({IN, "in"});
-                    coordinator->output_port({OUT, "out"});
-
-                    in({coordinator, IN}) >> in({_models[0], Beep::IN});
-                    out({_models[99], Beep::OUT}) >> out({coordinator, OUT});
-                }
-
-                ~Linear2GraphManager() override
-                {
-                    for (unsigned int i = 0; i < 100; ++i) {
-                        delete _models[i];
-                    }
-                }
-
-            private:
-                std::vector<pdevs::Simulator<common::DoubleTime, Beep, artis::common::NoParameters>*> _models;
-            };
-
-            class Root2GraphManager : public pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneS1, OneS2
-                };
-
-                Root2GraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters
-                )
-                        :
-                        pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        S1("S1", artis::common::NoParameters(), artis::common::NoParameters()),
-                        S2("S2", artis::common::NoParameters(), artis::common::NoParameters())
-                {
-                    add_child(OneS1, &S1);
-                    add_child(OneS2, &S2);
-
-                    out({&S1, S1GraphManager::OUT}) >> in({&S2, S2GraphManager::IN});
-                }
-
-                ~Root2GraphManager() override = default;
-
-            private:
-                artis::pdevs::Coordinator<common::DoubleTime, Linear2GraphManager> S1;
-                artis::pdevs::Coordinator<common::DoubleTime, Linear2GraphManager> S2;
-            };
-
-            class Root3GraphManager : public pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneS1, OneS2
-                };
-
-                Root3GraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters
-                )
-                        :
-                        pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        S1("S1", artis::common::NoParameters(), artis::common::NoParameters()),
-                        S2("S2", artis::common::NoParameters(), artis::common::NoParameters())
-                {
-                    add_child(OneS1, &S1);
-                    add_child(OneS2, &S2);
-
-                    out({&S1, S1GraphManager::OUT}) >> in({&S2, S2GraphManager::IN});
-                }
-
-                ~Root3GraphManager() override = default;
-
-            private:
-                artis::pdevs::Coordinator<common::DoubleTime, Linear2GraphManager> S1;
-                artis::pdevs::Coordinator<common::DoubleTime, Linear2GraphManager> S2;
-            };
-
-        }
+namespace tests {
+namespace mixed {
+
+class S1GraphManager : public pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneA, OneB
+  };
+  enum outputs {
+    OUT
+  };
+
+  S1GraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                 const artis::common::NoParameters &parameters,
+                 const artis::common::NoParameters &graph_parameters)
+      :
+      pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      a("a1", parameters),
+      b("b1", parameters) {
+    add_child(OneA, &a);
+    add_child(OneB, &b);
+
+    coordinator->output_port({OUT, "out"});
+
+    out({&a, A1::OUT}) >> in({&b, B1::IN});
+    out({&b, B1::OUT}) >> out({coordinator, OUT});
+  }
+
+  ~S1GraphManager() override = default;
+
+private:
+  pdevs::Simulator<common::DoubleTime, A1, artis::common::NoParameters> a;
+  pdevs::Simulator<common::DoubleTime, B1, artis::common::NoParameters> b;
+};
+
+class S2GraphManager :
+    public dtss::GraphManager<common::DoubleTime, artis::dtss::Parameters<common::DoubleTime>> {
+public:
+  enum submodels {
+    OneA, OneB
+  };
+  enum inputs {
+    IN
+  };
+
+  S2GraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                 const artis::dtss::Parameters<common::DoubleTime> &parameters,
+                 const artis::common::NoParameters &graph_parameters)
+      :
+      dtss::GraphManager<common::DoubleTime, artis::dtss::Parameters<common::DoubleTime>>(
+          coordinator, parameters, graph_parameters),
+      a("a2", parameters), b("b2", parameters) {
+    add_child(OneA, &a);
+    add_child(OneB, &b);
+
+    coordinator->input_port({IN, "in"});
+
+    out({&a, A2::OUT}) >> in({&b, B2::IN});
+    in({coordinator, IN}) >> in({&a, A2::IN});
+  }
+
+  ~S2GraphManager() override = default;
+
+private:
+  dtss::Simulator<common::DoubleTime, A2, artis::dtss::Parameters<common::DoubleTime>> a;
+  dtss::Simulator<common::DoubleTime, B2, artis::dtss::Parameters<common::DoubleTime>> b;
+};
+
+class RootGraphManager : public pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneS1, OneS2
+  };
+
+  RootGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                   const artis::common::NoParameters &parameters,
+                   const artis::common::NoParameters &graph_parameters)
+      :
+      pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      S1("S1", artis::common::NoParameters(), artis::common::NoParameters()),
+      S2("S2", {2}, artis::common::NoParameters()) {
+    add_child(OneS1, &S1);
+    add_child(OneS2, &S2);
+
+    out({&S1, S1GraphManager::OUT}) >> in({&S2, S2GraphManager::IN});
+  }
+
+  ~RootGraphManager() override = default;
+
+private:
+  artis::pdevs::Coordinator<common::DoubleTime, S1GraphManager> S1;
+  artis::dtss::Coordinator<
+      common::DoubleTime,
+      artis::dtss::LastBagPolicy,
+      S2GraphManager,
+      artis::dtss::Parameters<common::DoubleTime>> S2;
+};
+
+template<int size>
+class LinearGraphManager : public pdevs::GraphManager<common::DoubleTime> {
+public:
+  LinearGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                     const artis::common::NoParameters &parameters,
+                     const artis::common::NoParameters &graph_parameters)
+      :
+      pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters) {
+    for (unsigned int i = 1; i <= size; ++i) {
+      std::ostringstream ss;
+
+      ss << "a" << i;
+      _models.push_back(
+          new pdevs::Simulator<common::DoubleTime, Beep, artis::common::NoParameters>(
+              ss.str(), artis::common::NoParameters()));
     }
+    for (unsigned int i = 0; i < size; ++i) {
+      LinearGraphManager<size>::add_child(i, _models[i]);
+    }
+    for (unsigned int i = 0; i < size - 1; ++i) {
+      out({_models[i], Beep::OUT}) >> in({_models[i + 1], B1::IN});
+    }
+  }
+
+  ~LinearGraphManager() override {
+    for (unsigned int i = 0; i < size; ++i) {
+      delete _models[i];
+    }
+  }
+
+private:
+  std::vector<pdevs::Simulator<common::DoubleTime, Beep, artis::common::NoParameters> *> _models;
+};
+
+class Linear2GraphManager : public pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  Linear2GraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                      const artis::common::NoParameters &parameters,
+                      const artis::common::NoParameters &graph_parameters)
+      :
+      pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters) {
+    for (unsigned int i = 1; i <= 100; ++i) {
+      std::ostringstream ss;
+
+      ss << "a" << i;
+      _models.push_back(
+          new pdevs::Simulator<common::DoubleTime, Beep, artis::common::NoParameters>(
+              ss.str(), artis::common::NoParameters()));
+    }
+    for (unsigned int i = 0; i < 100; ++i) {
+      add_child(i, _models[i]);
+    }
+    for (unsigned int i = 0; i < 99; ++i) {
+      out({_models[i], Beep::OUT}) >> in({_models[i + 1], B1::IN});
+    }
+
+    coordinator->input_port({IN, "in"});
+    coordinator->output_port({OUT, "out"});
+
+    in({coordinator, IN}) >> in({_models[0], Beep::IN});
+    out({_models[99], Beep::OUT}) >> out({coordinator, OUT});
+  }
+
+  ~Linear2GraphManager() override {
+    for (unsigned int i = 0; i < 100; ++i) {
+      delete _models[i];
+    }
+  }
+
+private:
+  std::vector<pdevs::Simulator<common::DoubleTime, Beep, artis::common::NoParameters> *> _models;
+};
+
+class Root2GraphManager : public pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneS1, OneS2
+  };
+
+  Root2GraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                    const artis::common::NoParameters &parameters,
+                    const artis::common::NoParameters &graph_parameters
+  )
+      :
+      pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      S1("S1", artis::common::NoParameters(), artis::common::NoParameters()),
+      S2("S2", artis::common::NoParameters(), artis::common::NoParameters()) {
+    add_child(OneS1, &S1);
+    add_child(OneS2, &S2);
+
+    out({&S1, S1GraphManager::OUT}) >> in({&S2, S2GraphManager::IN});
+  }
+
+  ~Root2GraphManager() override = default;
+
+private:
+  artis::pdevs::Coordinator<common::DoubleTime, Linear2GraphManager> S1;
+  artis::pdevs::Coordinator<common::DoubleTime, Linear2GraphManager> S2;
+};
+
+class Root3GraphManager : public pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneS1, OneS2
+  };
+
+  Root3GraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                    const artis::common::NoParameters &parameters,
+                    const artis::common::NoParameters &graph_parameters
+  )
+      :
+      pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      S1("S1", artis::common::NoParameters(), artis::common::NoParameters()),
+      S2("S2", artis::common::NoParameters(), artis::common::NoParameters()) {
+    add_child(OneS1, &S1);
+    add_child(OneS2, &S2);
+
+    out({&S1, S1GraphManager::OUT}) >> in({&S2, S2GraphManager::IN});
+  }
+
+  ~Root3GraphManager() override = default;
+
+private:
+  artis::pdevs::Coordinator<common::DoubleTime, Linear2GraphManager> S1;
+  artis::pdevs::Coordinator<common::DoubleTime, Linear2GraphManager> S2;
+};
+
+}
+}
 } // namespace artis tests mixed
 
 #endif

+ 491 - 508
src/tests/mixed/models.hpp

@@ -36,684 +36,667 @@
 #include <artis-star/kernel/pdevs/Dynamics.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace mixed {
-
-            class A1 :
-                    public artis::pdevs::Dynamics<common::DoubleTime, A1> {
-            public:
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                A1(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, A1, artis::common::NoParameters>& context)
-                        :
-                        artis::pdevs::Dynamics<common::DoubleTime, A1>(name, context), _value(0)
-                {
-                    input_ports({{IN, "in"}});
-                    output_ports({{OUT, "out"}});
-                }
-
-                ~A1() override = default;
-
-                void dint(const typename common::DoubleTime::type& t) override
-                {
+namespace tests {
+namespace mixed {
+
+class A1 :
+    public artis::pdevs::Dynamics<common::DoubleTime, A1> {
+public:
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  A1(const std::string &name,
+     const artis::pdevs::Context<common::DoubleTime, A1, artis::common::NoParameters> &context)
+      :
+      artis::pdevs::Dynamics<common::DoubleTime, A1>(name, context), _value(0) {
+    input_ports({{IN, "in"}});
+    output_ports({{OUT, "out"}});
+  }
+
+  ~A1() override = default;
+
+  void dint(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_INT,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_INT,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == SEND or _phase == INIT) {
-                        _phase = WAIT;
-                    }
-                }
+    if (_phase == SEND or _phase == INIT) {
+      _phase = WAIT;
+    }
+  }
 
-                void
-                dext(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& /* e */,
-                        const common::Bag<common::DoubleTime>& bag) override
-                {
+  void
+  dext(const typename common::DoubleTime::type &t,
+       const typename common::DoubleTime::type & /* e */,
+       const common::Bag<common::DoubleTime> &bag) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)bag;
+    (void)t;
+    (void)bag;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_EXT,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_EXT,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = SEND;
-                }
+    _phase = SEND;
+  }
 
-                void dconf(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& /* e */,
-                        const common::Bag<common::DoubleTime>& bag) override
-                {
+  void dconf(const typename common::DoubleTime::type &t,
+             const typename common::DoubleTime::type & /* e */,
+             const common::Bag<common::DoubleTime> &bag) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)bag;
+    (void)t;
+    (void)bag;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_CONF,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_CONF,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
-                }
+  }
 
-                void start(const typename common::DoubleTime::type& t) override
-                {
+  void start(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
-#endif
-                    _phase = INIT;
-                }
-
-                typename common::DoubleTime::type
-                ta(const typename common::DoubleTime::type& t) const override
-                {
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::START,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
+#endif
+    _phase = INIT;
+  }
+
+  typename common::DoubleTime::type
+  ta(const typename common::DoubleTime::type &t) const override {
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::TA,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
-#endif
-                    if (_phase == WAIT) {
-                        return 3;
-                    } else {
-                        return 0;
-                    }
-                }
-
-                common::Bag<common::DoubleTime>
-                lambda(const typename common::DoubleTime::type& t) const override
-                {
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::TA,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
+#endif
+    if (_phase == WAIT) {
+      return 3;
+    } else {
+      return 0;
+    }
+  }
+
+  common::Bag<common::DoubleTime>
+  lambda(const typename common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
-                    common::Bag<common::DoubleTime> bag;
+    common::Bag<common::DoubleTime> bag;
 
-                    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
+    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::LAMBDA,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
-#endif
-
-                    return bag;
-                }
-
-            private:
-                enum Phase {
-                    INIT, WAIT, SEND
-                };
-
-                Phase _phase;
-                double _value;
-            };
-
-            class B1 :
-                    public artis::pdevs::Dynamics<common::DoubleTime, B1> {
-            public:
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                B1(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, B1, artis::common::NoParameters>& context)
-                        :
-                        artis::pdevs::Dynamics<common::DoubleTime, B1>(name, context)
-                {
-                    input_ports({{IN, "in"}});
-                    output_ports({{OUT, "out"}});
-                }
-
-                ~B1() override = default;
-
-                void dint(const typename common::DoubleTime::type& t) override
-                {
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::LAMBDA,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
+#endif
+
+    return bag;
+  }
+
+private:
+  enum Phase {
+    INIT, WAIT, SEND
+  };
+
+  Phase _phase;
+  double _value;
+};
+
+class B1 :
+    public artis::pdevs::Dynamics<common::DoubleTime, B1> {
+public:
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  B1(const std::string &name,
+     const artis::pdevs::Context<common::DoubleTime, B1, artis::common::NoParameters> &context)
+      :
+      artis::pdevs::Dynamics<common::DoubleTime, B1>(name, context) {
+    input_ports({{IN, "in"}});
+    output_ports({{OUT, "out"}});
+  }
+
+  ~B1() override = default;
+
+  void dint(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_INT,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_INT,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == SEND or _phase == INIT) {
-                        _phase = WAIT;
-                    }
-                }
+    if (_phase == SEND or _phase == INIT) {
+      _phase = WAIT;
+    }
+  }
 
-                void
-                dext(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& e,
-                        const common::Bag<common::DoubleTime>& bag) override
-                {
+  void
+  dext(const typename common::DoubleTime::type &t,
+       const typename common::DoubleTime::type &e,
+       const common::Bag<common::DoubleTime> &bag) override {
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_EXT,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
-#endif
-
-                    std::for_each(bag.begin(), bag.end(),
-                            [this, t, e](
-                                    const common::ExternalEvent<common::DoubleTime>& /* event */) {
-                                ++_count;
-                            });
-                    _phase = SEND;
-                }
-
-                void dconf(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& e,
-                        const common::Bag<common::DoubleTime>& bag) override
-                {
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_EXT,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
+#endif
+
+    std::for_each(bag.begin(), bag.end(),
+                  [this, t, e](
+                      const common::ExternalEvent<common::DoubleTime> & /* event */) {
+                    ++_count;
+                  });
+    _phase = SEND;
+  }
+
+  void dconf(const typename common::DoubleTime::type &t,
+             const typename common::DoubleTime::type &e,
+             const common::Bag<common::DoubleTime> &bag) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)bag;
+    (void)t;
+    (void)bag;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_CONF,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_CONF,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    dext(t, e, bag);
-                    dint(t);
+    dext(t, e, bag);
+    dint(t);
 
-                }
+  }
 
-                void start(const typename common::DoubleTime::type& t) override
-                {
+  void start(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::START,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _count = 0;
-                    _phase = INIT;
-                }
+    _count = 0;
+    _phase = INIT;
+  }
 
-                typename common::DoubleTime::type
-                ta(const typename common::DoubleTime::type& t) const override
-                {
+  typename common::DoubleTime::type
+  ta(const typename common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::TA,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
-#endif
-
-                    if (_phase == WAIT) {
-                        return std::numeric_limits<double>::max();
-                    } else {
-                        return 0;
-                    }
-                }
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::TA,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
+#endif
+
+    if (_phase == WAIT) {
+      return std::numeric_limits<double>::max();
+    } else {
+      return 0;
+    }
+  }
 
-                common::Bag<common::DoubleTime>
-                lambda(const typename common::DoubleTime::type& t) const override
-                {
+  common::Bag<common::DoubleTime>
+  lambda(const typename common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
-                    common::Bag<common::DoubleTime> bag;
+    common::Bag<common::DoubleTime> bag;
 
-                    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _count));
+    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _count));
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::LAMBDA,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
-#endif
-
-                    return bag;
-                }
-
-            private:
-                enum Phase {
-                    INIT, WAIT, SEND
-                };
-
-                Phase _phase;
-                unsigned int _count;
-            };
-
-            class A2
-                    : public artis::dtss::Dynamics<artis::common::DoubleTime, A2, artis::dtss::Parameters<common::DoubleTime>> {
-            public:
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                A2(const std::string& name,
-                        const artis::dtss::Context<artis::common::DoubleTime, A2, artis::dtss::Parameters<common::DoubleTime>>& context)
-                        :
-                        artis::dtss::Dynamics<artis::common::DoubleTime, A2, artis::dtss::Parameters<common::DoubleTime>>(
-                                name, context),
-                        _value(0)
-                {
-                    input_ports({{IN, "in"}});
-                    output_ports({{OUT, "out"}});
-                }
-
-                ~A2() override = default;
-
-                void transition(const common::Bag<common::DoubleTime>& x,
-                        const typename common::DoubleTime::type& t) override
-                {
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::LAMBDA,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
+#endif
+
+    return bag;
+  }
+
+private:
+  enum Phase {
+    INIT, WAIT, SEND
+  };
+
+  Phase _phase;
+  unsigned int _count;
+};
+
+class A2
+    : public artis::dtss::Dynamics<artis::common::DoubleTime,
+                                   A2,
+                                   artis::dtss::Parameters<common::DoubleTime>> {
+public:
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  A2(const std::string &name,
+     const artis::dtss::Context<artis::common::DoubleTime,
+                                A2,
+                                artis::dtss::Parameters<common::DoubleTime>> &context)
+      :
+      artis::dtss::Dynamics<artis::common::DoubleTime,
+                            A2,
+                            artis::dtss::Parameters<common::DoubleTime>>(
+          name, context),
+      _value(0) {
+    input_ports({{IN, "in"}});
+    output_ports({{OUT, "out"}});
+  }
+
+  ~A2() override = default;
+
+  void transition(const common::Bag<common::DoubleTime> &x,
+                  const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)x;
-                    (void)t;
+    (void)x;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::TRANSITION,
-                                    common::LevelType::USER)
-                            << "x = " << x.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DTSS,
+                                                    common::FunctionType::TRANSITION,
+                                                    common::LevelType::USER)
+        << "x = " << x.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                }
+  }
 
-                void start(const typename common::DoubleTime::type& t) override
-                {
+  void start(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DTSS,
+                                                    common::FunctionType::START,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
-                }
+  }
 
-                common::Bag<common::DoubleTime>
-                lambda(const typename common::DoubleTime::type& t) const override
-                {
+  common::Bag<common::DoubleTime>
+  lambda(const typename common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
-                    common::Bag<common::DoubleTime> bag;
+    common::Bag<common::DoubleTime> bag;
 
-                    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
+    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::LAMBDA,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
-#endif
-
-                    return bag;
-                }
-
-            private:
-                double _value;
-            };
-
-            class B2
-                    : public artis::dtss::Dynamics<artis::common::DoubleTime, B2, artis::dtss::Parameters<common::DoubleTime>> {
-            public:
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                B2(const std::string& name,
-                        const artis::dtss::Context<artis::common::DoubleTime, B2, artis::dtss::Parameters<common::DoubleTime>>& context)
-                        :
-                        artis::dtss::Dynamics<artis::common::DoubleTime, B2, artis::dtss::Parameters<common::DoubleTime>>(
-                                name, context),
-                        _value(0)
-                {
-                    input_ports({{IN, "in"}});
-                    output_ports({{OUT, "out"}});
-                }
-
-                ~B2() override = default;
-
-                void transition(const common::Bag<common::DoubleTime>& x,
-                        const typename common::DoubleTime::type& t) override
-                {
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DTSS,
+                                                    common::FunctionType::LAMBDA,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
+#endif
+
+    return bag;
+  }
+
+private:
+  double _value;
+};
+
+class B2
+    : public artis::dtss::Dynamics<artis::common::DoubleTime,
+                                   B2,
+                                   artis::dtss::Parameters<common::DoubleTime>> {
+public:
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  B2(const std::string &name,
+     const artis::dtss::Context<artis::common::DoubleTime,
+                                B2,
+                                artis::dtss::Parameters<common::DoubleTime>> &context)
+      :
+      artis::dtss::Dynamics<artis::common::DoubleTime,
+                            B2,
+                            artis::dtss::Parameters<common::DoubleTime>>(
+          name, context),
+      _value(0) {
+    input_ports({{IN, "in"}});
+    output_ports({{OUT, "out"}});
+  }
+
+  ~B2() override = default;
+
+  void transition(const common::Bag<common::DoubleTime> &x,
+                  const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)x;
-                    (void)t;
+    (void)x;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::TRANSITION,
-                                    common::LevelType::USER)
-                            << "x = " << x.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DTSS,
+                                                    common::FunctionType::TRANSITION,
+                                                    common::LevelType::USER)
+        << "x = " << x.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                }
+  }
 
-                void start(const typename common::DoubleTime::type& t) override
-                {
+  void start(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(
-                                    get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(
+            get_name(), t,
+            common::FormalismType::DTSS,
+            common::FunctionType::START,
+            common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                }
+  }
 
-                common::Bag<common::DoubleTime>
-                lambda(const typename common::DoubleTime::type& t) const override
-                {
+  common::Bag<common::DoubleTime>
+  lambda(const typename common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
-                    common::Bag<common::DoubleTime> bag;
+    common::Bag<common::DoubleTime> bag;
 
-                    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
+    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::DTSS,
-                                    common::FunctionType::LAMBDA,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
-#endif
-
-                    return bag;
-                }
-
-            private:
-                double _value;
-            };
-
-            class Beep :
-                    public artis::pdevs::Dynamics<common::DoubleTime, Beep> {
-            public:
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                Beep(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, Beep, artis::common::NoParameters>& context)
-                        :
-                        artis::pdevs::Dynamics<common::DoubleTime, Beep>(name, context), _value(0)
-                {
-                    input_ports({{IN, "in"}});
-                    output_ports({{OUT, "out"}});
-                }
-
-                ~Beep() override = default;
-
-                void dint(const typename common::DoubleTime::type& t) override
-                {
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::DTSS,
+                                                    common::FunctionType::LAMBDA,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
+#endif
+
+    return bag;
+  }
+
+private:
+  double _value;
+};
+
+class Beep :
+    public artis::pdevs::Dynamics<common::DoubleTime, Beep> {
+public:
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  Beep(const std::string &name,
+       const artis::pdevs::Context<common::DoubleTime, Beep, artis::common::NoParameters> &context)
+      :
+      artis::pdevs::Dynamics<common::DoubleTime, Beep>(name, context), _value(0) {
+    input_ports({{IN, "in"}});
+    output_ports({{OUT, "out"}});
+  }
+
+  ~Beep() override = default;
+
+  void dint(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_INT,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_INT,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == SEND or _phase == INIT) {
-                        _phase = WAIT;
-                    }
-                }
+    if (_phase == SEND or _phase == INIT) {
+      _phase = WAIT;
+    }
+  }
 
-                void
-                dext(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& /* e */,
-                        const common::Bag<common::DoubleTime>& bag) override
-                {
+  void
+  dext(const typename common::DoubleTime::type &t,
+       const typename common::DoubleTime::type & /* e */,
+       const common::Bag<common::DoubleTime> &bag) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)bag;
+    (void)t;
+    (void)bag;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_EXT,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_EXT,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = SEND;
-                }
+    _phase = SEND;
+  }
 
-                void dconf(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& /* e */,
-                        const common::Bag<common::DoubleTime>& bag) override
-                {
+  void dconf(const typename common::DoubleTime::type &t,
+             const typename common::DoubleTime::type & /* e */,
+             const common::Bag<common::DoubleTime> &bag) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)bag;
+    (void)t;
+    (void)bag;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_CONF,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_CONF,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                }
+  }
 
-                void start(const typename common::DoubleTime::type& t) override
-                {
+  void start(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::START,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = INIT;
-                }
+    _phase = INIT;
+  }
 
-                typename common::DoubleTime::type
-                ta(const typename common::DoubleTime::type& t) const override
-                {
+  typename common::DoubleTime::type
+  ta(const typename common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::TA,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
-#endif
-
-                    if (_phase == WAIT) {
-                        return (rand() % 100) / 10.;
-                    } else {
-                        return 0;
-                    }
-                }
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::TA,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
+#endif
+
+    if (_phase == WAIT) {
+      return (rand() % 100) / 10.;
+    } else {
+      return 0;
+    }
+  }
 
-                common::Bag<common::DoubleTime>
-                lambda(const typename common::DoubleTime::type& t) const override
-                {
+  common::Bag<common::DoubleTime>
+  lambda(const typename common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
-                    common::Bag<common::DoubleTime> bag;
+    common::Bag<common::DoubleTime> bag;
 
-                    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
+    bag.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::LAMBDA,
-                                    common::LevelType::USER)
-                            << "messages = " << bag.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::LAMBDA,
+                                                    common::LevelType::USER)
+        << "messages = " << bag.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    return bag;
-                }
+    return bag;
+  }
 
-            private:
-                enum Phase {
-                    INIT, WAIT, SEND
-                };
+private:
+  enum Phase {
+    INIT, WAIT, SEND
+  };
 
-                Phase _phase;
-                double _value;
-            };
+  Phase _phase;
+  double _value;
+};
 
-        }
-    }
+}
+}
 } // namespace artis tests mixed
 
 #endif

+ 119 - 120
src/tests/mixed/tests.cpp

@@ -36,141 +36,140 @@
 using namespace artis::tests::mixed;
 using namespace artis::common;
 
-TEST_CASE("mixed/hierachical", "run")
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 100);
-    artis::common::RootCoordinator<
-            DoubleTime,
-            artis::pdevs::Coordinator<
-                    DoubleTime,
-                    RootGraphManager>
-    > rc(context, "root");
+TEST_CASE("mixed/hierachical", "run") {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 100);
+  artis::common::RootCoordinator<
+      DoubleTime,
+      artis::pdevs::Coordinator<
+          DoubleTime,
+          RootGraphManager>
+  > rc(context, "root");
 
-    artis::common::Trace<DoubleTime>::trace().clear();
-    rc.run(context);
+  artis::common::Trace<DoubleTime>::trace().clear();
+  rc.run(context);
 
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("b1").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("b2").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("b1").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("b2").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
 
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").
-            filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 0);
-    for (double t = 0; t <= 100; t = t + 3) {
-        REQUIRE(artis::common::Trace<
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").
+      filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 0);
+  for (double t = 0; t <= 100; t = t + 3) {
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("a1").filter_time(t).
-                        filter_level_type(artis::common::LevelType::USER).
-                        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-        REQUIRE(artis::common::Trace<
+                    filter_model_name("a1").filter_time(t).
+                    filter_level_type(artis::common::LevelType::USER).
+                    filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("a1").filter_time(t).
-                        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
-        if (t == 0) {
-            REQUIRE(artis::common::Trace<
-                    DoubleTime > ::trace().elements().
-                            filter_model_name("a1").filter_time(t).
-                            filter_function_type(artis::common::FunctionType::TA).size() == 2);
-        } else {
-            REQUIRE(artis::common::Trace<
-                    DoubleTime > ::trace().elements().
-                            filter_model_name("a1").filter_time(t).
-                            filter_function_type(artis::common::FunctionType::TA).size() == 1);
-        }
+                    filter_model_name("a1").filter_time(t).
+                    filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
+    if (t == 0) {
+      REQUIRE(artis::common::Trace<
+                  DoubleTime > ::trace().elements().
+                      filter_model_name("a1").filter_time(t).
+                      filter_function_type(artis::common::FunctionType::TA).size() == 2);
+    } else {
+      REQUIRE(artis::common::Trace<
+                  DoubleTime > ::trace().elements().
+                      filter_model_name("a1").filter_time(t).
+                      filter_function_type(artis::common::FunctionType::TA).size() == 1);
     }
+  }
 
-    for (double t = 0; t <= 100; t = t + 3) {
-        REQUIRE(artis::common::Trace<
+  for (double t = 0; t <= 100; t = t + 3) {
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("b1").filter_time(t).
-                        filter_level_type(artis::common::LevelType::USER).
-                        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-        REQUIRE(artis::common::Trace<
+                    filter_model_name("b1").filter_time(t).
+                    filter_level_type(artis::common::LevelType::USER).
+                    filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("b1").filter_time(t).
-                        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
-        REQUIRE(artis::common::Trace<
+                    filter_model_name("b1").filter_time(t).
+                    filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("b1").filter_time(t).
-                        filter_function_type(artis::common::FunctionType::TA).size() == 2);
-        REQUIRE(artis::common::Trace<
+                    filter_model_name("b1").filter_time(t).
+                    filter_function_type(artis::common::FunctionType::TA).size() == 2);
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("b1").filter_time(t).
-                        filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
-    }
+                    filter_model_name("b1").filter_time(t).
+                    filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+  }
 
-    for (unsigned int t = 0; t <= 100; t += 2) {
-        REQUIRE(artis::common::Trace<
-                DoubleTime > ::trace().elements().
-                        filter_model_name("a2").filter_time(t).
-                        filter_level_type(artis::common::LevelType::USER).
-                        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-        REQUIRE(artis::common::Trace<
-                DoubleTime > ::trace().elements().
-                        filter_model_name("a2").filter_time(t).
-                        filter_function_type(artis::common::FunctionType::TRANSITION).size() == 1);
-    }
+  for (unsigned int t = 0; t <= 100; t += 2) {
     REQUIRE(artis::common::Trace<
-            DoubleTime > ::trace().elements().
-                    filter_model_name("a2").filter_time(0).
-                    filter_function_type(artis::common::FunctionType::TRANSITION).at(
-                    0).get_comment()
-                    == "x = { ( 0 , a2 , 0 ) }");
-    REQUIRE(artis::common::Trace<
-            DoubleTime > ::trace().elements().
-                    filter_model_name("a2").filter_time(2).
-                    filter_function_type(artis::common::FunctionType::TRANSITION).at(
-                    0).get_comment()
-                    == "x = { }");
-    REQUIRE(artis::common::Trace<
-            DoubleTime > ::trace().elements().
-                    filter_model_name("a2").filter_time(4).
-                    filter_function_type(artis::common::FunctionType::TRANSITION).at(
-                    0).get_comment()
-                    == "x = { ( 0 , a2 , 2 ) }");
-    REQUIRE(artis::common::Trace<
-            DoubleTime > ::trace().elements().
-                    filter_model_name("a2").filter_time(6).
-                    filter_function_type(artis::common::FunctionType::TRANSITION).at(
-                    0).get_comment()
-                    == "x = { }");
-    REQUIRE(artis::common::Trace<
-            DoubleTime > ::trace().elements().
-                    filter_model_name("a2").filter_time(8).
-                    filter_function_type(artis::common::FunctionType::TRANSITION).at(
-                    0).get_comment()
-                    == "x = { ( 0 , a2 , 3 ) }");
-    REQUIRE(artis::common::Trace<
-            DoubleTime > ::trace().elements().
-                    filter_model_name("a2").filter_time(10).
-                    filter_function_type(artis::common::FunctionType::TRANSITION).at(
-                    0).get_comment()
-                    == "x = { ( 0 , a2 , 4 ) }");
+                DoubleTime > ::trace().elements().
+                    filter_model_name("a2").filter_time(t).
+                    filter_level_type(artis::common::LevelType::USER).
+                    filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
     REQUIRE(artis::common::Trace<
-            DoubleTime > ::trace().elements().
-                    filter_model_name("a2").filter_time(12).
-                    filter_function_type(artis::common::FunctionType::TRANSITION).at(
-                    0).get_comment()
-                    == "x = { }");
+                DoubleTime > ::trace().elements().
+                    filter_model_name("a2").filter_time(t).
+                    filter_function_type(artis::common::FunctionType::TRANSITION).size() == 1);
+  }
+  REQUIRE(artis::common::Trace<
+              DoubleTime > ::trace().elements().
+                  filter_model_name("a2").filter_time(0).
+                  filter_function_type(artis::common::FunctionType::TRANSITION).at(
+                  0).get_comment()
+                  == "x = { ( 0 , a2 , 0 ) }");
+  REQUIRE(artis::common::Trace<
+              DoubleTime > ::trace().elements().
+                  filter_model_name("a2").filter_time(2).
+                  filter_function_type(artis::common::FunctionType::TRANSITION).at(
+                  0).get_comment()
+                  == "x = { }");
+  REQUIRE(artis::common::Trace<
+              DoubleTime > ::trace().elements().
+                  filter_model_name("a2").filter_time(4).
+                  filter_function_type(artis::common::FunctionType::TRANSITION).at(
+                  0).get_comment()
+                  == "x = { ( 0 , a2 , 2 ) }");
+  REQUIRE(artis::common::Trace<
+              DoubleTime > ::trace().elements().
+                  filter_model_name("a2").filter_time(6).
+                  filter_function_type(artis::common::FunctionType::TRANSITION).at(
+                  0).get_comment()
+                  == "x = { }");
+  REQUIRE(artis::common::Trace<
+              DoubleTime > ::trace().elements().
+                  filter_model_name("a2").filter_time(8).
+                  filter_function_type(artis::common::FunctionType::TRANSITION).at(
+                  0).get_comment()
+                  == "x = { ( 0 , a2 , 3 ) }");
+  REQUIRE(artis::common::Trace<
+              DoubleTime > ::trace().elements().
+                  filter_model_name("a2").filter_time(10).
+                  filter_function_type(artis::common::FunctionType::TRANSITION).at(
+                  0).get_comment()
+                  == "x = { ( 0 , a2 , 4 ) }");
+  REQUIRE(artis::common::Trace<
+              DoubleTime > ::trace().elements().
+                  filter_model_name("a2").filter_time(12).
+                  filter_function_type(artis::common::FunctionType::TRANSITION).at(
+                  0).get_comment()
+                  == "x = { }");
 
-    for (unsigned int t = 0; t <= 100; t += 2) {
-        REQUIRE(artis::common::Trace<
+  for (unsigned int t = 0; t <= 100; t += 2) {
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("b2").filter_time(t).
-                        filter_level_type(artis::common::LevelType::USER).
-                        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-        REQUIRE(artis::common::Trace<
+                    filter_model_name("b2").filter_time(t).
+                    filter_level_type(artis::common::LevelType::USER).
+                    filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+    REQUIRE(artis::common::Trace<
                 DoubleTime > ::trace().elements().
-                        filter_model_name("b2").filter_time(t).
-                        filter_function_type(artis::common::FunctionType::TRANSITION).size() == 1);
-    }
+                    filter_model_name("b2").filter_time(t).
+                    filter_function_type(artis::common::FunctionType::TRANSITION).size() == 1);
+  }
 }

+ 360 - 357
src/tests/mpi/graph_manager.hpp

@@ -44,370 +44,373 @@
 // #include <tests/boost_graph/graph_defs.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace mpi {
-
-            class S1GraphManager : public artis::pdevs::mpi::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneA, OneB
-                };
-                enum outputs {
-                    OUT
-                };
-
-                S1GraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::mpi::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        a("a1", parameters), b("b1", parameters)
-                {
-                    add_child(OneA, &a);
-                    add_child(OneB, &b);
-
-                    coordinator->output_port({OUT, "out"});
-
-                    out({&a, pdevs::A::OUT}) >> in({&b, pdevs::B::IN});
-                    out({&b, pdevs::B::OUT}) >> out({coordinator, OUT});
-                }
-
-                ~S1GraphManager() override = default;
-
-            private:
-                artis::pdevs::Simulator<common::DoubleTime, pdevs::A> a;
-                artis::pdevs::Simulator<common::DoubleTime, pdevs::B> b;
-            };
-
-            class S2GraphManager :
-                    public artis::pdevs::mpi::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneA, OneB
-                };
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                S2GraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::mpi::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        a("a2", parameters), b("b2", parameters)
-                {
-                    add_child(OneA, &a);
-                    add_child(OneB, &b);
-
-                    coordinator->input_port({IN, "in"});
-                    coordinator->output_port({OUT, "out"});
-
-                    in({coordinator, IN}) >> in({&a, pdevs::A::IN});
-                    out({&a, pdevs::A::OUT}) >> in({&b, pdevs::B::IN});
-                    out({&b, pdevs::B::OUT}) >> out({coordinator, OUT});
-                }
-
-                ~S2GraphManager() override = default;
-
-            private:
-                artis::pdevs::Simulator<common::DoubleTime, pdevs::A> a;
-                artis::pdevs::Simulator<common::DoubleTime, pdevs::B> b;
-            };
-
-            struct RootGraphManagerParameters {
-                std::vector<int> ranks;
-            };
-
-            class RootGraphManager
-                    : public artis::pdevs::GraphManager<common::DoubleTime, artis::common::NoParameters, RootGraphManagerParameters> {
-            public:
-                RootGraphManager(
-                        common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const RootGraphManagerParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime, artis::common::NoParameters, RootGraphManagerParameters>(
-                                coordinator, parameters, graph_parameters)
-                {
-                    ModelProxy* previous = nullptr;
-                    unsigned int i = 0;
-
-                    for (auto it = graph_parameters.ranks.begin(); it != graph_parameters.ranks.end(); ++it) {
-                        std::stringstream ss;
-                        ModelProxy* model = nullptr;
-
-                        ss << "S" << *it;
-                        model = new ModelProxy(ss.str(), *it, false);
-                        models.push_back(model);
-                        add_child(i, model);
-                        if (i == 0) {
-                            model->add_out_port({S1GraphManager::OUT, "out"});
-                        } else {
-                            model->add_out_port({S2GraphManager::OUT, "out"});
-                            model->add_in_port({S2GraphManager::IN, "in"});
-                            if (i == 1) {
-                                out({previous, S1GraphManager::OUT}) >> in({model, S2GraphManager::IN});
-                            } else {
-                                out({previous, S2GraphManager::OUT}) >> in({model, S2GraphManager::IN});
-                            }
-                        }
-                        previous = model;
-                        ++i;
-                    }
-                }
-
-                ~RootGraphManager() override
-                {
-                    std::for_each(models.begin(), models.end(), std::default_delete<ModelProxy>());
-                }
-
-            private:
-                typedef artis::pdevs::mpi::ModelProxy<common::DoubleTime> ModelProxy;
-                typedef std::vector<ModelProxy*> ModelProxies;
-
-                ModelProxies models;
-            };
+namespace tests {
+namespace mpi {
+
+class S1GraphManager : public artis::pdevs::mpi::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneA, OneB
+  };
+  enum outputs {
+    OUT
+  };
+
+  S1GraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                 const artis::common::NoParameters &parameters,
+                 const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::mpi::GraphManager<common::DoubleTime>(coordinator,
+                                                          parameters,
+                                                          graph_parameters),
+      a("a1", parameters), b("b1", parameters) {
+    add_child(OneA, &a);
+    add_child(OneB, &b);
+
+    coordinator->output_port({OUT, "out"});
+
+    out({&a, pdevs::A::OUT}) >> in({&b, pdevs::B::IN});
+    out({&b, pdevs::B::OUT}) >> out({coordinator, OUT});
+  }
+
+  ~S1GraphManager() override = default;
+
+private:
+  artis::pdevs::Simulator<common::DoubleTime, pdevs::A> a;
+  artis::pdevs::Simulator<common::DoubleTime, pdevs::B> b;
+};
+
+class S2GraphManager :
+    public artis::pdevs::mpi::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneA, OneB
+  };
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  S2GraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                 const artis::common::NoParameters &parameters,
+                 const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::mpi::GraphManager<common::DoubleTime>(coordinator,
+                                                          parameters,
+                                                          graph_parameters),
+      a("a2", parameters), b("b2", parameters) {
+    add_child(OneA, &a);
+    add_child(OneB, &b);
+
+    coordinator->input_port({IN, "in"});
+    coordinator->output_port({OUT, "out"});
+
+    in({coordinator, IN}) >> in({&a, pdevs::A::IN});
+    out({&a, pdevs::A::OUT}) >> in({&b, pdevs::B::IN});
+    out({&b, pdevs::B::OUT}) >> out({coordinator, OUT});
+  }
+
+  ~S2GraphManager() override = default;
+
+private:
+  artis::pdevs::Simulator<common::DoubleTime, pdevs::A> a;
+  artis::pdevs::Simulator<common::DoubleTime, pdevs::B> b;
+};
+
+struct RootGraphManagerParameters {
+  std::vector<int> ranks;
+};
+
+class RootGraphManager
+    : public artis::pdevs::GraphManager<common::DoubleTime,
+                                        artis::common::NoParameters,
+                                        RootGraphManagerParameters> {
+public:
+  RootGraphManager(
+      common::Coordinator<common::DoubleTime> *coordinator,
+      const artis::common::NoParameters &parameters,
+      const RootGraphManagerParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime,
+                                 artis::common::NoParameters,
+                                 RootGraphManagerParameters>(
+          coordinator, parameters, graph_parameters) {
+    ModelProxy *previous = nullptr;
+    unsigned int i = 0;
+
+    for (auto it = graph_parameters.ranks.begin(); it != graph_parameters.ranks.end(); ++it) {
+      std::stringstream ss;
+      ModelProxy *model = nullptr;
+
+      ss << "S" << *it;
+      model = new ModelProxy(ss.str(), *it, false);
+      models.push_back(model);
+      add_child(i, model);
+      if (i == 0) {
+        model->add_out_port({S1GraphManager::OUT, "out"});
+      } else {
+        model->add_out_port({S2GraphManager::OUT, "out"});
+        model->add_in_port({S2GraphManager::IN, "in"});
+        if (i == 1) {
+          out({previous, S1GraphManager::OUT}) >> in({model, S2GraphManager::IN});
+        } else {
+          out({previous, S2GraphManager::OUT}) >> in({model, S2GraphManager::IN});
+        }
+      }
+      previous = model;
+      ++i;
+    }
+  }
+
+  ~RootGraphManager() override {
+    std::for_each(models.begin(), models.end(), std::default_delete<ModelProxy>());
+  }
+
+private:
+  typedef artis::pdevs::mpi::ModelProxy<common::DoubleTime> ModelProxy;
+  typedef std::vector<ModelProxy *> ModelProxies;
+
+  ModelProxies models;
+};
 
 /******************************************************************************/
 
-            class S1LocalGraphManager : public artis::pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneA, OneB
-                };
-                enum outputs {
-                    OUT
-                };
-
-                S1LocalGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        a("a1", parameters), b("b1", parameters)
-                {
-                    add_child(OneA, &a);
-                    add_child(OneB, &b);
-
-                    coordinator->output_port({OUT, "out"});
-
-                    out({&a, pdevs::A::OUT}) >> in({&b, pdevs::B::IN});
-                    out({&b, pdevs::B::OUT}) >> out({coordinator, OUT});
-                }
-
-                ~S1LocalGraphManager() override = default;
-
-                void init() { }
-
-                void start(common::DoubleTime::type /* t */) { }
-
-                void transition(const common::Models<common::DoubleTime>& /* receivers */,
-                        common::DoubleTime::type /* t */) { }
-
-            private:
-                artis::pdevs::Simulator<common::DoubleTime, pdevs::A> a;
-                artis::pdevs::Simulator<common::DoubleTime, pdevs::B> b;
-            };
-
-            class S2LocalGraphManager :
-                    public artis::pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneA, OneB
-                };
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                S2LocalGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        a("a2", parameters), b("b2", parameters)
-                {
-                    add_child(OneA, &a);
-                    add_child(OneB, &b);
-
-                    coordinator->input_port({IN, "in"});
-                    coordinator->output_port({OUT, "out"});
-
-                    in({coordinator, IN}) >> in({&a, pdevs::A::IN});
-                    out({&a, pdevs::A::OUT}) >> in({&b, pdevs::B::IN});
-                    out({&b, pdevs::B::OUT}) >> out({coordinator, OUT});
-                }
-
-                ~S2LocalGraphManager() override = default;
-
-                void init() { }
-
-                void start(common::DoubleTime::type /* t */) { }
-
-                void transition(const common::Models<common::DoubleTime>& /* receivers */,
-                        common::DoubleTime::type /* t */) { }
-
-            private:
-                artis::pdevs::Simulator<common::DoubleTime, pdevs::A> a;
-                artis::pdevs::Simulator<common::DoubleTime, pdevs::B> b;
-            };
-
-            class RootLocalGraphManager :
-                    public artis::pdevs::GraphManager<common::DoubleTime, artis::common::NoParameters, RootGraphManagerParameters> {
-            public:
-                RootLocalGraphManager(
-                        common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const RootGraphManagerParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime, artis::common::NoParameters, RootGraphManagerParameters>(
-                                coordinator, parameters, graph_parameters),
-                        first("S0", artis::common::NoParameters(), artis::common::NoParameters())
-                {
-                    Next* previous = nullptr;
-                    unsigned int i = 1;
-
-                    add_child(0, &first);
-                    for (auto rank: graph_parameters.ranks) {
-                        std::stringstream ss;
-                        Next* model = nullptr;
-
-                        ss << "S" << rank;
-                        model = new Next(ss.str(), artis::common::NoParameters(), artis::common::NoParameters());
-                        nexts.push_back(model);
-                        add_child(i, model);
-                        if (previous) {
-                            out({previous, S2GraphManager::OUT}) >> in({model, S2GraphManager::IN});
-                        }
-                        previous = model;
-                        ++i;
-                    }
-                    out({&first, S1GraphManager::OUT}) >> in({nexts[0], S2GraphManager::IN});
-                }
-
-                ~RootLocalGraphManager() override
-                {
-                    std::for_each(nexts.begin(), nexts.end(),
-                            std::default_delete<Next>());
-                }
-
-            private:
-                typedef artis::pdevs::Coordinator<common::DoubleTime, S1LocalGraphManager> First;
-                typedef artis::pdevs::Coordinator<common::DoubleTime, S2LocalGraphManager> Next;
-                typedef std::vector<Next*> Nexts;
-
-                First first;
-                Nexts nexts;
-            };
+class S1LocalGraphManager : public artis::pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneA, OneB
+  };
+  enum outputs {
+    OUT
+  };
+
+  S1LocalGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                      const artis::common::NoParameters &parameters,
+                      const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      a("a1", parameters), b("b1", parameters) {
+    add_child(OneA, &a);
+    add_child(OneB, &b);
+
+    coordinator->output_port({OUT, "out"});
+
+    out({&a, pdevs::A::OUT}) >> in({&b, pdevs::B::IN});
+    out({&b, pdevs::B::OUT}) >> out({coordinator, OUT});
+  }
+
+  ~S1LocalGraphManager() override = default;
+
+  void init() {}
+
+  void start(common::DoubleTime::type /* t */) {}
+
+  void transition(const common::Models<common::DoubleTime> & /* receivers */,
+                  common::DoubleTime::type /* t */) {}
+
+private:
+  artis::pdevs::Simulator<common::DoubleTime, pdevs::A> a;
+  artis::pdevs::Simulator<common::DoubleTime, pdevs::B> b;
+};
+
+class S2LocalGraphManager :
+    public artis::pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneA, OneB
+  };
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  S2LocalGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                      const artis::common::NoParameters &parameters,
+                      const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      a("a2", parameters), b("b2", parameters) {
+    add_child(OneA, &a);
+    add_child(OneB, &b);
+
+    coordinator->input_port({IN, "in"});
+    coordinator->output_port({OUT, "out"});
+
+    in({coordinator, IN}) >> in({&a, pdevs::A::IN});
+    out({&a, pdevs::A::OUT}) >> in({&b, pdevs::B::IN});
+    out({&b, pdevs::B::OUT}) >> out({coordinator, OUT});
+  }
+
+  ~S2LocalGraphManager() override = default;
+
+  void init() {}
+
+  void start(common::DoubleTime::type /* t */) {}
+
+  void transition(const common::Models<common::DoubleTime> & /* receivers */,
+                  common::DoubleTime::type /* t */) {}
+
+private:
+  artis::pdevs::Simulator<common::DoubleTime, pdevs::A> a;
+  artis::pdevs::Simulator<common::DoubleTime, pdevs::B> b;
+};
+
+class RootLocalGraphManager :
+    public artis::pdevs::GraphManager<common::DoubleTime,
+                                      artis::common::NoParameters,
+                                      RootGraphManagerParameters> {
+public:
+  RootLocalGraphManager(
+      common::Coordinator<common::DoubleTime> *coordinator,
+      const artis::common::NoParameters &parameters,
+      const RootGraphManagerParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime,
+                                 artis::common::NoParameters,
+                                 RootGraphManagerParameters>(
+          coordinator, parameters, graph_parameters),
+      first("S0", artis::common::NoParameters(), artis::common::NoParameters()) {
+    Next *previous = nullptr;
+    unsigned int i = 1;
+
+    add_child(0, &first);
+    for (auto rank: graph_parameters.ranks) {
+      std::stringstream ss;
+      Next *model = nullptr;
+
+      ss << "S" << rank;
+      model = new Next(ss.str(), artis::common::NoParameters(), artis::common::NoParameters());
+      nexts.push_back(model);
+      add_child(i, model);
+      if (previous) {
+        out({previous, S2GraphManager::OUT}) >> in({model, S2GraphManager::IN});
+      }
+      previous = model;
+      ++i;
+    }
+    out({&first, S1GraphManager::OUT}) >> in({nexts[0], S2GraphManager::IN});
+  }
+
+  ~RootLocalGraphManager() override {
+    std::for_each(nexts.begin(), nexts.end(),
+                  std::default_delete<Next>());
+  }
+
+private:
+  typedef artis::pdevs::Coordinator<common::DoubleTime, S1LocalGraphManager> First;
+  typedef artis::pdevs::Coordinator<common::DoubleTime, S2LocalGraphManager> Next;
+  typedef std::vector<Next *> Nexts;
+
+  First first;
+  Nexts nexts;
+};
 
 /******************************************************************************/
 
-            class RootMultithreadingGraphManager :
-                    public artis::pdevs::GraphManager<common::DoubleTime, artis::common::NoParameters, RootGraphManagerParameters> {
-                typedef artis::pdevs::multithreading::Coordinator<
-                        common::DoubleTime,
-                        RootMultithreadingGraphManager,
-                        artis::common::NoParameters,
-                        RootGraphManagerParameters> ParentCoordinator;
-
-            public:
-                RootMultithreadingGraphManager(
-                        common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const RootGraphManagerParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime, artis::common::NoParameters, RootGraphManagerParameters>(
-                                coordinator, parameters, graph_parameters),
-                        first("S0", artis::common::NoParameters(), artis::common::NoParameters())
-                {
-                    Next* previous = nullptr;
-                    unsigned int i = 1;
-
-                    add_child(0, &first);
-                    for (auto rank: graph_parameters.ranks) {
-                        std::stringstream ss;
-                        Next* model = nullptr;
-
-                        ss << "S" << rank;
-                        model = new Next(ss.str(), artis::common::NoParameters(), artis::common::NoParameters());
-                        nexts.push_back(model);
-                        add_child(i, model);
-                        if (previous) {
-                            out({previous, S2GraphManager::OUT}) >> in({model, S2GraphManager::IN});
-                        }
-                        previous = model;
-                        ++i;
-                    }
-                    out({&first, S1GraphManager::OUT}) >> in({nexts[0], S2GraphManager::IN});
-                }
-
-                ~RootMultithreadingGraphManager() override
-                {
-                    std::for_each(nexts.begin(), nexts.end(), std::default_delete<Next>());
-                }
-
-                void init()
-                {
-                    first.set_sender(dynamic_cast < ParentCoordinator* >(coordinator())->get_sender());
-                    for (Nexts::const_iterator it = nexts.begin(); it != nexts.end(); ++it) {
-                        (*it)->set_sender(dynamic_cast < ParentCoordinator*  >(coordinator())->get_sender());
-                    }
-                }
-
-                void start(common::DoubleTime::type t)
-                {
-                    first.get_sender().send(
-                            artis::pdevs::multithreading::start_message<
-                                    artis::common::DoubleTime>(t));
-                    for (Nexts::const_iterator it = nexts.begin(); it != nexts.end(); ++it) {
-                        (*it)->get_sender().send(
-                                artis::pdevs::multithreading::start_message<artis::common::DoubleTime>(t));
-                    }
-                }
-
-                void transition(const common::Models<common::DoubleTime>& receivers,
-                        artis::common::DoubleTime::type t)
-                {
-                    auto it = receivers.begin();
-
-                    while (it != receivers.end()) {
-                        if (not(*it)->is_atomic()) {
-                            Nexts::const_iterator itc = std::find(nexts.begin(), nexts.end(), *it);
-
-                            if (itc != nexts.end()) {
-                                (*itc)->get_sender().send(
-                                        artis::pdevs::multithreading::transition_message<
-                                                artis::common::DoubleTime>(t));
-                            } else {
-                                first.get_sender().send(
-                                        artis::pdevs::multithreading::transition_message<
-                                                artis::common::DoubleTime>(t));
-                            }
-                        }
-                        ++it;
-                    }
-                }
-
-            private:
-                typedef artis::pdevs::multithreading::Coordinator<common::DoubleTime, S1LocalGraphManager> First;
-                typedef artis::pdevs::multithreading::Coordinator<common::DoubleTime, S2LocalGraphManager> Next;
-                typedef std::vector<Next*> Nexts;
-
-                First first;
-                Nexts nexts;
-            };
+class RootMultithreadingGraphManager :
+    public artis::pdevs::GraphManager<common::DoubleTime,
+                                      artis::common::NoParameters,
+                                      RootGraphManagerParameters> {
+  typedef artis::pdevs::multithreading::Coordinator<
+      common::DoubleTime,
+      RootMultithreadingGraphManager,
+      artis::common::NoParameters,
+      RootGraphManagerParameters> ParentCoordinator;
+
+public:
+  RootMultithreadingGraphManager(
+      common::Coordinator<common::DoubleTime> *coordinator,
+      const artis::common::NoParameters &parameters,
+      const RootGraphManagerParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime,
+                                 artis::common::NoParameters,
+                                 RootGraphManagerParameters>(
+          coordinator, parameters, graph_parameters),
+      first("S0", artis::common::NoParameters(), artis::common::NoParameters()) {
+    Next *previous = nullptr;
+    unsigned int i = 1;
+
+    add_child(0, &first);
+    for (auto rank: graph_parameters.ranks) {
+      std::stringstream ss;
+      Next *model = nullptr;
+
+      ss << "S" << rank;
+      model = new Next(ss.str(), artis::common::NoParameters(), artis::common::NoParameters());
+      nexts.push_back(model);
+      add_child(i, model);
+      if (previous) {
+        out({previous, S2GraphManager::OUT}) >> in({model, S2GraphManager::IN});
+      }
+      previous = model;
+      ++i;
+    }
+    out({&first, S1GraphManager::OUT}) >> in({nexts[0], S2GraphManager::IN});
+  }
+
+  ~RootMultithreadingGraphManager() override {
+    std::for_each(nexts.begin(), nexts.end(), std::default_delete<Next>());
+  }
+
+  void init() {
+    first.set_sender(dynamic_cast < ParentCoordinator * >(coordinator())->get_sender());
+    for (Nexts::const_iterator it = nexts.begin(); it != nexts.end(); ++it) {
+      (*it)->set_sender(dynamic_cast < ParentCoordinator *  >(coordinator())->get_sender());
+    }
+  }
+
+  void start(common::DoubleTime::type t) {
+    first.get_sender().send(
+        artis::pdevs::multithreading::start_message<
+            artis::common::DoubleTime>(t));
+    for (Nexts::const_iterator it = nexts.begin(); it != nexts.end(); ++it) {
+      (*it)->get_sender().send(
+          artis::pdevs::multithreading::start_message<artis::common::DoubleTime>(t));
+    }
+  }
+
+  void transition(const common::Models<common::DoubleTime> &receivers,
+                  artis::common::DoubleTime::type t) {
+    auto it = receivers.begin();
+
+    while (it != receivers.end()) {
+      if (not(*it)->is_atomic()) {
+        Nexts::const_iterator itc = std::find(nexts.begin(), nexts.end(), *it);
+
+        if (itc != nexts.end()) {
+          (*itc)->get_sender().send(
+              artis::pdevs::multithreading::transition_message<
+                  artis::common::DoubleTime>(t));
+        } else {
+          first.get_sender().send(
+              artis::pdevs::multithreading::transition_message<
+                  artis::common::DoubleTime>(t));
+        }
+      }
+      ++it;
+    }
+  }
+
+private:
+  typedef artis::pdevs::multithreading::Coordinator<common::DoubleTime, S1LocalGraphManager> First;
+  typedef artis::pdevs::multithreading::Coordinator<common::DoubleTime, S2LocalGraphManager> Next;
+  typedef std::vector<Next *> Nexts;
+
+  First first;
+  Nexts nexts;
+};
 
 /******************************************************************************/
 
-            struct GridGraphManagerParameters {
-                unsigned int global_size;
-                unsigned int sub_grid_size;
-            };
+struct GridGraphManagerParameters {
+  unsigned int global_size;
+  unsigned int sub_grid_size;
+};
 
 //            class GridGraphManager :
 //                    public artis::pdevs::GraphManager<common::DoubleTime,
@@ -1020,8 +1023,8 @@ namespace artis {
 //     ModelProxies _models;
 // };
 
-        }
-    }
+}
+}
 } // namespace artis tests mpi
 
 #endif

+ 92 - 96
src/tests/mpi/main.cpp

@@ -41,137 +41,134 @@ using namespace artis::common;
 using namespace boost::mpi;
 using namespace std::chrono;
 
-void example_simple(int argc, char* argv[])
-{
-    environment env(argc, argv);
-    communicator world;
+void example_simple(int argc, char *argv[]) {
+  environment env(argc, argv);
+  communicator world;
 
-    std::cout << "START " << world.rank() << std::endl;
+  std::cout << "START " << world.rank() << std::endl;
 
-    if (world.rank() == 0) {
-        artis::tests::mpi::RootGraphManagerParameters parameters;
+  if (world.rank() == 0) {
+    artis::tests::mpi::RootGraphManagerParameters parameters;
 
-        parameters.ranks.push_back(1);
-        parameters.ranks.push_back(2);
-        parameters.ranks.push_back(3);
+    parameters.ranks.push_back(1);
+    parameters.ranks.push_back(2);
+    parameters.ranks.push_back(3);
 //        parameters.ranks.push_back(4);
 //        parameters.ranks.push_back(5);
 //        parameters.ranks.push_back(6);
 //        parameters.ranks.push_back(7);
 //        parameters.ranks.push_back(8);
 
-        artis::common::context::Context<artis::common::DoubleTime> context(0, 1000);
-        artis::common::RootCoordinator<
-                DoubleTime,
-                artis::pdevs::Coordinator<
-                        DoubleTime,
-                        artis::tests::mpi::RootGraphManager,
-                        artis::common::NoParameters,
-                        artis::tests::mpi::RootGraphManagerParameters>
-        > rc(context, "root", artis::common::NoParameters(), parameters);
+    artis::common::context::Context<artis::common::DoubleTime> context(0, 1000);
+    artis::common::RootCoordinator<
+        DoubleTime,
+        artis::pdevs::Coordinator<
+            DoubleTime,
+            artis::tests::mpi::RootGraphManager,
+            artis::common::NoParameters,
+            artis::tests::mpi::RootGraphManagerParameters>
+    > rc(context, "root", artis::common::NoParameters(), parameters);
 
-        steady_clock::time_point t1 = steady_clock::now();
+    steady_clock::time_point t1 = steady_clock::now();
 
-        rc.run(context);
+    rc.run(context);
 
-        steady_clock::time_point t2 = steady_clock::now();
+    steady_clock::time_point t2 = steady_clock::now();
 
-        duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
+    duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
+
+    std::cout << "CHAIN = " << time_span.count() << std::endl;
 
-        std::cout << "CHAIN = " << time_span.count() << std::endl;
+  } else {
+    std::stringstream ss;
 
+    ss << "S" << world.rank();
+    if (world.rank() == 1) {
+      artis::pdevs::mpi::Coordinator<
+          DoubleTime,
+          artis::tests::mpi::S1GraphManager> model(ss.str(), artis::common::NoParameters(),
+                                                   artis::common::NoParameters());
+      artis::pdevs::mpi::LogicalProcessor<DoubleTime> LP(&model, world.rank(), 0);
+
+      model.set_logical_processor(&LP);
+      LP.loop();
     } else {
-        std::stringstream ss;
-
-        ss << "S" << world.rank();
-        if (world.rank() == 1) {
-            artis::pdevs::mpi::Coordinator<
-                    DoubleTime,
-                    artis::tests::mpi::S1GraphManager> model(ss.str(), artis::common::NoParameters(),
-                    artis::common::NoParameters());
-            artis::pdevs::mpi::LogicalProcessor<DoubleTime> LP(&model, world.rank(), 0);
-
-            model.set_logical_processor(&LP);
-            LP.loop();
-        } else {
-            artis::pdevs::mpi::Coordinator<
-                    DoubleTime,
-                    artis::tests::mpi::S2GraphManager> model(ss.str(), artis::common::NoParameters(),
-                    artis::common::NoParameters());
-            artis::pdevs::mpi::LogicalProcessor<DoubleTime> LP(&model, world.rank(), 0);
-
-            model.set_logical_processor(&LP);
-            LP.loop();
-        }
+      artis::pdevs::mpi::Coordinator<
+          DoubleTime,
+          artis::tests::mpi::S2GraphManager> model(ss.str(), artis::common::NoParameters(),
+                                                   artis::common::NoParameters());
+      artis::pdevs::mpi::LogicalProcessor<DoubleTime> LP(&model, world.rank(), 0);
+
+      model.set_logical_processor(&LP);
+      LP.loop();
     }
+  }
 }
 
-void example_simple_local()
-{
-    artis::tests::mpi::RootGraphManagerParameters parameters;
+void example_simple_local() {
+  artis::tests::mpi::RootGraphManagerParameters parameters;
 
-    parameters.ranks.push_back(1);
-    parameters.ranks.push_back(2);
-    parameters.ranks.push_back(3);
+  parameters.ranks.push_back(1);
+  parameters.ranks.push_back(2);
+  parameters.ranks.push_back(3);
 //    parameters.ranks.push_back(4);
 //    parameters.ranks.push_back(5);
 //    parameters.ranks.push_back(6);
 //    parameters.ranks.push_back(7);
 //    parameters.ranks.push_back(8);
 
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 1000);
-    artis::common::RootCoordinator<
-            DoubleTime,
-            artis::pdevs::Coordinator<
-                    DoubleTime,
-                    artis::tests::mpi::RootLocalGraphManager,
-                    artis::common::NoParameters,
-                    artis::tests::mpi::RootGraphManagerParameters>
-    > rc(context, "root", artis::common::NoParameters(), parameters);
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 1000);
+  artis::common::RootCoordinator<
+      DoubleTime,
+      artis::pdevs::Coordinator<
+          DoubleTime,
+          artis::tests::mpi::RootLocalGraphManager,
+          artis::common::NoParameters,
+          artis::tests::mpi::RootGraphManagerParameters>
+  > rc(context, "root", artis::common::NoParameters(), parameters);
 
-    steady_clock::time_point t1 = steady_clock::now();
+  steady_clock::time_point t1 = steady_clock::now();
 
-    rc.run(context);
+  rc.run(context);
 
-    steady_clock::time_point t2 = steady_clock::now();
+  steady_clock::time_point t2 = steady_clock::now();
 
-    duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
+  duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
 
-    std::cout << "CHAIN = " << time_span.count() << std::endl;
+  std::cout << "CHAIN = " << time_span.count() << std::endl;
 }
 
-void example_simple_multithreading()
-{
-    artis::tests::mpi::RootGraphManagerParameters parameters;
+void example_simple_multithreading() {
+  artis::tests::mpi::RootGraphManagerParameters parameters;
 
-    parameters.ranks.push_back(1);
-    parameters.ranks.push_back(2);
-    parameters.ranks.push_back(3);
+  parameters.ranks.push_back(1);
+  parameters.ranks.push_back(2);
+  parameters.ranks.push_back(3);
 //    parameters.ranks.push_back(4);
 //    parameters.ranks.push_back(5);
 //    parameters.ranks.push_back(6);
 //    parameters.ranks.push_back(7);
 //    parameters.ranks.push_back(8);
 
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 1000);
-    artis::common::RootCoordinator<
-            DoubleTime,
-            artis::pdevs::multithreading::Coordinator<
-                    DoubleTime,
-                    artis::tests::mpi::RootMultithreadingGraphManager,
-                    artis::common::NoParameters,
-                    artis::tests::mpi::RootGraphManagerParameters>
-    > rc(context, "root", artis::common::NoParameters(), parameters);
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 1000);
+  artis::common::RootCoordinator<
+      DoubleTime,
+      artis::pdevs::multithreading::Coordinator<
+          DoubleTime,
+          artis::tests::mpi::RootMultithreadingGraphManager,
+          artis::common::NoParameters,
+          artis::tests::mpi::RootGraphManagerParameters>
+  > rc(context, "root", artis::common::NoParameters(), parameters);
 
-    steady_clock::time_point t1 = steady_clock::now();
+  steady_clock::time_point t1 = steady_clock::now();
 
-    rc.run(context);
+  rc.run(context);
 
-    steady_clock::time_point t2 = steady_clock::now();
+  steady_clock::time_point t2 = steady_clock::now();
 
-    duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
+  duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
 
-    std::cout << "CHAIN = " << time_span.count() << std::endl;
+  std::cout << "CHAIN = " << time_span.count() << std::endl;
 }
 
 //#define SUB_GRID_SIZE 32
@@ -276,16 +273,15 @@ void example_simple_multithreading()
 // in output directory:
 //  $ mpirun -np 4 -hostfile host_file ../cmake-build-debug/src/tests/mpi/pdevs-mpi-main
 
-int main(int argc, char* argv[])
-{
-    std::cout << "== MPI ==" << std::endl;
-    example_simple(argc, argv);
-    std::cout << "== Multithreading ==" << std::endl;
-    example_simple_multithreading();
-    std::cout << "== Monothreading ==" << std::endl;
-    example_simple_local();
+int main(int argc, char *argv[]) {
+  std::cout << "== MPI ==" << std::endl;
+  example_simple(argc, argv);
+  std::cout << "== Multithreading ==" << std::endl;
+  example_simple_multithreading();
+  std::cout << "== Monothreading ==" << std::endl;
+  example_simple_local();
 
-    //    example_grid(argc, argv);
+  //    example_grid(argc, argv);
 
-    return 0;
+  return 0;
 }

+ 322 - 326
src/tests/multithreading/lifegame/graph_manager.hpp

@@ -34,226 +34,225 @@
 #include <artis-star/kernel/pdevs/Simulator.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace multithreading {
-            namespace lifegame {
-
-                struct GridGraphManagerParameters {
-                    unsigned int begin_column;
-                    unsigned int end_column;
-                    unsigned int begin_line;
-                    unsigned int end_line;
-                    unsigned int min_column;
-                    unsigned int max_column;
-                    unsigned int min_line;
-                    unsigned int max_line;
-                };
-
-                class FlatGraphManager
-                        : public artis::pdevs::GraphManager<common::DoubleTime, CellParameters, GridGraphManagerParameters> {
-                public:
-                    enum submodels {
-                        CELL
-                    };
-
-                    FlatGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                            const CellParameters& parameters,
-                            const GridGraphManagerParameters& graph_parameters)
-                            :
-                            artis::pdevs::GraphManager<common::DoubleTime, CellParameters, GridGraphManagerParameters>(
-                                    coordinator, parameters, graph_parameters)
-                    {
-                        unsigned int column_number =
-                                graph_parameters.end_column - graph_parameters.begin_column + 1;
-                        unsigned int line_number =
-                                graph_parameters.end_line - graph_parameters.begin_line + 1;
-
-                        for (unsigned int i = graph_parameters.begin_column;
-                             i <= graph_parameters.end_column; ++i) {
-                            for (unsigned int j = graph_parameters.begin_line;
-                                 j <= graph_parameters.end_line; ++j) {
-                                std::ostringstream ss;
-
-                                ss << "C_" << i << "_" << j;
-
-                                auto cell = new Simulator(ss.str(), parameters);
-
-                                _cells.push_back(cell);
-                                add_children(CELL, cell);
-                            }
-                        }
-                        for (int i = 0; i < (int) column_number; ++i) {
-                            for (int j = 0; j < (int) line_number; ++j) {
-                                int index = i * (int) line_number + j;
-
-                                // north
-                                if (j - 1 >= 0) {
-                                    out({_cells[index], Cell::OUT})
-                                            >> in({_cells[i * line_number + j - 1],
-                                                   Cell::IN});
-                                }
-                                // south
-                                if (j + 1 < (int) line_number) {
-                                    out({_cells[index], Cell::OUT})
-                                            >> in({_cells[i * line_number + j + 1],
-                                                   Cell::IN});
-                                }
-                                // west
-                                if (i - 1 >= 0) {
-                                    out({_cells[index], Cell::OUT})
-                                            >> in({_cells[(i - 1) * line_number
-                                                    + j], Cell::IN});
-                                }
-                                // east
-                                if (i + 1 < (int) column_number) {
-                                    out({_cells[index], Cell::OUT})
-                                            >> in({_cells[(i + 1) * line_number
-                                                    + j], Cell::IN});
-                                }
-                                // north west
-                                if (j - 1 >= 0 and i - 1 >= 0) {
-                                    out({_cells[index], Cell::OUT})
-                                            >> in({_cells[(i - 1) * line_number + j
-                                                    - 1], Cell::IN});
-                                }
-                                // south west
-                                if (j + 1 < (int) line_number and i - 1 >= 0) {
-                                    out({_cells[index], Cell::OUT})
-                                            >> in({_cells[(i - 1) * line_number + j
-                                                    + 1], Cell::IN});
-                                }
-                                // north east
-                                if (j - 1 >= 0 and i + 1 < (int) column_number) {
-                                    out({_cells[index], Cell::OUT})
-                                            >> in({_cells[(i + 1) * line_number + j
-                                                    - 1], Cell::IN});
-                                }
-                                // south east
-                                if (j + 1 < (int) line_number and i + 1 < (int) column_number) {
-                                    out({_cells[index], Cell::OUT})
-                                            >> in({_cells[(i + 1) * line_number + j
-                                                    + 1], Cell::IN});
-                                }
-                            }
-                        }
-                    }
+namespace tests {
+namespace multithreading {
+namespace lifegame {
+
+struct GridGraphManagerParameters {
+  unsigned int begin_column;
+  unsigned int end_column;
+  unsigned int begin_line;
+  unsigned int end_line;
+  unsigned int min_column;
+  unsigned int max_column;
+  unsigned int min_line;
+  unsigned int max_line;
+};
+
+class FlatGraphManager
+    : public artis::pdevs::GraphManager<common::DoubleTime,
+                                        CellParameters,
+                                        GridGraphManagerParameters> {
+public:
+  enum submodels {
+    CELL
+  };
+
+  FlatGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                   const CellParameters &parameters,
+                   const GridGraphManagerParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime, CellParameters, GridGraphManagerParameters>(
+          coordinator, parameters, graph_parameters) {
+    unsigned int column_number =
+        graph_parameters.end_column - graph_parameters.begin_column + 1;
+    unsigned int line_number =
+        graph_parameters.end_line - graph_parameters.begin_line + 1;
+
+    for (unsigned int i = graph_parameters.begin_column;
+         i <= graph_parameters.end_column; ++i) {
+      for (unsigned int j = graph_parameters.begin_line;
+           j <= graph_parameters.end_line; ++j) {
+        std::ostringstream ss;
+
+        ss << "C_" << i << "_" << j;
+
+        auto cell = new Simulator(ss.str(), parameters);
+
+        _cells.push_back(cell);
+        add_children(CELL, cell);
+      }
+    }
+    for (int i = 0; i < (int) column_number; ++i) {
+      for (int j = 0; j < (int) line_number; ++j) {
+        int index = i * (int) line_number + j;
+
+        // north
+        if (j - 1 >= 0) {
+          out({_cells[index], Cell::OUT})
+              >> in({_cells[i * line_number + j - 1],
+                     Cell::IN});
+        }
+        // south
+        if (j + 1 < (int) line_number) {
+          out({_cells[index], Cell::OUT})
+              >> in({_cells[i * line_number + j + 1],
+                     Cell::IN});
+        }
+        // west
+        if (i - 1 >= 0) {
+          out({_cells[index], Cell::OUT})
+              >> in({_cells[(i - 1) * line_number
+                  + j], Cell::IN});
+        }
+        // east
+        if (i + 1 < (int) column_number) {
+          out({_cells[index], Cell::OUT})
+              >> in({_cells[(i + 1) * line_number
+                  + j], Cell::IN});
+        }
+        // north west
+        if (j - 1 >= 0 and i - 1 >= 0) {
+          out({_cells[index], Cell::OUT})
+              >> in({_cells[(i - 1) * line_number + j
+                  - 1], Cell::IN});
+        }
+        // south west
+        if (j + 1 < (int) line_number and i - 1 >= 0) {
+          out({_cells[index], Cell::OUT})
+              >> in({_cells[(i - 1) * line_number + j
+                  + 1], Cell::IN});
+        }
+        // north east
+        if (j - 1 >= 0 and i + 1 < (int) column_number) {
+          out({_cells[index], Cell::OUT})
+              >> in({_cells[(i + 1) * line_number + j
+                  - 1], Cell::IN});
+        }
+        // south east
+        if (j + 1 < (int) line_number and i + 1 < (int) column_number) {
+          out({_cells[index], Cell::OUT})
+              >> in({_cells[(i + 1) * line_number + j
+                  + 1], Cell::IN});
+        }
+      }
+    }
+  }
+
+  ~FlatGraphManager() override {
+    std::for_each(_cells.begin(), _cells.end(),
+                  std::default_delete<Simulator>());
+  }
+
+private:
+  typedef pdevs::Simulator<common::DoubleTime, Cell, CellParameters> Simulator;
+  typedef std::vector<Simulator *> Simulators;
+
+  Simulators _cells;
+};
+
+class ParallelBuiltFlatGraphManager : public FlatGraphManager {
+public:
+  ParallelBuiltFlatGraphManager(
+      common::Coordinator<common::DoubleTime> *coordinator,
+      const CellParameters &parameters,
+      const GridGraphManagerParameters &graph_parameters)
+      :
+      FlatGraphManager(coordinator, parameters, graph_parameters) {
+    // inputs
+    unsigned int k = 0;
+
+    // top / bottom
+    {
+      int j_top = (int) graph_parameters.begin_line - 1;
+      int j_bottom = (int) graph_parameters.end_line + 1;
+
+      for (int i = (int) graph_parameters.begin_column - 1;
+           i <= (int) graph_parameters.end_column + 1; ++i) {
+        std::ostringstream ss_out;
+
+        ++k;
+        if (i >= (int) graph_parameters.min_column
+            and i <= (int) graph_parameters.max_column
+            and j_top >= (int) graph_parameters.min_line) {
+          ss_out << "in_" << i << "_" << j_top;
+          coordinator->add_in_port({k, ss_out.str()});
+        }
+        ++k;
+        if (i >= (int) graph_parameters.min_column
+            and i <= (int) graph_parameters.max_column
+            and j_bottom <= (int) graph_parameters.max_line) {
+          ss_out << "in_" << i << "_" << j_bottom;
+          coordinator->add_in_port({k, ss_out.str()});
+        }
+      }
+    }
+    // left / right
+    {
+      int i_left = (int) graph_parameters.begin_column - 1;
+      int i_right = (int) graph_parameters.end_column + 1;
+
+      for (int j = (int) graph_parameters.begin_line;
+           j <= (int) graph_parameters.end_line; ++j) {
+        std::ostringstream ss_out;
+
+        ++k;
+        if (j >= (int) graph_parameters.min_line
+            and j <= (int) graph_parameters.max_line
+            and i_left >= (int) graph_parameters.min_column) {
+          ss_out << "out_" << i_left << "_" << j;
+          coordinator->add_in_port({k, ss_out.str()});
+        }
+        ++k;
+        if (j >= (int) graph_parameters.min_line
+            and j <= (int) graph_parameters.max_line
+            and i_right >= (int) graph_parameters.max_column) {
+          ss_out << "out_" << i_right << "_" << j;
+          coordinator->add_in_port({k, ss_out.str()});
+        }
+      }
+    }
+
+    // outputs
+    k = 0;
+
+    // top / bottom
+    {
+      int j_top = (int) graph_parameters.begin_line;
+      int j_bottom = (int) graph_parameters.end_line;
+
+      for (int i = (int) graph_parameters.begin_column;
+           i <= (int) graph_parameters.end_column; ++i) {
+        std::ostringstream ss_out;
+
+        ++k;
+        ss_out << "out_" << i << "_" << j_top;
+        coordinator->add_out_port({k, ss_out.str()});
+        ++k;
+        ss_out << "out_" << i << "_" << j_bottom;
+        coordinator->add_out_port({k, ss_out.str()});
+      }
+    }
+    // left / right
+    {
+      int i_left = (int) graph_parameters.begin_column;
+      int i_right = (int) graph_parameters.end_column;
+
+      for (int j = (int) graph_parameters.begin_line + 1;
+           j <= (int) graph_parameters.end_line - 1; ++j) {
+        std::ostringstream ss_out;
+
+        ++k;
+        ss_out << "out_" << i_left << "_" << j;
+        coordinator->add_out_port({k, ss_out.str()});
+        ++k;
+        ss_out << "out_" << i_right << "_" << j;
+        coordinator->add_out_port({k, ss_out.str()});
+      }
+    }
 
-                    ~FlatGraphManager() override
-                    {
-                        std::for_each(_cells.begin(), _cells.end(),
-                                std::default_delete<Simulator>());
-                    }
 
-                private:
-                    typedef pdevs::Simulator<common::DoubleTime, Cell, CellParameters> Simulator;
-                    typedef std::vector<Simulator*> Simulators;
-
-                    Simulators _cells;
-                };
-
-                class ParallelBuiltFlatGraphManager : public FlatGraphManager {
-                public:
-                    ParallelBuiltFlatGraphManager(
-                            common::Coordinator<common::DoubleTime>* coordinator,
-                            const CellParameters& parameters,
-                            const GridGraphManagerParameters& graph_parameters)
-                            :
-                            FlatGraphManager(coordinator, parameters, graph_parameters)
-                    {
-                        // inputs
-                        unsigned int k = 0;
-
-                        // top / bottom
-                        {
-                            int j_top = (int) graph_parameters.begin_line - 1;
-                            int j_bottom = (int) graph_parameters.end_line + 1;
-
-                            for (int i = (int) graph_parameters.begin_column - 1;
-                                 i <= (int) graph_parameters.end_column + 1; ++i) {
-                                std::ostringstream ss_out;
-
-                                ++k;
-                                if (i >= (int) graph_parameters.min_column
-                                        and i <= (int) graph_parameters.max_column
-                                        and j_top >= (int) graph_parameters.min_line) {
-                                    ss_out << "in_" << i << "_" << j_top;
-                                    coordinator->add_in_port({k, ss_out.str()});
-                                }
-                                ++k;
-                                if (i >= (int) graph_parameters.min_column
-                                        and i <= (int) graph_parameters.max_column
-                                        and j_bottom <= (int) graph_parameters.max_line) {
-                                    ss_out << "in_" << i << "_" << j_bottom;
-                                    coordinator->add_in_port({k, ss_out.str()});
-                                }
-                            }
-                        }
-                        // left / right
-                        {
-                            int i_left = (int) graph_parameters.begin_column - 1;
-                            int i_right = (int) graph_parameters.end_column + 1;
-
-                            for (int j = (int) graph_parameters.begin_line;
-                                 j <= (int) graph_parameters.end_line; ++j) {
-                                std::ostringstream ss_out;
-
-                                ++k;
-                                if (j >= (int) graph_parameters.min_line
-                                        and j <= (int) graph_parameters.max_line
-                                        and i_left >= (int) graph_parameters.min_column) {
-                                    ss_out << "out_" << i_left << "_" << j;
-                                    coordinator->add_in_port({k, ss_out.str()});
-                                }
-                                ++k;
-                                if (j >= (int) graph_parameters.min_line
-                                        and j <= (int) graph_parameters.max_line
-                                        and i_right >= (int) graph_parameters.max_column) {
-                                    ss_out << "out_" << i_right << "_" << j;
-                                    coordinator->add_in_port({k, ss_out.str()});
-                                }
-                            }
-                        }
-
-                        // outputs
-                        k = 0;
-
-                        // top / bottom
-                        {
-                            int j_top = (int) graph_parameters.begin_line;
-                            int j_bottom = (int) graph_parameters.end_line;
-
-                            for (int i = (int) graph_parameters.begin_column;
-                                 i <= (int) graph_parameters.end_column; ++i) {
-                                std::ostringstream ss_out;
-
-                                ++k;
-                                ss_out << "out_" << i << "_" << j_top;
-                                coordinator->add_out_port({k, ss_out.str()});
-                                ++k;
-                                ss_out << "out_" << i << "_" << j_bottom;
-                                coordinator->add_out_port({k, ss_out.str()});
-                            }
-                        }
-                        // left / right
-                        {
-                            int i_left = (int) graph_parameters.begin_column;
-                            int i_right = (int) graph_parameters.end_column;
-
-                            for (int j = (int) graph_parameters.begin_line + 1;
-                                 j <= (int) graph_parameters.end_line - 1; ++j) {
-                                std::ostringstream ss_out;
-
-                                ++k;
-                                ss_out << "out_" << i_left << "_" << j;
-                                coordinator->add_out_port({k, ss_out.str()});
-                                ++k;
-                                ss_out << "out_" << i_right << "_" << j;
-                                coordinator->add_out_port({k, ss_out.str()});
-                            }
-                        }
-
-
-                        //                        for (Edges::const_iterator it = parameters._output_edges.begin();
+    //                        for (Edges::const_iterator it = parameters._output_edges.begin();
 //                             it != parameters._output_edges.end(); ++it) {
 //                            std::ostringstream ss_out;
 //
@@ -269,52 +268,53 @@ namespace artis {
 //                                        "out", coordinator, ss_out.str());
 //                            }
 //                        }
-                    }
+  }
+
+  void init() {}
+
+  void start(common::DoubleTime::type /* t */) {}
+
+  void transition(
+      const common::Models<common::DoubleTime> & /* receivers */,
+      common::DoubleTime::type /* t */) {}
+
+  ~ParallelBuiltFlatGraphManager() override = default;
+};
+
+class ParallelHierarchicalGraphManager :
+    public artis::pdevs::GraphManager<common::DoubleTime,
+                                      CellParameters,
+                                      GridGraphManagerParameters> {
+public:
+  enum submodels {
+    S1_1 = 0, S1_2, S2_1, S2_2
+  };
+
+  ParallelHierarchicalGraphManager(
+      common::Coordinator<common::DoubleTime> *coordinator,
+      const CellParameters &parameters,
+      const GridGraphManagerParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime, CellParameters,
+                                 GridGraphManagerParameters>(
+          coordinator, parameters, graph_parameters) {
+    // build coordinators (graphs)
+    for (unsigned int i = 0; i < 2; ++i) {
+      for (unsigned int j = 0; j < 2; ++j) {
+        ParallelCoordinator *sub_coordinator = nullptr;
+        std::ostringstream ss;
+
+        ss << "S_" << (i + 1) << "_" << (j + 1);
+        sub_coordinator = new ParallelCoordinator(ss.str(),
+                                                  parameters,
+                                                  {i * 5 + 1, (i + 1) * 5, j * 5 + 1, (j + 1) * 5,
+                                                   1, 10, 1, 10});
+        _coordinators.push_back(sub_coordinator);
+        add_child(i, sub_coordinator);
+      }
+    }
 
-                    void init() { }
-
-                    void start(common::DoubleTime::type /* t */) { }
-
-                    void transition(
-                            const common::Models<common::DoubleTime>& /* receivers */,
-                            common::DoubleTime::type /* t */) { }
-
-                    ~ParallelBuiltFlatGraphManager() override = default;
-                };
-
-                class ParallelHierarchicalGraphManager :
-                        public artis::pdevs::GraphManager<common::DoubleTime, CellParameters, GridGraphManagerParameters> {
-                public:
-                    enum submodels {
-                        S1_1 = 0, S1_2, S2_1, S2_2
-                    };
-
-                    ParallelHierarchicalGraphManager(
-                            common::Coordinator<common::DoubleTime>* coordinator,
-                            const CellParameters& parameters,
-                            const GridGraphManagerParameters& graph_parameters)
-                            :
-                            artis::pdevs::GraphManager<common::DoubleTime, CellParameters,
-                                    GridGraphManagerParameters>(
-                                    coordinator, parameters, graph_parameters)
-                    {
-                        // build coordinators (graphs)
-                        for (unsigned int i = 0; i < 2; ++i) {
-                            for (unsigned int j = 0; j < 2; ++j) {
-                                ParallelCoordinator* sub_coordinator = nullptr;
-                                std::ostringstream ss;
-
-                                ss << "S_" << (i + 1) << "_" << (j + 1);
-                                sub_coordinator = new ParallelCoordinator(ss.str(),
-                                        parameters,
-                                        {i * 5 + 1, (i + 1) * 5, j * 5 + 1, (j + 1) * 5,
-                                         1, 10, 1, 10});
-                                _coordinators.push_back(sub_coordinator);
-                                add_child(i, sub_coordinator);
-                            }
-                        }
-
-                        // builds internal connections (edges)
+    // builds internal connections (edges)
 //                        for (Connections::const_iterator it = parent_connections.begin();
 //                             it != parent_connections.end(); ++it) {
 //                            const Connection& connection = *it;
@@ -337,71 +337,67 @@ namespace artis {
 //                            }
 //                        }
 
-                    }
-
-                    ~ParallelHierarchicalGraphManager() override
-                    {
-                        for (typename Coordinators::const_iterator it = _coordinators.begin();
-                             it != _coordinators.end(); ++it) {
-                            delete *it;
-                        }
-                    }
+  }
 
-                    void init()
-                    {
-                        std::for_each(_coordinators.begin(), _coordinators.end(),
-                                [this](ParallelCoordinator* coordinator) {
-                                    coordinator->set_sender(
-                                            (dynamic_cast< artis::pdevs::multithreading::Coordinator<
-                                                    artis::common::DoubleTime,
-                                                    ParallelHierarchicalGraphManager,
-                                                    CellParameters,
-                                                    GridGraphManagerParameters>*>(this->coordinator()))->get_sender());
-                                });
-                    }
-
-                    void start(common::DoubleTime::type t)
-                    {
-                        std::for_each(_coordinators.begin(), _coordinators.end(),
-                                [t](ParallelCoordinator* coordinator) {
-                                    coordinator->get_sender().send(
-                                            artis::pdevs::multithreading::start_message<
-                                                    artis::common::DoubleTime>(t));
-                                });
-                    }
-
-                    void transition(const common::Models<common::DoubleTime>& receivers,
-                            artis::common::DoubleTime::type t)
-                    {
-                        std::for_each(receivers.begin(), receivers.end(),
-                                [this, t](const common::Model<common::DoubleTime>* model) {
-                                    if (not model->is_atomic()) {
-                                        typename Coordinators::const_iterator itc =
-                                                std::find(_coordinators.begin(),
-                                                        _coordinators.end(), model);
-
-                                        (*itc)->get_sender().send(
-                                                artis::pdevs::multithreading::transition_message<
-                                                        artis::common::DoubleTime>(t));
-                                    }
-                                });
-                    }
-
-                private:
-                    typedef artis::pdevs::multithreading::Coordinator<
-                            common::DoubleTime,
-                            ParallelBuiltFlatGraphManager,
-                            CellParameters,
-                            GridGraphManagerParameters
-                    > ParallelCoordinator;
-                    typedef std::vector<ParallelCoordinator*> Coordinators;
-
-                    Coordinators _coordinators;
-                };
-
-            }
-        }
+  ~ParallelHierarchicalGraphManager() override {
+    for (typename Coordinators::const_iterator it = _coordinators.begin();
+         it != _coordinators.end(); ++it) {
+      delete *it;
     }
+  }
+
+  void init() {
+    std::for_each(_coordinators.begin(), _coordinators.end(),
+                  [this](ParallelCoordinator *coordinator) {
+                    coordinator->set_sender(
+                        (dynamic_cast< artis::pdevs::multithreading::Coordinator<
+                            artis::common::DoubleTime,
+                            ParallelHierarchicalGraphManager,
+                            CellParameters,
+                            GridGraphManagerParameters> *>(this->coordinator()))->get_sender());
+                  });
+  }
+
+  void start(common::DoubleTime::type t) {
+    std::for_each(_coordinators.begin(), _coordinators.end(),
+                  [t](ParallelCoordinator *coordinator) {
+                    coordinator->get_sender().send(
+                        artis::pdevs::multithreading::start_message<
+                            artis::common::DoubleTime>(t));
+                  });
+  }
+
+  void transition(const common::Models<common::DoubleTime> &receivers,
+                  artis::common::DoubleTime::type t) {
+    std::for_each(receivers.begin(), receivers.end(),
+                  [this, t](const common::Model<common::DoubleTime> *model) {
+                    if (not model->is_atomic()) {
+                      typename Coordinators::const_iterator itc =
+                          std::find(_coordinators.begin(),
+                                    _coordinators.end(), model);
+
+                      (*itc)->get_sender().send(
+                          artis::pdevs::multithreading::transition_message<
+                              artis::common::DoubleTime>(t));
+                    }
+                  });
+  }
+
+private:
+  typedef artis::pdevs::multithreading::Coordinator<
+      common::DoubleTime,
+      ParallelBuiltFlatGraphManager,
+      CellParameters,
+      GridGraphManagerParameters
+  > ParallelCoordinator;
+  typedef std::vector<ParallelCoordinator *> Coordinators;
+
+  Coordinators _coordinators;
+};
+
+}
+}
+}
 } // namespace artis tests multithreading lifegame
 
 #endif

+ 271 - 276
src/tests/multithreading/lifegame/main.cpp

@@ -37,314 +37,309 @@ using namespace std::chrono;
 using namespace artis::tests::multithreading::lifegame;
 
 CellParameters parameters({
-        {
-                {"C_1_1", 3},
-                {"C_1_2", 5},
-                {"C_1_3", 5},
-                {"C_1_4", 5},
-                {"C_1_5", 5},
-                {"C_1_6", 5},
-                {"C_1_7", 5},
-                {"C_1_8", 5},
-                {"C_1_9", 5},
-                {"C_1_10", 3},
-                {"C_2_1", 5},
-                {"C_2_2", 8},
-                {"C_2_3", 8},
-                {"C_2_4", 8},
-                {"C_2_5", 8},
-                {"C_2_6", 8},
-                {"C_2_7", 8},
-                {"C_2_8", 8},
-                {"C_2_9", 8},
-                {"C_2_10", 5},
-                {"C_3_1", 5},
-                {"C_3_2", 8},
-                {"C_3_3", 8},
-                {"C_3_4", 8},
-                {"C_3_5", 8},
-                {"C_3_6", 8},
-                {"C_3_7", 8},
-                {"C_3_8", 8},
-                {"C_3_9", 8},
-                {"C_3_10", 5},
-                {"C_4_1", 5},
-                {"C_4_2", 8},
-                {"C_4_3", 8},
-                {"C_4_4", 8},
-                {"C_4_5", 8},
-                {"C_4_6", 8},
-                {"C_4_7", 8},
-                {"C_4_8", 8},
-                {"C_4_9", 8},
-                {"C_4_10", 5},
-                {"C_5_1", 5},
-                {"C_5_2", 8},
-                {"C_5_3", 8},
-                {"C_5_4", 8},
-                {"C_5_5", 8},
-                {"C_5_6", 8},
-                {"C_5_7", 8},
-                {"C_5_8", 8},
-                {"C_5_9", 8},
-                {"C_5_10", 5},
-                {"C_6_1", 5},
-                {"C_6_2", 8},
-                {"C_6_3", 8},
-                {"C_6_4", 8},
-                {"C_6_5", 8},
-                {"C_6_6", 8},
-                {"C_6_7", 8},
-                {"C_6_8", 8},
-                {"C_6_9", 8},
-                {"C_6_10", 5},
-                {"C_7_1", 5},
-                {"C_7_2", 8},
-                {"C_7_3", 8},
-                {"C_7_4", 8},
-                {"C_7_5", 8},
-                {"C_7_6", 8},
-                {"C_7_7", 8},
-                {"C_7_8", 8},
-                {"C_7_9", 8},
-                {"C_7_10", 5},
-                {"C_8_1", 5},
-                {"C_8_2", 8},
-                {"C_8_3", 8},
-                {"C_8_4", 8},
-                {"C_8_5", 8},
-                {"C_8_6", 8},
-                {"C_8_7", 8},
-                {"C_8_8", 8},
-                {"C_8_9", 8},
-                {"C_8_10", 5},
-                {"C_9_1", 5},
-                {"C_9_2", 8},
-                {"C_9_3", 8},
-                {"C_9_4", 8},
-                {"C_9_5", 8},
-                {"C_9_6", 8},
-                {"C_9_7", 8},
-                {"C_9_8", 8},
-                {"C_9_9", 8},
-                {"C_9_10", 5},
-                {"C_10_1", 3},
-                {"C_10_2", 5},
-                {"C_10_3", 5},
-                {"C_10_4", 5},
-                {"C_10_5", 5},
-                {"C_10_6", 5},
-                {"C_10_7", 5},
-                {"C_10_8", 5},
-                {"C_10_9", 5},
-                {"C_10_10", 3}
-        },
-        {
-                {"C_1_1", false},
-                {"C_1_2", false},
-                {"C_1_3", false},
-                {"C_1_4", false},
-                {"C_1_5", false},
-                {"C_1_6", false},
-                {"C_1_7", false},
-                {"C_1_8", false},
-                {"C_1_9", false},
-                {"C_1_10", false},
-                {"C_2_1", false},
-                {"C_2_2", false},
-                {"C_2_3", false},
-                {"C_2_4", false},
-                {"C_2_5", true},
-                {"C_2_6", true},
-                {"C_2_7", false},
-                {"C_2_8", false},
-                {"C_2_9", false},
-                {"C_2_10", false},
-                {"C_3_1", false},
-                {"C_3_2", false},
-                {"C_3_3", false},
-                {"C_3_4", true},
-                {"C_3_5", false},
-                {"C_3_6", false},
-                {"C_3_7", true},
-                {"C_3_8", false},
-                {"C_3_9", false},
-                {"C_3_10", false},
-                {"C_4_1", false},
-                {"C_4_2", false},
-                {"C_4_3", true},
-                {"C_4_4", false},
-                {"C_4_5", false},
-                {"C_4_6", false},
-                {"C_4_7", false},
-                {"C_4_8", true},
-                {"C_4_9", false},
-                {"C_4_10", false},
-                {"C_5_1", false},
-                {"C_5_2", true},
-                {"C_5_3", false},
-                {"C_5_4", false},
-                {"C_5_5", false},
-                {"C_5_6", false},
-                {"C_5_7", false},
-                {"C_5_8", false},
-                {"C_5_9", true},
-                {"C_5_10", false},
-                {"C_6_1", false},
-                {"C_6_2", true},
-                {"C_6_3", false},
-                {"C_6_4", false},
-                {"C_6_5", false},
-                {"C_6_6", false},
-                {"C_6_7", false},
-                {"C_6_8", false},
-                {"C_6_9", true},
-                {"C_6_10", false},
-                {"C_7_1", false},
-                {"C_7_2", false},
-                {"C_7_3", true},
-                {"C_7_4", false},
-                {"C_7_5", false},
-                {"C_7_6", false},
-                {"C_7_7", false},
-                {"C_7_8", true},
-                {"C_7_9", false},
-                {"C_7_10", false},
-                {"C_8_1", false},
-                {"C_8_2", false},
-                {"C_8_3", false},
-                {"C_8_4", true},
-                {"C_8_5", false},
-                {"C_8_6", false},
-                {"C_8_7", true},
-                {"C_8_8", false},
-                {"C_8_9", false},
-                {"C_8_10", false},
-                {"C_9_1", false},
-                {"C_9_2", false},
-                {"C_9_3", false},
-                {"C_9_4", false},
-                {"C_9_5", true},
-                {"C_9_6", true},
-                {"C_9_7", false},
-                {"C_9_8", false},
-                {"C_9_9", false},
-                {"C_9_10", false},
-                {"C_10_1",  false},
-                {"C_10_2",  false},
-                {"C_10_3",  false},
-                {"C_10_4",  false},
-                {"C_10_5",  false},
-                {"C_10_6",  false},
-                {"C_10_7",  false},
-                {"C_10_8",  false},
-                {"C_10_9",  false},
-                {"C_10_10",  false}
-        }
-});
+                              {
+                                  {"C_1_1", 3},
+                                  {"C_1_2", 5},
+                                  {"C_1_3", 5},
+                                  {"C_1_4", 5},
+                                  {"C_1_5", 5},
+                                  {"C_1_6", 5},
+                                  {"C_1_7", 5},
+                                  {"C_1_8", 5},
+                                  {"C_1_9", 5},
+                                  {"C_1_10", 3},
+                                  {"C_2_1", 5},
+                                  {"C_2_2", 8},
+                                  {"C_2_3", 8},
+                                  {"C_2_4", 8},
+                                  {"C_2_5", 8},
+                                  {"C_2_6", 8},
+                                  {"C_2_7", 8},
+                                  {"C_2_8", 8},
+                                  {"C_2_9", 8},
+                                  {"C_2_10", 5},
+                                  {"C_3_1", 5},
+                                  {"C_3_2", 8},
+                                  {"C_3_3", 8},
+                                  {"C_3_4", 8},
+                                  {"C_3_5", 8},
+                                  {"C_3_6", 8},
+                                  {"C_3_7", 8},
+                                  {"C_3_8", 8},
+                                  {"C_3_9", 8},
+                                  {"C_3_10", 5},
+                                  {"C_4_1", 5},
+                                  {"C_4_2", 8},
+                                  {"C_4_3", 8},
+                                  {"C_4_4", 8},
+                                  {"C_4_5", 8},
+                                  {"C_4_6", 8},
+                                  {"C_4_7", 8},
+                                  {"C_4_8", 8},
+                                  {"C_4_9", 8},
+                                  {"C_4_10", 5},
+                                  {"C_5_1", 5},
+                                  {"C_5_2", 8},
+                                  {"C_5_3", 8},
+                                  {"C_5_4", 8},
+                                  {"C_5_5", 8},
+                                  {"C_5_6", 8},
+                                  {"C_5_7", 8},
+                                  {"C_5_8", 8},
+                                  {"C_5_9", 8},
+                                  {"C_5_10", 5},
+                                  {"C_6_1", 5},
+                                  {"C_6_2", 8},
+                                  {"C_6_3", 8},
+                                  {"C_6_4", 8},
+                                  {"C_6_5", 8},
+                                  {"C_6_6", 8},
+                                  {"C_6_7", 8},
+                                  {"C_6_8", 8},
+                                  {"C_6_9", 8},
+                                  {"C_6_10", 5},
+                                  {"C_7_1", 5},
+                                  {"C_7_2", 8},
+                                  {"C_7_3", 8},
+                                  {"C_7_4", 8},
+                                  {"C_7_5", 8},
+                                  {"C_7_6", 8},
+                                  {"C_7_7", 8},
+                                  {"C_7_8", 8},
+                                  {"C_7_9", 8},
+                                  {"C_7_10", 5},
+                                  {"C_8_1", 5},
+                                  {"C_8_2", 8},
+                                  {"C_8_3", 8},
+                                  {"C_8_4", 8},
+                                  {"C_8_5", 8},
+                                  {"C_8_6", 8},
+                                  {"C_8_7", 8},
+                                  {"C_8_8", 8},
+                                  {"C_8_9", 8},
+                                  {"C_8_10", 5},
+                                  {"C_9_1", 5},
+                                  {"C_9_2", 8},
+                                  {"C_9_3", 8},
+                                  {"C_9_4", 8},
+                                  {"C_9_5", 8},
+                                  {"C_9_6", 8},
+                                  {"C_9_7", 8},
+                                  {"C_9_8", 8},
+                                  {"C_9_9", 8},
+                                  {"C_9_10", 5},
+                                  {"C_10_1", 3},
+                                  {"C_10_2", 5},
+                                  {"C_10_3", 5},
+                                  {"C_10_4", 5},
+                                  {"C_10_5", 5},
+                                  {"C_10_6", 5},
+                                  {"C_10_7", 5},
+                                  {"C_10_8", 5},
+                                  {"C_10_9", 5},
+                                  {"C_10_10", 3}
+                              },
+                              {
+                                  {"C_1_1", false},
+                                  {"C_1_2", false},
+                                  {"C_1_3", false},
+                                  {"C_1_4", false},
+                                  {"C_1_5", false},
+                                  {"C_1_6", false},
+                                  {"C_1_7", false},
+                                  {"C_1_8", false},
+                                  {"C_1_9", false},
+                                  {"C_1_10", false},
+                                  {"C_2_1", false},
+                                  {"C_2_2", false},
+                                  {"C_2_3", false},
+                                  {"C_2_4", false},
+                                  {"C_2_5", true},
+                                  {"C_2_6", true},
+                                  {"C_2_7", false},
+                                  {"C_2_8", false},
+                                  {"C_2_9", false},
+                                  {"C_2_10", false},
+                                  {"C_3_1", false},
+                                  {"C_3_2", false},
+                                  {"C_3_3", false},
+                                  {"C_3_4", true},
+                                  {"C_3_5", false},
+                                  {"C_3_6", false},
+                                  {"C_3_7", true},
+                                  {"C_3_8", false},
+                                  {"C_3_9", false},
+                                  {"C_3_10", false},
+                                  {"C_4_1", false},
+                                  {"C_4_2", false},
+                                  {"C_4_3", true},
+                                  {"C_4_4", false},
+                                  {"C_4_5", false},
+                                  {"C_4_6", false},
+                                  {"C_4_7", false},
+                                  {"C_4_8", true},
+                                  {"C_4_9", false},
+                                  {"C_4_10", false},
+                                  {"C_5_1", false},
+                                  {"C_5_2", true},
+                                  {"C_5_3", false},
+                                  {"C_5_4", false},
+                                  {"C_5_5", false},
+                                  {"C_5_6", false},
+                                  {"C_5_7", false},
+                                  {"C_5_8", false},
+                                  {"C_5_9", true},
+                                  {"C_5_10", false},
+                                  {"C_6_1", false},
+                                  {"C_6_2", true},
+                                  {"C_6_3", false},
+                                  {"C_6_4", false},
+                                  {"C_6_5", false},
+                                  {"C_6_6", false},
+                                  {"C_6_7", false},
+                                  {"C_6_8", false},
+                                  {"C_6_9", true},
+                                  {"C_6_10", false},
+                                  {"C_7_1", false},
+                                  {"C_7_2", false},
+                                  {"C_7_3", true},
+                                  {"C_7_4", false},
+                                  {"C_7_5", false},
+                                  {"C_7_6", false},
+                                  {"C_7_7", false},
+                                  {"C_7_8", true},
+                                  {"C_7_9", false},
+                                  {"C_7_10", false},
+                                  {"C_8_1", false},
+                                  {"C_8_2", false},
+                                  {"C_8_3", false},
+                                  {"C_8_4", true},
+                                  {"C_8_5", false},
+                                  {"C_8_6", false},
+                                  {"C_8_7", true},
+                                  {"C_8_8", false},
+                                  {"C_8_9", false},
+                                  {"C_8_10", false},
+                                  {"C_9_1", false},
+                                  {"C_9_2", false},
+                                  {"C_9_3", false},
+                                  {"C_9_4", false},
+                                  {"C_9_5", true},
+                                  {"C_9_6", true},
+                                  {"C_9_7", false},
+                                  {"C_9_8", false},
+                                  {"C_9_9", false},
+                                  {"C_9_10", false},
+                                  {"C_10_1", false},
+                                  {"C_10_2", false},
+                                  {"C_10_3", false},
+                                  {"C_10_4", false},
+                                  {"C_10_5", false},
+                                  {"C_10_6", false},
+                                  {"C_10_7", false},
+                                  {"C_10_8", false},
+                                  {"C_10_9", false},
+                                  {"C_10_10", false}
+                              }
+                          });
 GridGraphManagerParameters graph_parameters({1, 10, 1, 10, 1, 10, 1, 10});
 
 class View : public artis::observer::View<artis::common::DoubleTime> {
 public:
-    View()
-    {
-        selector("Cell:state", {FlatGraphManager::CELL, ALL, Cell::STATE});
-    }
+  View() {
+    selector("Cell:state", {FlatGraphManager::CELL, ALL, Cell::STATE});
+  }
 };
 
-void show_state(const artis::observer::View<artis::common::DoubleTime>& view)
-{
-    std::vector<std::vector<std::vector<bool> > > states;
+void show_state(const artis::observer::View<artis::common::DoubleTime> &view) {
+  std::vector<std::vector<std::vector<bool> > > states;
 
-    for (unsigned int t = 0; t <= 11; ++t) {
-        states.emplace_back(std::vector<std::vector<bool> >());
-        for (unsigned int i = graph_parameters.begin_column - 1; i < graph_parameters.end_column; ++i) {
-            states[t].emplace_back(std::vector<bool>());
-            for (unsigned int j = graph_parameters.begin_line - 1; j < graph_parameters.end_line; ++j) {
-                states[t][i].emplace_back(false);
-            }
-        }
-    }
+  for (unsigned int t = 0; t <= 11; ++t) {
+    states.emplace_back(std::vector<std::vector<bool> >());
     for (unsigned int i = graph_parameters.begin_column - 1; i < graph_parameters.end_column; ++i) {
-        for (unsigned int j = graph_parameters.begin_line - 1; j < graph_parameters.end_line; ++j) {
-            std::ostringstream ss;
+      states[t].emplace_back(std::vector<bool>());
+      for (unsigned int j = graph_parameters.begin_line - 1; j < graph_parameters.end_line; ++j) {
+        states[t][i].emplace_back(false);
+      }
+    }
+  }
+  for (unsigned int i = graph_parameters.begin_column - 1; i < graph_parameters.end_column; ++i) {
+    for (unsigned int j = graph_parameters.begin_line - 1; j < graph_parameters.end_line; ++j) {
+      std::ostringstream ss;
 
-            ss << ":root:C_" << (i + 1) << "_" << (j + 1) << ":state";
+      ss << ":root:C_" << (i + 1) << "_" << (j + 1) << ":state";
 
-            const ::View::Values& values = view.get("Cell:state", ss.str());
+      const ::View::Values &values = view.get("Cell:state", ss.str());
 
-            for (const auto& value: values) {
-                bool state;
+      for (const auto &value: values) {
+        bool state;
 
-                value.second(state);
-                if (value.first < 11) {
-                    states[(int) value.first][i][j] = state;
-                }
-            }
+        value.second(state);
+        if (value.first < 11) {
+          states[(int) value.first][i][j] = state;
         }
+      }
     }
-    for (unsigned int t = 0; t <= 10; ++t) {
-        for (unsigned int i = graph_parameters.begin_column - 1; i < graph_parameters.end_column; ++i) {
-            for (unsigned int j = graph_parameters.begin_line - 1; j < graph_parameters.end_line; ++j) {
-                std::cout << states[t][i][j] << " ";
-            }
-            std::cout << std::endl;
-        }
-        std::cout << std::endl;
+  }
+  for (unsigned int t = 0; t <= 10; ++t) {
+    for (unsigned int i = graph_parameters.begin_column - 1; i < graph_parameters.end_column; ++i) {
+      for (unsigned int j = graph_parameters.begin_line - 1; j < graph_parameters.end_line; ++j) {
+        std::cout << states[t][i][j] << " ";
+      }
+      std::cout << std::endl;
     }
+    std::cout << std::endl;
+  }
 }
 
-double lifegame_monothreading()
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
-    artis::common::RootCoordinator<
-            DoubleTime, artis::pdevs::Coordinator<
-                    DoubleTime,
-                    FlatGraphManager,
-                    CellParameters,
-                    GridGraphManagerParameters>
-    > rc(context, "root", parameters, graph_parameters);
+double lifegame_monothreading() {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
+  artis::common::RootCoordinator<
+      DoubleTime, artis::pdevs::Coordinator<
+          DoubleTime,
+          FlatGraphManager,
+          CellParameters,
+          GridGraphManagerParameters>
+  > rc(context, "root", parameters, graph_parameters);
 
-    rc.attachView("Matrix", new ::View());
+  rc.attachView("Matrix", new ::View());
 
-    steady_clock::time_point t1 = steady_clock::now();
+  steady_clock::time_point t1 = steady_clock::now();
 
-    rc.run(context);
+  rc.run(context);
 
-    steady_clock::time_point t2 = steady_clock::now();
+  steady_clock::time_point t2 = steady_clock::now();
 
-    duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
+  duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
 
-    show_state(rc.observer().view("Matrix"));
+  show_state(rc.observer().view("Matrix"));
 
-    return time_span.count();
+  return time_span.count();
 }
 
-double lifegame_multithreading()
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
-    artis::common::RootCoordinator<
-            DoubleTime, artis::pdevs::multithreading::Coordinator<
-                    DoubleTime,
-                    ParallelHierarchicalGraphManager,
-                    CellParameters,
-                    GridGraphManagerParameters>
-    > rc(context, "root", parameters, graph_parameters);
+double lifegame_multithreading() {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
+  artis::common::RootCoordinator<
+      DoubleTime, artis::pdevs::multithreading::Coordinator<
+          DoubleTime,
+          ParallelHierarchicalGraphManager,
+          CellParameters,
+          GridGraphManagerParameters>
+  > rc(context, "root", parameters, graph_parameters);
 
-    steady_clock::time_point t1 = steady_clock::now();
+  steady_clock::time_point t1 = steady_clock::now();
 
-    rc.run(context);
+  rc.run(context);
 
-    steady_clock::time_point t2 = steady_clock::now();
+  steady_clock::time_point t2 = steady_clock::now();
 
-    duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
+  duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
 
-    return time_span.count();
+  return time_span.count();
 }
 
-int main()
-{
+int main() {
 //    std::cout << lifegame_monothreading() << std::endl;
-    std::cout << lifegame_multithreading() << std::endl;
-    return 0;
+  std::cout << lifegame_multithreading() << std::endl;
+  return 0;
 }

+ 137 - 145
src/tests/multithreading/lifegame/models.hpp

@@ -32,154 +32,146 @@
 #include <artis-star/kernel/pdevs/Dynamics.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace multithreading {
-            namespace lifegame {
-
-                struct CellParameters {
-                    std::map<std::string, int> neighbour_numbers;
-                    std::map<std::string, bool> initial_states;
-                };
-
-                class Cell
-                        : public artis::pdevs::Dynamics<common::DoubleTime, Cell, CellParameters> {
-                public:
-                    enum inputs {
-                        IN
-                    };
-                    enum outputs {
-                        OUT
-                    };
-                    enum states {
-                        STATE
-                    };
-
-                    Cell(const std::string& name,
-                            const artis::pdevs::Context<common::DoubleTime, Cell, CellParameters>& context)
-                            :
-                            artis::pdevs::Dynamics<common::DoubleTime, Cell, CellParameters>(name,
-                                    context),
-                            _neighbour_number(
-                                    context.parameters().neighbour_numbers.find(name)->second),
-                            _initial_state(context.parameters().initial_states.find(name)->second)
-                    {
-                        input_ports({{IN, "in"}});
-                        output_ports({{OUT, "out"}});
-                        observables({{STATE, "state"}});
-                    }
-
-                    ~Cell() override = default;
-
-                    void dint(const typename common::DoubleTime::type& /* t */) override
-                    {
-                        if (_phase == SEND) {
-                            _phase = WAIT;
-                            _sigma = common::DoubleTime::infinity;
-                        } else if (_phase == NEW_STATE) {
-                            if (_state and (_true_neighbour_number < 2
-                                    or _true_neighbour_number > 3)) {
-                                _state = false;
-                            } else if (not _state and (_true_neighbour_number == 3)) {
-                                _state = true;
-                            }
-                            _phase = SEND;
-                            _sigma = 1;
-                            _true_neighbour_number = 0;
-                            _received = 0;
-                        }
-                    }
-
-                    void dext(const typename common::DoubleTime::type& /* t */,
-                            const typename common::DoubleTime::type& /* e */,
-                            const common::Bag<common::DoubleTime>& bag) override
-                    {
-                        std::for_each(bag.begin(), bag.end(),
-                                [this](const common::ExternalEvent<common::DoubleTime>& e) {
-                                    if (e.on_port(IN)) {
-                                        bool data;
-
-                                        e.data()(data);
-                                        if (data) {
-                                            ++_true_neighbour_number;
-                                        }
-                                        ++_received;
-                                    }
-                                });
-                        if (_received == _neighbour_number) {
-                            _phase = NEW_STATE;
-                            _sigma = 0;
-                        } else {
-                            _phase = WAIT;
-                            _sigma = common::DoubleTime::infinity;
-                        }
-                    }
-
-                    void
-                    dconf(const typename common::DoubleTime::type& t,
-                            const typename common::DoubleTime::type& e,
-                            const common::Bag<common::DoubleTime>& bag) override
-                    {
-                        dext(t, e, bag);
-                    }
-
-                    void start(const typename common::DoubleTime::type& t) override
-                    {
-                        (void) t;
-
-                        _phase = SEND;
-                        _sigma = 0;
-                        _state = _initial_state;
-                        _true_neighbour_number = 0;
-                        _received = 0;
-                    }
-
-                    typename common::DoubleTime::type
-                    ta(const typename common::DoubleTime::type& /* t */) const override
-                    {
-                        return _sigma;
-                    }
-
-                    common::Bag<common::DoubleTime>
-                    lambda(const typename common::DoubleTime::type& /* t */) const override
-                    {
-                        common::Bag<common::DoubleTime> bag;
-
-                        if (_phase == SEND) {
-                            bag.push_back(
-                                    artis::common::ExternalEvent<common::DoubleTime>(OUT, _state));
-                        }
-                        return bag;
-                    }
-
-                    common::Value observe(const common::DoubleTime::type& /* t */,
-                            unsigned int index) const override
-                    {
-                        if (index == STATE) {
-                            return _state;
-                        }
-                        return common::Value();
+namespace tests {
+namespace multithreading {
+namespace lifegame {
+
+struct CellParameters {
+  std::map<std::string, int> neighbour_numbers;
+  std::map<std::string, bool> initial_states;
+};
+
+class Cell
+    : public artis::pdevs::Dynamics<common::DoubleTime, Cell, CellParameters> {
+public:
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+  enum states {
+    STATE
+  };
+
+  Cell(const std::string &name,
+       const artis::pdevs::Context<common::DoubleTime, Cell, CellParameters> &context)
+      :
+      artis::pdevs::Dynamics<common::DoubleTime, Cell, CellParameters>(name,
+                                                                       context),
+      _neighbour_number(
+          context.parameters().neighbour_numbers.find(name)->second),
+      _initial_state(context.parameters().initial_states.find(name)->second) {
+    input_ports({{IN, "in"}});
+    output_ports({{OUT, "out"}});
+    observables({{STATE, "state"}});
+  }
+
+  ~Cell() override = default;
+
+  void dint(const typename common::DoubleTime::type & /* t */) override {
+    if (_phase == SEND) {
+      _phase = WAIT;
+      _sigma = common::DoubleTime::infinity;
+    } else if (_phase == NEW_STATE) {
+      if (_state and (_true_neighbour_number < 2
+          or _true_neighbour_number > 3)) {
+        _state = false;
+      } else if (not _state and (_true_neighbour_number == 3)) {
+        _state = true;
+      }
+      _phase = SEND;
+      _sigma = 1;
+      _true_neighbour_number = 0;
+      _received = 0;
+    }
+  }
+
+  void dext(const typename common::DoubleTime::type & /* t */,
+            const typename common::DoubleTime::type & /* e */,
+            const common::Bag<common::DoubleTime> &bag) override {
+    std::for_each(bag.begin(), bag.end(),
+                  [this](const common::ExternalEvent<common::DoubleTime> &e) {
+                    if (e.on_port(IN)) {
+                      bool data;
+
+                      e.data()(data);
+                      if (data) {
+                        ++_true_neighbour_number;
+                      }
+                      ++_received;
                     }
+                  });
+    if (_received == _neighbour_number) {
+      _phase = NEW_STATE;
+      _sigma = 0;
+    } else {
+      _phase = WAIT;
+      _sigma = common::DoubleTime::infinity;
+    }
+  }
+
+  void
+  dconf(const typename common::DoubleTime::type &t,
+        const typename common::DoubleTime::type &e,
+        const common::Bag<common::DoubleTime> &bag) override {
+    dext(t, e, bag);
+  }
+
+  void start(const typename common::DoubleTime::type &t) override {
+    (void) t;
+
+    _phase = SEND;
+    _sigma = 0;
+    _state = _initial_state;
+    _true_neighbour_number = 0;
+    _received = 0;
+  }
+
+  typename common::DoubleTime::type
+  ta(const typename common::DoubleTime::type & /* t */) const override {
+    return _sigma;
+  }
+
+  common::Bag<common::DoubleTime>
+  lambda(const typename common::DoubleTime::type & /* t */) const override {
+    common::Bag<common::DoubleTime> bag;
+
+    if (_phase == SEND) {
+      bag.push_back(
+          artis::common::ExternalEvent<common::DoubleTime>(OUT, _state));
+    }
+    return bag;
+  }
 
-                private:
-                    enum Phase {
-                        SEND, WAIT, NEW_STATE
-                    };
-
-                    // parameters
-                    unsigned int _neighbour_number;
-                    bool _initial_state;
-
-                    // state
-                    Phase _phase;
-                    common::DoubleTime::type _sigma;
-                    bool _state;
-                    unsigned int _received;
-                    unsigned int _true_neighbour_number;
-                };
-
-            }
-        }
+  common::Value observe(const common::DoubleTime::type & /* t */,
+                        unsigned int index) const override {
+    if (index == STATE) {
+      return _state;
     }
+    return common::Value();
+  }
+
+private:
+  enum Phase {
+    SEND, WAIT, NEW_STATE
+  };
+
+  // parameters
+  unsigned int _neighbour_number;
+  bool _initial_state;
+
+  // state
+  Phase _phase;
+  common::DoubleTime::type _sigma;
+  bool _state;
+  unsigned int _received;
+  unsigned int _true_neighbour_number;
+};
+
+}
+}
+}
 } // namespace artis tests multithreading lifegame
 
 #endif

+ 211 - 206
src/tests/multithreading/simple/graph_manager.hpp

@@ -34,246 +34,251 @@
 #include <artis-star/kernel/pdevs/Simulator.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace multithreading {
-            namespace simple {
+namespace tests {
+namespace multithreading {
+namespace simple {
 
-                class LinksGraphManager :
-                        public artis::pdevs::GraphManager<artis::common::DoubleTime, GeneratorParameters> {
-                public:
-                    enum submodels {
-                        LINK_1, LINK_2
-                    };
+class LinksGraphManager :
+    public artis::pdevs::GraphManager<artis::common::DoubleTime, GeneratorParameters> {
+public:
+  enum submodels {
+    LINK_1, LINK_2
+  };
 
-                    struct inputs {
-                        enum values {
-                            IN_1, IN_2
-                        };
-                    };
+  struct inputs {
+    enum values {
+      IN_1, IN_2
+    };
+  };
 
-                    struct outputs {
-                        enum values {
-                            OUT_1, OUT_2
-                        };
-                    };
+  struct outputs {
+    enum values {
+      OUT_1, OUT_2
+    };
+  };
 
-                    LinksGraphManager(
-                            artis::common::Coordinator<artis::common::DoubleTime>* coordinator,
-                            const GeneratorParameters& parameters,
-                            const artis::common::NoParameters& graph_parameters)
-                            :
-                            artis::pdevs::GraphManager<artis::common::DoubleTime, GeneratorParameters>(
-                                    coordinator, parameters, graph_parameters),
-                            _link_1("link_1", artis::common::NoParameters()),
-                            _link_2("link_2", artis::common::NoParameters())
-                    {
-                        add_child(LINK_1, &_link_1);
-                        add_child(LINK_2, &_link_2);
+  LinksGraphManager(
+      artis::common::Coordinator<artis::common::DoubleTime> *coordinator,
+      const GeneratorParameters &parameters,
+      const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<artis::common::DoubleTime, GeneratorParameters>(
+          coordinator, parameters, graph_parameters),
+      _link_1("link_1", artis::common::NoParameters()),
+      _link_2("link_2", artis::common::NoParameters()) {
+    add_child(LINK_1, &_link_1);
+    add_child(LINK_2, &_link_2);
 
-                        coordinator->input_ports({{inputs::IN_1, "in_1"},
-                                                  {inputs::IN_2, "in_2"}});
-                        coordinator->output_ports({{outputs::OUT_1, "out_1"},
-                                                   {outputs::OUT_2, "out_2"}});
+    coordinator->input_ports({{inputs::IN_1, "in_1"},
+                              {inputs::IN_2, "in_2"}});
+    coordinator->output_ports({{outputs::OUT_1, "out_1"},
+                               {outputs::OUT_2, "out_2"}});
 
-                        in({coordinator, inputs::IN_1})
-                                >> out({&_link_1, Link::inputs::IN});
-                        in({coordinator, inputs::IN_2})
-                                >> out({&_link_2, Link::inputs::IN});
+    in({coordinator, inputs::IN_1})
+        >> out({&_link_1, Link::inputs::IN});
+    in({coordinator, inputs::IN_2})
+        >> out({&_link_2, Link::inputs::IN});
 
-                        out({&_link_1, Link::outputs::OUT})
-                                >> out({coordinator, outputs::OUT_1});
-                        out({&_link_2, Link::outputs::OUT})
-                                >> out({coordinator, outputs::OUT_2});
-                    }
+    out({&_link_1, Link::outputs::OUT})
+        >> out({coordinator, outputs::OUT_1});
+    out({&_link_2, Link::outputs::OUT})
+        >> out({coordinator, outputs::OUT_2});
+  }
 
-                    ~LinksGraphManager() override = default;
+  ~LinksGraphManager() override = default;
 
-                    common::DoubleTime::type
-                    lookahead(const common::DoubleTime::type& t) const override
-                    {
-                        std::vector<double> lookaheads = {_link_1.lookahead(t),
-                                                          _link_2.lookahead(t)};
-                        return *std::min(lookaheads.begin(), lookaheads.end());
-                    }
+  common::DoubleTime::type
+  lookahead(const common::DoubleTime::type &t) const override {
+    std::vector<double> lookaheads = {_link_1.lookahead(t),
+                                      _link_2.lookahead(t)};
+    return *std::min(lookaheads.begin(), lookaheads.end());
+  }
 
-                    void init() { }
+  void init() {}
 
-                    void start(common::DoubleTime::type /* t */) { }
+  void start(common::DoubleTime::type /* t */) {}
 
-                    void transition(const common::Models<common::DoubleTime>& /* receivers */,
-                            artis::common::DoubleTime::type /* t */) { }
+  void transition(const common::Models<common::DoubleTime> & /* receivers */,
+                  artis::common::DoubleTime::type /* t */) {}
 
-                private:
-                    artis::pdevs::Simulator<artis::common::DoubleTime, Link> _link_1;
-                    artis::pdevs::Simulator<artis::common::DoubleTime, Link> _link_2;
-                };
+private:
+  artis::pdevs::Simulator<artis::common::DoubleTime, Link> _link_1;
+  artis::pdevs::Simulator<artis::common::DoubleTime, Link> _link_2;
+};
 
-                class SimpleGraphManager :
-                        public artis::pdevs::GraphManager<artis::common::DoubleTime, GeneratorParameters> {
-                public:
-                    enum submodels {
-                        GENERATOR, LINK_1_2, LINK_3_4, LINK_5_6, LINK_7_8, COUNTER
-                    };
+class SimpleGraphManager :
+    public artis::pdevs::GraphManager<artis::common::DoubleTime, GeneratorParameters> {
+public:
+  enum submodels {
+    GENERATOR, LINK_1_2, LINK_3_4, LINK_5_6, LINK_7_8, COUNTER
+  };
 
-                    SimpleGraphManager(
-                            artis::common::Coordinator<artis::common::DoubleTime>* coordinator,
-                            const GeneratorParameters& parameters,
-                            const artis::common::NoParameters& graph_parameters)
-                            :
-                            artis::pdevs::GraphManager<artis::common::DoubleTime, GeneratorParameters>(
-                                    coordinator, parameters, graph_parameters),
-                            _generator("generator", parameters),
-                            _link_1_2("link_1_2", parameters, artis::common::NoParameters()),
-                            _link_3_4("link_3_4", parameters, artis::common::NoParameters()),
-                            _link_5_6("link_5_6", parameters, artis::common::NoParameters()),
-                            _link_7_8("link_7_8", parameters, artis::common::NoParameters()),
-                            _counter("counter", artis::common::NoParameters())
-                    {
-                        add_child(GENERATOR, &_generator);
-                        add_child(LINK_1_2, &_link_1_2);
-                        add_child(LINK_3_4, &_link_3_4);
-                        add_child(LINK_5_6, &_link_5_6);
-                        add_child(LINK_7_8, &_link_7_8);
-                        add_child(COUNTER, &_counter);
+  SimpleGraphManager(
+      artis::common::Coordinator<artis::common::DoubleTime> *coordinator,
+      const GeneratorParameters &parameters,
+      const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<artis::common::DoubleTime, GeneratorParameters>(
+          coordinator, parameters, graph_parameters),
+      _generator("generator", parameters),
+      _link_1_2("link_1_2", parameters, artis::common::NoParameters()),
+      _link_3_4("link_3_4", parameters, artis::common::NoParameters()),
+      _link_5_6("link_5_6", parameters, artis::common::NoParameters()),
+      _link_7_8("link_7_8", parameters, artis::common::NoParameters()),
+      _counter("counter", artis::common::NoParameters()) {
+    add_child(GENERATOR, &_generator);
+    add_child(LINK_1_2, &_link_1_2);
+    add_child(LINK_3_4, &_link_3_4);
+    add_child(LINK_5_6, &_link_5_6);
+    add_child(LINK_7_8, &_link_7_8);
+    add_child(COUNTER, &_counter);
 
-                        out({&_generator, Generator::outputs::OUT})
-                                >> in({&_link_1_2, LinksGraphManager::inputs::IN_1});
-                        out({&_generator, Generator::outputs::OUT + 1})
-                                >> in({&_link_1_2, LinksGraphManager::inputs::IN_2});
-                        out({&_generator, Generator::outputs::OUT + 2})
-                                >> in({&_link_3_4, LinksGraphManager::inputs::IN_1});
-                        out({&_generator, Generator::outputs::OUT + 3})
-                                >> in({&_link_3_4, LinksGraphManager::inputs::IN_2});
-                        out({&_generator, Generator::outputs::OUT + 4})
-                                >> in({&_link_5_6, LinksGraphManager::inputs::IN_1});
-                        out({&_generator, Generator::outputs::OUT + 5})
-                                >> in({&_link_5_6, LinksGraphManager::inputs::IN_2});
-                        out({&_generator, Generator::outputs::OUT + 6})
-                                >> in({&_link_7_8, LinksGraphManager::inputs::IN_1});
-                        out({&_generator, Generator::outputs::OUT + 7})
-                                >> in({&_link_7_8, LinksGraphManager::inputs::IN_2});
+    out({&_generator, Generator::outputs::OUT})
+        >> in({&_link_1_2, LinksGraphManager::inputs::IN_1});
+    out({&_generator, Generator::outputs::OUT + 1})
+        >> in({&_link_1_2, LinksGraphManager::inputs::IN_2});
+    out({&_generator, Generator::outputs::OUT + 2})
+        >> in({&_link_3_4, LinksGraphManager::inputs::IN_1});
+    out({&_generator, Generator::outputs::OUT + 3})
+        >> in({&_link_3_4, LinksGraphManager::inputs::IN_2});
+    out({&_generator, Generator::outputs::OUT + 4})
+        >> in({&_link_5_6, LinksGraphManager::inputs::IN_1});
+    out({&_generator, Generator::outputs::OUT + 5})
+        >> in({&_link_5_6, LinksGraphManager::inputs::IN_2});
+    out({&_generator, Generator::outputs::OUT + 6})
+        >> in({&_link_7_8, LinksGraphManager::inputs::IN_1});
+    out({&_generator, Generator::outputs::OUT + 7})
+        >> in({&_link_7_8, LinksGraphManager::inputs::IN_2});
 
-                        out({&_link_1_2, LinksGraphManager::outputs::OUT_1})
-                                >> in({&_counter, Counter::inputs::IN});
-                        out({&_link_1_2, LinksGraphManager::outputs::OUT_2})
-                                >> in({&_counter, Counter::inputs::IN});
-                        out({&_link_3_4, LinksGraphManager::outputs::OUT_1})
-                                >> in({&_counter, Counter::inputs::IN});
-                        out({&_link_3_4, LinksGraphManager::outputs::OUT_2})
-                                >> in({&_counter, Counter::inputs::IN});
-                        out({&_link_5_6, LinksGraphManager::outputs::OUT_1})
-                                >> in({&_counter, Counter::inputs::IN});
-                        out({&_link_5_6, LinksGraphManager::outputs::OUT_2})
-                                >> in({&_counter, Counter::inputs::IN});
-                        out({&_link_7_8, LinksGraphManager::outputs::OUT_1})
-                                >> in({&_counter, Counter::inputs::IN});
-                        out({&_link_7_8, LinksGraphManager::outputs::OUT_2})
-                                >> in({&_counter, Counter::inputs::IN});
-                    }
+    out({&_link_1_2, LinksGraphManager::outputs::OUT_1})
+        >> in({&_counter, Counter::inputs::IN});
+    out({&_link_1_2, LinksGraphManager::outputs::OUT_2})
+        >> in({&_counter, Counter::inputs::IN});
+    out({&_link_3_4, LinksGraphManager::outputs::OUT_1})
+        >> in({&_counter, Counter::inputs::IN});
+    out({&_link_3_4, LinksGraphManager::outputs::OUT_2})
+        >> in({&_counter, Counter::inputs::IN});
+    out({&_link_5_6, LinksGraphManager::outputs::OUT_1})
+        >> in({&_counter, Counter::inputs::IN});
+    out({&_link_5_6, LinksGraphManager::outputs::OUT_2})
+        >> in({&_counter, Counter::inputs::IN});
+    out({&_link_7_8, LinksGraphManager::outputs::OUT_1})
+        >> in({&_counter, Counter::inputs::IN});
+    out({&_link_7_8, LinksGraphManager::outputs::OUT_2})
+        >> in({&_counter, Counter::inputs::IN});
+  }
 
-                    ~SimpleGraphManager() override = default;
+  ~SimpleGraphManager() override = default;
 
-                    common::DoubleTime::type
-                    lookahead(const common::DoubleTime::type& t) const override
-                    {
-                        std::vector<double> lookaheads = {_generator.lookahead(t),
-                                                          _link_1_2.lookahead(t),
-                                                          _link_3_4.lookahead(t),
-                                                          _link_5_6.lookahead(t),
-                                                          _link_7_8.lookahead(t),
-                                                          _counter.lookahead(t)};
-                        return *std::min(lookaheads.begin(), lookaheads.end());
-                    }
+  common::DoubleTime::type
+  lookahead(const common::DoubleTime::type &t) const override {
+    std::vector<double> lookaheads = {_generator.lookahead(t),
+                                      _link_1_2.lookahead(t),
+                                      _link_3_4.lookahead(t),
+                                      _link_5_6.lookahead(t),
+                                      _link_7_8.lookahead(t),
+                                      _counter.lookahead(t)};
+    return *std::min(lookaheads.begin(), lookaheads.end());
+  }
 
-                    void init()
-                    {
-                        _link_1_2.set_sender(
-                                (dynamic_cast< artis::pdevs::multithreading::Coordinator<
-                                        artis::common::DoubleTime,
-                                        SimpleGraphManager,
-                                        GeneratorParameters,
-                                        artis::common::NoParameters>*>(this->coordinator()))->get_sender());
-                        _link_3_4.set_sender(
-                                (dynamic_cast< artis::pdevs::multithreading::Coordinator<
-                                        artis::common::DoubleTime,
-                                        SimpleGraphManager,
-                                        GeneratorParameters,
-                                        artis::common::NoParameters>*>(this->coordinator()))->get_sender());
-                        _link_5_6.set_sender(
-                                (dynamic_cast< artis::pdevs::multithreading::Coordinator<
-                                        artis::common::DoubleTime,
-                                        SimpleGraphManager,
-                                        GeneratorParameters,
-                                        artis::common::NoParameters>*>(this->coordinator()))->get_sender());
-                        _link_7_8.set_sender(
-                                (dynamic_cast< artis::pdevs::multithreading::Coordinator<
-                                        artis::common::DoubleTime,
-                                        SimpleGraphManager,
-                                        GeneratorParameters,
-                                        artis::common::NoParameters>*>(this->coordinator()))->get_sender());
-                    }
+  void init() {
+    _link_1_2.set_sender(
+        (dynamic_cast< artis::pdevs::multithreading::Coordinator<
+            artis::common::DoubleTime,
+            SimpleGraphManager,
+            GeneratorParameters,
+            artis::common::NoParameters> *>(this->coordinator()))->get_sender());
+    _link_3_4.set_sender(
+        (dynamic_cast< artis::pdevs::multithreading::Coordinator<
+            artis::common::DoubleTime,
+            SimpleGraphManager,
+            GeneratorParameters,
+            artis::common::NoParameters> *>(this->coordinator()))->get_sender());
+    _link_5_6.set_sender(
+        (dynamic_cast< artis::pdevs::multithreading::Coordinator<
+            artis::common::DoubleTime,
+            SimpleGraphManager,
+            GeneratorParameters,
+            artis::common::NoParameters> *>(this->coordinator()))->get_sender());
+    _link_7_8.set_sender(
+        (dynamic_cast< artis::pdevs::multithreading::Coordinator<
+            artis::common::DoubleTime,
+            SimpleGraphManager,
+            GeneratorParameters,
+            artis::common::NoParameters> *>(this->coordinator()))->get_sender());
+  }
+
+  void start(common::DoubleTime::type t) {
+    _link_1_2.get_sender().send(
+        artis::pdevs::multithreading::start_message<
+            artis::common::DoubleTime>(t));
+    _link_3_4.get_sender().send(
+        artis::pdevs::multithreading::start_message<
+            artis::common::DoubleTime>(t));
+    _link_5_6.get_sender().send(
+        artis::pdevs::multithreading::start_message<
+            artis::common::DoubleTime>(t));
+    _link_7_8.get_sender().send(
+        artis::pdevs::multithreading::start_message<
+            artis::common::DoubleTime>(t));
+  }
 
-                    void start(common::DoubleTime::type t)
-                    {
+  void transition(const common::Models<common::DoubleTime> &receivers,
+                  artis::common::DoubleTime::type t) {
+    std::for_each(receivers.begin(), receivers.end(),
+                  [this, t](const common::Model<common::DoubleTime> *model) {
+                    if (not model->is_atomic()) {
+                      if (model == &_link_1_2) {
                         _link_1_2.get_sender().send(
-                                artis::pdevs::multithreading::start_message<
-                                        artis::common::DoubleTime>(t));
+                            artis::pdevs::multithreading::transition_message<
+                                artis::common::DoubleTime>(t));
+                      } else if (model == &_link_3_4) {
                         _link_3_4.get_sender().send(
-                                artis::pdevs::multithreading::start_message<
-                                        artis::common::DoubleTime>(t));
+                            artis::pdevs::multithreading::transition_message<
+                                artis::common::DoubleTime>(t));
+                      } else if (model == &_link_5_6) {
                         _link_5_6.get_sender().send(
-                                artis::pdevs::multithreading::start_message<
-                                        artis::common::DoubleTime>(t));
+                            artis::pdevs::multithreading::transition_message<
+                                artis::common::DoubleTime>(t));
+                      } else if (model == &_link_7_8) {
                         _link_7_8.get_sender().send(
-                                artis::pdevs::multithreading::start_message<
-                                        artis::common::DoubleTime>(t));
-                    }
-
-                    void transition(const common::Models<common::DoubleTime>& receivers,
-                            artis::common::DoubleTime::type t)
-                    {
-                        std::for_each(receivers.begin(), receivers.end(),
-                                [this, t](const common::Model<common::DoubleTime>* model) {
-                                    if (not model->is_atomic()) {
-                                        if (model == &_link_1_2) {
-                                            _link_1_2.get_sender().send(
-                                                    artis::pdevs::multithreading::transition_message<
-                                                            artis::common::DoubleTime>(t));
-                                        } else if (model == &_link_3_4) {
-                                            _link_3_4.get_sender().send(
-                                                    artis::pdevs::multithreading::transition_message<
-                                                            artis::common::DoubleTime>(t));
-                                        } else if (model == &_link_5_6) {
-                                            _link_5_6.get_sender().send(
-                                                    artis::pdevs::multithreading::transition_message<
-                                                            artis::common::DoubleTime>(t));
-                                        } else if (model == &_link_7_8) {
-                                            _link_7_8.get_sender().send(
-                                                    artis::pdevs::multithreading::transition_message<
-                                                            artis::common::DoubleTime>(t));
-                                        }
-                                    }
-                                });
+                            artis::pdevs::multithreading::transition_message<
+                                artis::common::DoubleTime>(t));
+                      }
                     }
+                  });
+  }
 
-                private:
-                    artis::pdevs::Simulator<artis::common::DoubleTime, Generator, GeneratorParameters> _generator;
+private:
+  artis::pdevs::Simulator<artis::common::DoubleTime, Generator, GeneratorParameters> _generator;
 /*
                     artis::pdevs::Coordinator<artis::common::DoubleTime, LinksGraphManager, GeneratorParameters, artis::common::NoParameters> _link_1_2;
                     artis::pdevs::Coordinator<artis::common::DoubleTime, LinksGraphManager, GeneratorParameters, artis::common::NoParameters> _link_3_4;
                     artis::pdevs::Coordinator<artis::common::DoubleTime, LinksGraphManager, GeneratorParameters, artis::common::NoParameters> _link_5_6;
                     artis::pdevs::Coordinator<artis::common::DoubleTime, LinksGraphManager, GeneratorParameters, artis::common::NoParameters> _link_7_8;
 */
-                    artis::pdevs::multithreading::Coordinator<artis::common::DoubleTime, LinksGraphManager, GeneratorParameters, artis::common::NoParameters> _link_1_2;
-                    artis::pdevs::multithreading::Coordinator<artis::common::DoubleTime, LinksGraphManager, GeneratorParameters, artis::common::NoParameters> _link_3_4;
-                    artis::pdevs::multithreading::Coordinator<artis::common::DoubleTime, LinksGraphManager, GeneratorParameters, artis::common::NoParameters> _link_5_6;
-                    artis::pdevs::multithreading::Coordinator<artis::common::DoubleTime, LinksGraphManager, GeneratorParameters, artis::common::NoParameters> _link_7_8;
-                    artis::pdevs::Simulator<artis::common::DoubleTime, Counter> _counter;
-                };
+  artis::pdevs::multithreading::Coordinator<artis::common::DoubleTime,
+                                            LinksGraphManager,
+                                            GeneratorParameters,
+                                            artis::common::NoParameters> _link_1_2;
+  artis::pdevs::multithreading::Coordinator<artis::common::DoubleTime,
+                                            LinksGraphManager,
+                                            GeneratorParameters,
+                                            artis::common::NoParameters> _link_3_4;
+  artis::pdevs::multithreading::Coordinator<artis::common::DoubleTime,
+                                            LinksGraphManager,
+                                            GeneratorParameters,
+                                            artis::common::NoParameters> _link_5_6;
+  artis::pdevs::multithreading::Coordinator<artis::common::DoubleTime,
+                                            LinksGraphManager,
+                                            GeneratorParameters,
+                                            artis::common::NoParameters> _link_7_8;
+  artis::pdevs::Simulator<artis::common::DoubleTime, Counter> _counter;
+};
 
-            }
-        }
-    }
+}
+}
+}
 } // namespace artis tests multithreading simple
 
 #endif

+ 33 - 36
src/tests/multithreading/simple/main.cpp

@@ -36,55 +36,52 @@ using namespace artis::common;
 using namespace std::chrono;
 using namespace artis::tests::multithreading::simple;
 
-void simple_monothreading()
-{
-    GeneratorParameters parameters = {10, 2, 5, 763752};
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 1000);
-    artis::common::RootCoordinator<
-            DoubleTime, artis::pdevs::Coordinator<
-                    DoubleTime,
-                    SimpleGraphManager,
-                    GeneratorParameters,
-                    NoParameters>
-    > rc(context, "root", parameters, NoParameters());
+void simple_monothreading() {
+  GeneratorParameters parameters = {10, 2, 5, 763752};
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 1000);
+  artis::common::RootCoordinator<
+      DoubleTime, artis::pdevs::Coordinator<
+          DoubleTime,
+          SimpleGraphManager,
+          GeneratorParameters,
+          NoParameters>
+  > rc(context, "root", parameters, NoParameters());
 
-    steady_clock::time_point t1 = steady_clock::now();
+  steady_clock::time_point t1 = steady_clock::now();
 
-    rc.run(context);
+  rc.run(context);
 
-    steady_clock::time_point t2 = steady_clock::now();
+  steady_clock::time_point t2 = steady_clock::now();
 
-    duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
+  duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
 
-    std::cout << "Time = " << time_span.count() << std::endl;
+  std::cout << "Time = " << time_span.count() << std::endl;
 }
 
-void simple_multithreading()
-{
-    GeneratorParameters parameters = {10, 2, 5, 763752};
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 1000);
-    artis::common::RootCoordinator<
-            DoubleTime, artis::pdevs::multithreading::Coordinator<
-                    DoubleTime,
-                    SimpleGraphManager,
-                    GeneratorParameters,
-                    NoParameters>
-    > rc(context, "root", parameters, NoParameters());
+void simple_multithreading() {
+  GeneratorParameters parameters = {10, 2, 5, 763752};
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 1000);
+  artis::common::RootCoordinator<
+      DoubleTime, artis::pdevs::multithreading::Coordinator<
+          DoubleTime,
+          SimpleGraphManager,
+          GeneratorParameters,
+          NoParameters>
+  > rc(context, "root", parameters, NoParameters());
 
-    steady_clock::time_point t1 = steady_clock::now();
+  steady_clock::time_point t1 = steady_clock::now();
 
-    rc.run(context);
+  rc.run(context);
 
-    steady_clock::time_point t2 = steady_clock::now();
+  steady_clock::time_point t2 = steady_clock::now();
 
-    duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
+  duration<double> time_span = duration_cast<duration<double> >(t2 - t1);
 
-    std::cout << "Time = " << time_span.count() << std::endl;
+  std::cout << "Time = " << time_span.count() << std::endl;
 }
 
-int main()
-{
+int main() {
 //    simple_monothreading();
-    simple_multithreading();
-    return 0;
+  simple_multithreading();
+  return 0;
 }

+ 340 - 356
src/tests/multithreading/simple/models.hpp

@@ -33,371 +33,355 @@
 #include <iostream>
 
 namespace artis {
-    namespace tests {
-        namespace multithreading {
-            namespace simple {
-
-                void delay()
-                {
-                    for (unsigned int i = 0; i < 1000; ++i) {
-                        std::vector < int > v;
-
-                        for (unsigned int j = 1000; j > 0; --j) {
-                            v.push_back(j);
-                        }
-                        std::sort(v.begin(), v.end());
-                    }
-                }
-
-                struct State {
-                    enum values {
-                        STOP, UP, MAX, DOWN
-                    };
-                };
-
-                struct Vehicle {
-                    unsigned int index;
-                    double v_max;
-                    double acceleration;
-                    State::values state;
-                    artis::common::DoubleTime::type next_time;
-                };
-
-                struct GeneratorParameters {
-                    double v_max;
-                    double mean;
-                    double stddev;
-                    unsigned long seed;
-                };
-
-                class Generator
-                        : public artis::pdevs::Dynamics<artis::common::DoubleTime, Generator, GeneratorParameters> {
-                public:
-                    struct outputs {
-                        enum values {
-                            OUT
-                        };
-                    };
-
-                    Generator(const std::string& name,
-                            const artis::pdevs::Context<artis::common::DoubleTime, Generator, GeneratorParameters>& context)
-                            :
-                            artis::pdevs::Dynamics<artis::common::DoubleTime, Generator, GeneratorParameters>(
-                                    name, context),
-                            _v_max(context.parameters().v_max),
-                            _distribution(context.parameters().mean, context.parameters().stddev),
-                            _v_max_distribution(0.5, 1.),
-                            _port_distribution(0, 7)
-                    {
-                        _generator.seed(context.parameters().seed);
-
-                        output_ports({{outputs::OUT, "out_1"}});
-                        output_ports({{outputs::OUT + 1, "out_2"}});
-                        output_ports({{outputs::OUT + 2, "out_3"}});
-                        output_ports({{outputs::OUT + 3, "out_4"}});
-                        output_ports({{outputs::OUT + 4, "out_5"}});
-                        output_ports({{outputs::OUT + 5, "out_6"}});
-                        output_ports({{outputs::OUT + 6, "out_7"}});
-                        output_ports({{outputs::OUT + 7, "out_8"}});
-                    }
-
-                    ~Generator() override = default;
-
-                    void dint(const artis::common::DoubleTime::type& t) override
-                    {
-                        _last_time = t;
-                        _sigma = _distribution(_generator);
-                        _sigma = _sigma <= 0 ? 0.1 : _sigma;
-
-                        _next_v_max = _v_max * _v_max_distribution(_generator);
-                        _next_port = _port_distribution(_generator);
-                        ++_index;
-                    }
-
-                    void start(const artis::common::DoubleTime::type& t) override
-                    {
-                        _last_time = t;
-                        _sigma = _distribution(_generator);
-                        _sigma = _sigma <= 0 ? 0.1 : _sigma;
-                        _next_v_max = _v_max * _v_max_distribution(_generator);
-                        _next_port = _port_distribution(_generator);
-                        _index = 1;
-                    }
-
-                    artis::common::DoubleTime::type
-                    ta(const artis::common::DoubleTime::type& /* t */) const override { return _sigma; }
-
-                    artis::common::Bag<artis::common::DoubleTime>
-                    lambda(const artis::common::DoubleTime::type& t) const override
-                    {
-                        artis::common::Bag<artis::common::DoubleTime> bag;
-
-                        if (t > 0) {
-                            Vehicle vehicle = {_index, _next_v_max, 0.5, State::STOP, t};
-
-                            bag.push_back(
-                                    artis::common::ExternalEvent<artis::common::DoubleTime>(
-                                            outputs::OUT + _next_port, vehicle));
-                        }
-                        return bag;
-                    }
+namespace tests {
+namespace multithreading {
+namespace simple {
 
-                    common::DoubleTime::type
-                    lookahead(const common::DoubleTime::type& /* t */) const override
-                    {
-                        return _last_time + _sigma;
-                    }
-
-                private:
-                    // parameters
-                    double _v_max;
-
-                    // state
-                    artis::common::DoubleTime::type _sigma;
-                    artis::common::DoubleTime::type _last_time;
-                    std::default_random_engine _generator;
-                    std::normal_distribution<double> _distribution;
-                    std::uniform_real_distribution<double> _v_max_distribution;
-                    std::uniform_int_distribution<int> _port_distribution;
-                    double _next_v_max;
-                    int _next_port;
-                    unsigned int _index;
-                };
-
-                class Counter
-                        : public artis::pdevs::Dynamics<artis::common::DoubleTime, Counter> {
-                public:
-                    struct inputs {
-                        enum values {
-                            IN
-                        };
-                    };
-
-                    struct vars {
-                        enum values {
-                            COUNTER
-                        };
-                    };
-
-                    Counter(const std::string& name,
-                            const artis::pdevs::Context<artis::common::DoubleTime, Counter>& context)
-                            :
-                            artis::pdevs::Dynamics<artis::common::DoubleTime, Counter>(name,
-                                    context)
-                    {
-                        input_port({inputs::IN, "in"});
-                        observable({vars::COUNTER, "counter"});
-                    }
-
-                    ~Counter() override = default;
+void delay() {
+  for (unsigned int i = 0; i < 1000; ++i) {
+    std::vector<int> v;
 
-                    void
-                    dext(const artis::common::DoubleTime::type& /* t */,
-                            const artis::common::DoubleTime::type& /* e */,
-                            const artis::common::Bag<artis::common::DoubleTime>& bag) override
-                    {
+    for (unsigned int j = 1000; j > 0; --j) {
+      v.push_back(j);
+    }
+    std::sort(v.begin(), v.end());
+  }
+}
+
+struct State {
+  enum values {
+    STOP, UP, MAX, DOWN
+  };
+};
+
+struct Vehicle {
+  unsigned int index;
+  double v_max;
+  double acceleration;
+  State::values state;
+  artis::common::DoubleTime::type next_time;
+};
+
+struct GeneratorParameters {
+  double v_max;
+  double mean;
+  double stddev;
+  unsigned long seed;
+};
+
+class Generator
+    : public artis::pdevs::Dynamics<artis::common::DoubleTime, Generator, GeneratorParameters> {
+public:
+  struct outputs {
+    enum values {
+      OUT
+    };
+  };
+
+  Generator(const std::string &name,
+            const artis::pdevs::Context<artis::common::DoubleTime,
+                                        Generator,
+                                        GeneratorParameters> &context)
+      :
+      artis::pdevs::Dynamics<artis::common::DoubleTime, Generator, GeneratorParameters>(
+          name, context),
+      _v_max(context.parameters().v_max),
+      _distribution(context.parameters().mean, context.parameters().stddev),
+      _v_max_distribution(0.5, 1.),
+      _port_distribution(0, 7) {
+    _generator.seed(context.parameters().seed);
+
+    output_ports({{outputs::OUT, "out_1"}});
+    output_ports({{outputs::OUT + 1, "out_2"}});
+    output_ports({{outputs::OUT + 2, "out_3"}});
+    output_ports({{outputs::OUT + 3, "out_4"}});
+    output_ports({{outputs::OUT + 4, "out_5"}});
+    output_ports({{outputs::OUT + 5, "out_6"}});
+    output_ports({{outputs::OUT + 6, "out_7"}});
+    output_ports({{outputs::OUT + 7, "out_8"}});
+  }
+
+  ~Generator() override = default;
+
+  void dint(const artis::common::DoubleTime::type &t) override {
+    _last_time = t;
+    _sigma = _distribution(_generator);
+    _sigma = _sigma <= 0 ? 0.1 : _sigma;
+
+    _next_v_max = _v_max * _v_max_distribution(_generator);
+    _next_port = _port_distribution(_generator);
+    ++_index;
+  }
+
+  void start(const artis::common::DoubleTime::type &t) override {
+    _last_time = t;
+    _sigma = _distribution(_generator);
+    _sigma = _sigma <= 0 ? 0.1 : _sigma;
+    _next_v_max = _v_max * _v_max_distribution(_generator);
+    _next_port = _port_distribution(_generator);
+    _index = 1;
+  }
+
+  artis::common::DoubleTime::type
+  ta(const artis::common::DoubleTime::type & /* t */) const override { return _sigma; }
+
+  artis::common::Bag<artis::common::DoubleTime>
+  lambda(const artis::common::DoubleTime::type &t) const override {
+    artis::common::Bag<artis::common::DoubleTime> bag;
+
+    if (t > 0) {
+      Vehicle vehicle = {_index, _next_v_max, 0.5, State::STOP, t};
+
+      bag.push_back(
+          artis::common::ExternalEvent<artis::common::DoubleTime>(
+              outputs::OUT + _next_port, vehicle));
+    }
+    return bag;
+  }
+
+  common::DoubleTime::type
+  lookahead(const common::DoubleTime::type & /* t */) const override {
+    return _last_time + _sigma;
+  }
+
+private:
+  // parameters
+  double _v_max;
+
+  // state
+  artis::common::DoubleTime::type _sigma;
+  artis::common::DoubleTime::type _last_time;
+  std::default_random_engine _generator;
+  std::normal_distribution<double> _distribution;
+  std::uniform_real_distribution<double> _v_max_distribution;
+  std::uniform_int_distribution<int> _port_distribution;
+  double _next_v_max;
+  int _next_port;
+  unsigned int _index;
+};
+
+class Counter
+    : public artis::pdevs::Dynamics<artis::common::DoubleTime, Counter> {
+public:
+  struct inputs {
+    enum values {
+      IN
+    };
+  };
+
+  struct vars {
+    enum values {
+      COUNTER
+    };
+  };
+
+  Counter(const std::string &name,
+          const artis::pdevs::Context<artis::common::DoubleTime, Counter> &context)
+      :
+      artis::pdevs::Dynamics<artis::common::DoubleTime, Counter>(name,
+                                                                 context) {
+    input_port({inputs::IN, "in"});
+    observable({vars::COUNTER, "counter"});
+  }
+
+  ~Counter() override = default;
+
+  void
+  dext(const artis::common::DoubleTime::type & /* t */,
+       const artis::common::DoubleTime::type & /* e */,
+       const artis::common::Bag<artis::common::DoubleTime> &bag) override {
 
 //                        std::cout << t << ": " << _counter << std::endl;
 
-                        _counter += bag.size();
-                    }
-
-                    void start(const artis::common::DoubleTime::type& /* t */) override
-                    {
-                        _counter = 0;
-                    }
-
-                    artis::common::DoubleTime::type
-                    ta(const artis::common::DoubleTime::type& /* t */) const override
-                    {
-                        return artis::common::DoubleTime::infinity;
-                    }
-
-                    artis::common::Value
-                    observe(const artis::common::DoubleTime::type& /* t */,
-                            unsigned int index) const override
-                    {
-                        if (index == vars::COUNTER) {
-                            return _counter;
-                        } else {
-                            return artis::common::Value();
-                        }
-                    }
-
-                    common::DoubleTime::type
-                    lookahead(const common::DoubleTime::type& /* t */) const override
-                    {
-                        return common::DoubleTime::infinity;
-                    }
-
-                private:
-                    unsigned int _counter;
-                };
-
-                class Link :
-                        public artis::pdevs::Dynamics<common::DoubleTime, Link> {
-                public :
-                    struct inputs {
-                        enum values {
-                            IN
-                        };
-                    };
-
-                    struct outputs {
-                        enum values {
-                            OUT
-                        };
-                    };
-
-                    Link(const std::string& name,
-                            const artis::pdevs::Context<common::DoubleTime, Link>& context)
-                            :artis::pdevs::Dynamics<common::DoubleTime, Link>(name, context)
-                    {
-                        input_port({inputs::IN, "in"});
-                        output_port({outputs::OUT, "out"});
-                    }
-
-                    ~ Link() override = default;
-
-                    void dint(const artis::common::DoubleTime::type& t) override
-                    {
-                        delay();
-
-                        auto it = _vehicles.begin();
-
-                        while (it != _vehicles.end()) {
-                            if (it->next_time == t and it->state == State::STOP) {
-                                _vehicles.erase(it);
-                                it = _vehicles.begin();
-                            } else {
-                                ++it;
-                            }
-                        }
-                        for (auto& vehicle: _vehicles) {
-                            if (vehicle.next_time == t) {
-                                switch (vehicle.state) {
-                                case State::UP: {
-                                    double duration = vehicle.v_max / vehicle.acceleration;
-                                    double acceleration_distance =
-                                            0.5 * vehicle.acceleration * duration * duration;
-
-                                    vehicle.state = State::MAX;
-                                    vehicle.next_time = t +
-                                            (_length - 2 * acceleration_distance) / vehicle.v_max;
-                                    break;
-                                }
-                                case State::MAX: {
-                                    vehicle.state = State::DOWN;
-                                    vehicle.next_time = t + vehicle.v_max / vehicle.acceleration;
-                                    break;
-                                }
-                                case State::DOWN: {
-                                    vehicle.state = State::STOP;
-                                    vehicle.next_time = t;
-                                    break;
-                                }
-                                case State::STOP: {
-                                    assert(false);
-                                    break;
-                                }
-                                }
-                            }
-                        }
-                        update_sigma(t);
-                    }
-
-                    void dext(const artis::common::DoubleTime::type& t,
-                            const artis::common::DoubleTime::type& /* e */,
-                            const artis::common::Bag<artis::common::DoubleTime>& bag) override
-                    {
-                        std::for_each(bag.begin(), bag.end(),
-                                [this, t](const common::ExternalEvent<common::DoubleTime>& event) {
-                                    if (event.on_port(inputs::IN)) {
-                                        Vehicle vehicle;
-
-                                        event.data()(vehicle);
-                                        vehicle.next_time =
-                                                t + vehicle.v_max / vehicle.acceleration;
-                                        vehicle.state = State::UP;
-                                        _vehicles.push_back(vehicle);
-                                    }
-                                });
-                        update_sigma(t);
-                    }
-
-                    artis::common::DoubleTime::type
-                    ta(const artis::common::DoubleTime::type& /* t */) const override { return _sigma; }
-
-                    artis::common::Bag<artis::common::DoubleTime>
-                    lambda(const artis::common::DoubleTime::type& t) const override
-                    {
-                        artis::common::Bag<artis::common::DoubleTime> bag;
-
-                        for (auto vehicle: _vehicles) {
-                            if (vehicle.next_time == t and vehicle.state == State::STOP) {
-                                bag.push_back(
-                                        artis::common::ExternalEvent<artis::common::DoubleTime>(
-                                                outputs::OUT, vehicle));
-                            }
-                        }
-                        return bag;
-                    }
-
-                    void
-                    start(const artis::common::DoubleTime::type& /* t */) override { }
-
-                    common::DoubleTime::type
-                    lookahead(const common::DoubleTime::type& t) const override
-                    {
-                        double eot = artis::common::DoubleTime::infinity;
-
-                        for (auto vehicle: _vehicles) {
-                            double eot_i = artis::common::DoubleTime::infinity;
-
-                            if (vehicle.next_time == t and vehicle.state == State::STOP) {
-                                eot_i = t;
-                            } else if (vehicle.state == State::DOWN) {
-                                eot_i = vehicle.next_time;
-                            } else if (vehicle.state == State::MAX) {
-                                eot_i = vehicle.next_time + vehicle.v_max / vehicle.acceleration;
-                            } else if (vehicle.state == State::UP) {
-                                double duration = vehicle.v_max / vehicle.acceleration;
-                                double acceleration_distance =
-                                        0.5 * vehicle.acceleration * duration * duration;
-
-                                eot_i = vehicle.next_time
-                                        + (_length - 2 * acceleration_distance) / vehicle.v_max
-                                        + vehicle.v_max / vehicle.acceleration;
-                            }
-                            if (eot_i < eot) {
-                                eot = eot_i;
-                            }
-                        }
-                        return eot;
-                    }
-
-                private:
-                    void update_sigma(const artis::common::DoubleTime::type& t)
-                    {
-                        if (_vehicles.empty()) {
-                            _sigma = artis::common::DoubleTime::infinity;
-                        } else {
-                            _sigma = std::min_element(_vehicles.begin(), _vehicles.end(),
-                                    [](const Vehicle& e1, const Vehicle& e2) {
-                                        return e1.next_time < e2.next_time;
-                                    })->next_time - t;
-                        }
+    _counter += bag.size();
+  }
+
+  void start(const artis::common::DoubleTime::type & /* t */) override {
+    _counter = 0;
+  }
+
+  artis::common::DoubleTime::type
+  ta(const artis::common::DoubleTime::type & /* t */) const override {
+    return artis::common::DoubleTime::infinity;
+  }
+
+  artis::common::Value
+  observe(const artis::common::DoubleTime::type & /* t */,
+          unsigned int index) const override {
+    if (index == vars::COUNTER) {
+      return _counter;
+    } else {
+      return artis::common::Value();
+    }
+  }
+
+  common::DoubleTime::type
+  lookahead(const common::DoubleTime::type & /* t */) const override {
+    return common::DoubleTime::infinity;
+  }
+
+private:
+  unsigned int _counter;
+};
+
+class Link :
+    public artis::pdevs::Dynamics<common::DoubleTime, Link> {
+public :
+  struct inputs {
+    enum values {
+      IN
+    };
+  };
+
+  struct outputs {
+    enum values {
+      OUT
+    };
+  };
+
+  Link(const std::string &name,
+       const artis::pdevs::Context<common::DoubleTime, Link> &context)
+      : artis::pdevs::Dynamics<common::DoubleTime, Link>(name, context) {
+    input_port({inputs::IN, "in"});
+    output_port({outputs::OUT, "out"});
+  }
+
+  ~ Link() override = default;
+
+  void dint(const artis::common::DoubleTime::type &t) override {
+    delay();
+
+    auto it = _vehicles.begin();
+
+    while (it != _vehicles.end()) {
+      if (it->next_time == t and it->state == State::STOP) {
+        _vehicles.erase(it);
+        it = _vehicles.begin();
+      } else {
+        ++it;
+      }
+    }
+    for (auto &vehicle: _vehicles) {
+      if (vehicle.next_time == t) {
+        switch (vehicle.state) {
+        case State::UP: {
+          double duration = vehicle.v_max / vehicle.acceleration;
+          double acceleration_distance =
+              0.5 * vehicle.acceleration * duration * duration;
+
+          vehicle.state = State::MAX;
+          vehicle.next_time = t +
+              (_length - 2 * acceleration_distance) / vehicle.v_max;
+          break;
+        }
+        case State::MAX: {
+          vehicle.state = State::DOWN;
+          vehicle.next_time = t + vehicle.v_max / vehicle.acceleration;
+          break;
+        }
+        case State::DOWN: {
+          vehicle.state = State::STOP;
+          vehicle.next_time = t;
+          break;
+        }
+        case State::STOP: {
+          assert(false);
+          break;
+        }
+        }
+      }
+    }
+    update_sigma(t);
+  }
+
+  void dext(const artis::common::DoubleTime::type &t,
+            const artis::common::DoubleTime::type & /* e */,
+            const artis::common::Bag<artis::common::DoubleTime> &bag) override {
+    std::for_each(bag.begin(), bag.end(),
+                  [this, t](const common::ExternalEvent<common::DoubleTime> &event) {
+                    if (event.on_port(inputs::IN)) {
+                      Vehicle vehicle;
+
+                      event.data()(vehicle);
+                      vehicle.next_time =
+                          t + vehicle.v_max / vehicle.acceleration;
+                      vehicle.state = State::UP;
+                      _vehicles.push_back(vehicle);
                     }
+                  });
+    update_sigma(t);
+  }
+
+  artis::common::DoubleTime::type
+  ta(const artis::common::DoubleTime::type & /* t */) const override { return _sigma; }
+
+  artis::common::Bag<artis::common::DoubleTime>
+  lambda(const artis::common::DoubleTime::type &t) const override {
+    artis::common::Bag<artis::common::DoubleTime> bag;
+
+    for (auto vehicle: _vehicles) {
+      if (vehicle.next_time == t and vehicle.state == State::STOP) {
+        bag.push_back(
+            artis::common::ExternalEvent<artis::common::DoubleTime>(
+                outputs::OUT, vehicle));
+      }
+    }
+    return bag;
+  }
+
+  void
+  start(const artis::common::DoubleTime::type & /* t */) override {}
+
+  common::DoubleTime::type
+  lookahead(const common::DoubleTime::type &t) const override {
+    double eot = artis::common::DoubleTime::infinity;
+
+    for (auto vehicle: _vehicles) {
+      double eot_i = artis::common::DoubleTime::infinity;
+
+      if (vehicle.next_time == t and vehicle.state == State::STOP) {
+        eot_i = t;
+      } else if (vehicle.state == State::DOWN) {
+        eot_i = vehicle.next_time;
+      } else if (vehicle.state == State::MAX) {
+        eot_i = vehicle.next_time + vehicle.v_max / vehicle.acceleration;
+      } else if (vehicle.state == State::UP) {
+        double duration = vehicle.v_max / vehicle.acceleration;
+        double acceleration_distance =
+            0.5 * vehicle.acceleration * duration * duration;
+
+        eot_i = vehicle.next_time
+            + (_length - 2 * acceleration_distance) / vehicle.v_max
+            + vehicle.v_max / vehicle.acceleration;
+      }
+      if (eot_i < eot) {
+        eot = eot_i;
+      }
+    }
+    return eot;
+  }
+
+private:
+  void update_sigma(const artis::common::DoubleTime::type &t) {
+    if (_vehicles.empty()) {
+      _sigma = artis::common::DoubleTime::infinity;
+    } else {
+      _sigma = std::min_element(_vehicles.begin(), _vehicles.end(),
+                                [](const Vehicle &e1, const Vehicle &e2) {
+                                  return e1.next_time < e2.next_time;
+                                })->next_time - t;
+    }
+  }
 
-                    const double _length = 500;
+  const double _length = 500;
 
-                    std::deque<Vehicle> _vehicles;
-                    artis::common::DoubleTime::type _sigma;
-                };
+  std::deque<Vehicle> _vehicles;
+  artis::common::DoubleTime::type _sigma;
+};
 
-            }
-        }
-    }
+}
+}
+}
 } // namespace artis tests multithreading simple
 
 #endif

+ 152 - 157
src/tests/pdevs/graph_manager.hpp

@@ -34,163 +34,158 @@
 #include <artis-star/kernel/pdevs/Simulator.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace pdevs {
-
-            class S1GraphManager : public artis::pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneA, OneB
-                };
-                enum outputs {
-                    OUT
-                };
-
-                S1GraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        a("a1", parameters), b("b1", parameters)
-                {
-                    add_child(OneA, &a);
-                    add_child(OneB, &b);
-
-                    coordinator->output_port({OUT, "out"});
-
-                    out({&a, A::OUT}) >> in({&b, B::IN});
-                    out({&b, B::OUT}) >> out({coordinator, OUT});
-                }
-
-                ~S1GraphManager() override = default;
-
-            private:
-                artis::pdevs::Simulator<common::DoubleTime, A> a;
-                artis::pdevs::Simulator<common::DoubleTime, B> b;
-            };
-
-            class S2GraphManager : public artis::pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneA, OneB
-                };
-                enum inputs {
-                    IN
-                };
-
-                S2GraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        a("a2", parameters), b("b2", parameters)
-                {
-                    add_child(OneA, &a);
-                    add_child(OneB, &b);
-
-                    coordinator->input_port({IN, "in"});
-
-                    in({coordinator, IN}) >> in({&a, A::IN});
-                    out({&a, A::OUT}) >> in({&b, B::IN});
-                }
-
-                ~S2GraphManager() override = default;
-
-            private:
-                artis::pdevs::Simulator<common::DoubleTime, A> a;
-                artis::pdevs::Simulator<common::DoubleTime, B> b;
-            };
-
-            class RootGraphManager :
-                    public artis::pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneS1, OneS2
-                };
-
-                RootGraphManager(
-                        common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        S1("S1", parameters, graph_parameters),
-                        S2("S2", parameters, graph_parameters)
-                {
-                    add_child(OneS1, &S1);
-                    add_child(OneS2, &S2);
-
-                    out({&S1, S1GraphManager::OUT}) >> in({&S2, S2GraphManager::IN});
-                }
-
-                ~RootGraphManager() override = default;
-
-            private:
-                artis::pdevs::Coordinator<common::DoubleTime, S1GraphManager> S1;
-                artis::pdevs::Coordinator<common::DoubleTime, S2GraphManager> S2;
-            };
-
-            template<typename M>
-            class OnlyOneGraphManager :
-                    public artis::pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    OneM
-                };
-
-                OnlyOneGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        model("a", parameters)
-                {
-                    add_child(OneM, &model);
-                }
-
-                ~OnlyOneGraphManager() override = default;
-
-            private:
-                artis::pdevs::Simulator<common::DoubleTime, M> model;
-            };
-
-            class FlatGraphManager :
-                    public artis::pdevs::GraphManager<common::DoubleTime> {
-            public:
-                enum submodels {
-                    FirstA, SecondA,
-                    FirstB, SecondB
-                };
-
-                FlatGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::common::NoParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
-                        a1("a1", parameters), b1("b1", parameters),
-                        a2("a2", parameters), b2("b2", parameters)
-                {
-                    add_child(FirstA, &a1);
-                    add_child(FirstB, &b1);
-                    add_child(SecondA, &a2);
-                    add_child(SecondB, &b2);
-
-                    out({&a1, A::OUT}) >> in({&b1, B::IN});
-                    out({&b1, B::OUT}) >> in({&a2, A::IN});
-                    out({&a2, A::OUT}) >> in({&b2, B::IN});
-                }
-
-                ~FlatGraphManager() override = default;
-
-            private:
-                artis::pdevs::Simulator<common::DoubleTime, A> a1;
-                artis::pdevs::Simulator<common::DoubleTime, B> b1;
-                artis::pdevs::Simulator<common::DoubleTime, A> a2;
-                artis::pdevs::Simulator<common::DoubleTime, B> b2;
-            };
-
-        }
-    }
+namespace tests {
+namespace pdevs {
+
+class S1GraphManager : public artis::pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneA, OneB
+  };
+  enum outputs {
+    OUT
+  };
+
+  S1GraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                 const artis::common::NoParameters &parameters,
+                 const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      a("a1", parameters), b("b1", parameters) {
+    add_child(OneA, &a);
+    add_child(OneB, &b);
+
+    coordinator->output_port({OUT, "out"});
+
+    out({&a, A::OUT}) >> in({&b, B::IN});
+    out({&b, B::OUT}) >> out({coordinator, OUT});
+  }
+
+  ~S1GraphManager() override = default;
+
+private:
+  artis::pdevs::Simulator<common::DoubleTime, A> a;
+  artis::pdevs::Simulator<common::DoubleTime, B> b;
+};
+
+class S2GraphManager : public artis::pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneA, OneB
+  };
+  enum inputs {
+    IN
+  };
+
+  S2GraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                 const artis::common::NoParameters &parameters,
+                 const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      a("a2", parameters), b("b2", parameters) {
+    add_child(OneA, &a);
+    add_child(OneB, &b);
+
+    coordinator->input_port({IN, "in"});
+
+    in({coordinator, IN}) >> in({&a, A::IN});
+    out({&a, A::OUT}) >> in({&b, B::IN});
+  }
+
+  ~S2GraphManager() override = default;
+
+private:
+  artis::pdevs::Simulator<common::DoubleTime, A> a;
+  artis::pdevs::Simulator<common::DoubleTime, B> b;
+};
+
+class RootGraphManager :
+    public artis::pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneS1, OneS2
+  };
+
+  RootGraphManager(
+      common::Coordinator<common::DoubleTime> *coordinator,
+      const artis::common::NoParameters &parameters,
+      const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      S1("S1", parameters, graph_parameters),
+      S2("S2", parameters, graph_parameters) {
+    add_child(OneS1, &S1);
+    add_child(OneS2, &S2);
+
+    out({&S1, S1GraphManager::OUT}) >> in({&S2, S2GraphManager::IN});
+  }
+
+  ~RootGraphManager() override = default;
+
+private:
+  artis::pdevs::Coordinator<common::DoubleTime, S1GraphManager> S1;
+  artis::pdevs::Coordinator<common::DoubleTime, S2GraphManager> S2;
+};
+
+template<typename M>
+class OnlyOneGraphManager :
+    public artis::pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    OneM
+  };
+
+  OnlyOneGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                      const artis::common::NoParameters &parameters,
+                      const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      model("a", parameters) {
+    add_child(OneM, &model);
+  }
+
+  ~OnlyOneGraphManager() override = default;
+
+private:
+  artis::pdevs::Simulator<common::DoubleTime, M> model;
+};
+
+class FlatGraphManager :
+    public artis::pdevs::GraphManager<common::DoubleTime> {
+public:
+  enum submodels {
+    FirstA, SecondA,
+    FirstB, SecondB
+  };
+
+  FlatGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                   const artis::common::NoParameters &parameters,
+                   const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime>(coordinator, parameters, graph_parameters),
+      a1("a1", parameters), b1("b1", parameters),
+      a2("a2", parameters), b2("b2", parameters) {
+    add_child(FirstA, &a1);
+    add_child(FirstB, &b1);
+    add_child(SecondA, &a2);
+    add_child(SecondB, &b2);
+
+    out({&a1, A::OUT}) >> in({&b1, B::IN});
+    out({&b1, B::OUT}) >> in({&a2, A::IN});
+    out({&a2, A::OUT}) >> in({&b2, B::IN});
+  }
+
+  ~FlatGraphManager() override = default;
+
+private:
+  artis::pdevs::Simulator<common::DoubleTime, A> a1;
+  artis::pdevs::Simulator<common::DoubleTime, B> b1;
+  artis::pdevs::Simulator<common::DoubleTime, A> a2;
+  artis::pdevs::Simulator<common::DoubleTime, B> b2;
+};
+
+}
+}
 } // namespace artis tests pdevs
 
 #endif

+ 16 - 17
src/tests/pdevs/main.cpp

@@ -34,21 +34,20 @@
 
 using namespace artis::tests::pdevs;
 
-int main()
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 10000);
-    artis::common::RootCoordinator<
-            artis::common::DoubleTime, artis::pdevs::Coordinator<
-                    artis::common::DoubleTime,
-                    OnlyOneGraphManager<ThreeStateModel> >
-    > rc(context, "root", artis::common::NoParameters(), artis::common::NoParameters());
-
-    rc.run(context);
-    rc.save(context);
-
-    std::ofstream os("state");
-    boost::archive::binary_oarchive oa(os);
-
-    oa << context;
-    return 0;
+int main() {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 10000);
+  artis::common::RootCoordinator<
+      artis::common::DoubleTime, artis::pdevs::Coordinator<
+          artis::common::DoubleTime,
+          OnlyOneGraphManager<ThreeStateModel> >
+  > rc(context, "root", artis::common::NoParameters(), artis::common::NoParameters());
+
+  rc.run(context);
+  rc.save(context);
+
+  std::ofstream os("state");
+  boost::archive::binary_oarchive oa(os);
+
+  oa << context;
+  return 0;
 }

+ 480 - 507
src/tests/pdevs/models.hpp

@@ -38,609 +38,582 @@
 #define DELAY 100
 
 namespace artis {
-    namespace tests {
-        namespace pdevs {
-
-            struct data {
-                double x;
-                double y;
-
-                data()
-                        :x(0), y(0) { }
-
-                data(double _x, double _y)
-                        :x(_x), y(_y) { }
-            };
-
-            class Inactive : public artis::pdevs::Dynamics<common::DoubleTime, Inactive> {
-            public:
-                Inactive(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, Inactive>& context)
-                        :
-                        artis::pdevs::Dynamics<common::DoubleTime, Inactive>(name, context) { }
-
-                ~Inactive() override = default;
-            };
-
-            class A : public artis::pdevs::Dynamics<common::DoubleTime, A> {
-            public:
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                A(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, A, artis::common::NoParameters>& context)
-                        :
-                        artis::pdevs::Dynamics<common::DoubleTime, A>(name, context)
-                {
-                    input_ports({{IN, "in"}});
-                    output_ports({{OUT, "out"}});
-                }
-
-                ~A() override = default;
-
-                void dint(const typename common::DoubleTime::type& t) override
-                {
+namespace tests {
+namespace pdevs {
+
+struct data {
+  double x;
+  double y;
+
+  data()
+      : x(0), y(0) {}
+
+  data(double _x, double _y)
+      : x(_x), y(_y) {}
+};
+
+class Inactive : public artis::pdevs::Dynamics<common::DoubleTime, Inactive> {
+public:
+  Inactive(const std::string &name,
+           const artis::pdevs::Context<common::DoubleTime, Inactive> &context)
+      :
+      artis::pdevs::Dynamics<common::DoubleTime, Inactive>(name, context) {}
+
+  ~Inactive() override = default;
+};
+
+class A : public artis::pdevs::Dynamics<common::DoubleTime, A> {
+public:
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  A(const std::string &name,
+    const artis::pdevs::Context<common::DoubleTime, A, artis::common::NoParameters> &context)
+      :
+      artis::pdevs::Dynamics<common::DoubleTime, A>(name, context) {
+    input_ports({{IN, "in"}});
+    output_ports({{OUT, "out"}});
+  }
+
+  ~A() override = default;
+
+  void dint(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_INT,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_INT,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == WAIT) {
-                        ++_value.x;
-                        --_value.y;
-                        _phase = SEND;
-                    } else if (_phase == SEND) {
-                        _phase = WAIT;
-                    }
-                }
-
-                void
-                dext(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& /* e */,
-                        const common::Bag<common::DoubleTime>& msgs) override
-                {
+    if (_phase == WAIT) {
+      ++_value.x;
+      --_value.y;
+      _phase = SEND;
+    } else if (_phase == SEND) {
+      _phase = WAIT;
+    }
+  }
+
+  void
+  dext(const typename common::DoubleTime::type &t,
+       const typename common::DoubleTime::type & /* e */,
+       const common::Bag <common::DoubleTime> &msgs) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)msgs;
+    (void)t;
+    (void)msgs;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_EXT,
-                                    common::LevelType::USER)
-                            << "messages = " << msgs.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_EXT,
+                                                    common::LevelType::USER)
+        << "messages = " << msgs.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = SEND;
-                }
+    _phase = SEND;
+  }
 
-                void dconf(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& /* e */,
-                        const common::Bag<common::DoubleTime>& msgs) override
-                {
+  void dconf(const typename common::DoubleTime::type &t,
+             const typename common::DoubleTime::type & /* e */,
+             const common::Bag <common::DoubleTime> &msgs) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)msgs;
+    (void)t;
+    (void)msgs;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_CONF,
-                                    common::LevelType::USER)
-                            << "messages = " << msgs.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_CONF,
+                                                    common::LevelType::USER)
+        << "messages = " << msgs.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                }
+  }
 
-                void start(const typename common::DoubleTime::type& t) override
-                {
+  void start(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::START,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = SEND;
-                }
+    _phase = SEND;
+  }
 
-                typename common::DoubleTime::type
-                ta(const typename common::DoubleTime::type& t) const override
-                {
+  typename common::DoubleTime::type
+  ta(const typename common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::TA,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::TA,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == WAIT) {
-                        return 1;
-                    } else {
-                        return 0;
-                    }
-                }
+    if (_phase == WAIT) {
+      return 1;
+    } else {
+      return 0;
+    }
+  }
 
-                common::Bag<common::DoubleTime>
-                lambda(const typename common::DoubleTime::type& t) const override
-                {
+  common::Bag <common::DoubleTime>
+  lambda(const typename common::DoubleTime::type &t) const override {
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
-                    common::Bag<common::DoubleTime> msgs;
+    common::Bag<common::DoubleTime> msgs;
 
-                    if (_phase == SEND) {
-                        msgs.push_back(
-                                artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
-                    }
+    if (_phase == SEND) {
+      msgs.push_back(
+          artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
+    }
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::LAMBDA,
-                                    common::LevelType::USER)
-                            << "messages = " << msgs.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::LAMBDA,
+                                                    common::LevelType::USER)
+        << "messages = " << msgs.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    return msgs;
-                }
-
-            private:
-                enum Phase {
-                    WAIT, SEND
-                };
-
-                Phase _phase;
-                data _value;
-            };
-
-            class B : public artis::pdevs::Dynamics<common::DoubleTime, B> {
-            public:
-                enum inputs {
-                    IN
-                };
-                enum outputs {
-                    OUT
-                };
-
-                B(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, B, artis::common::NoParameters>& context)
-                        :
-                        artis::pdevs::Dynamics<common::DoubleTime, B>(name, context),
-                        _value(0)
-                {
-                    input_ports({{IN, "in"}});
-                    output_ports({{OUT, "out"}});
-                }
-
-                ~B() override = default;
-
-                void dint(const typename common::DoubleTime::type& t) override
-                {
+    return msgs;
+  }
+
+private:
+  enum Phase {
+    WAIT, SEND
+  };
+
+  Phase _phase;
+  data _value;
+};
+
+class B : public artis::pdevs::Dynamics<common::DoubleTime, B> {
+public:
+  enum inputs {
+    IN
+  };
+  enum outputs {
+    OUT
+  };
+
+  B(const std::string &name,
+    const artis::pdevs::Context<common::DoubleTime, B, artis::common::NoParameters> &context)
+      :
+      artis::pdevs::Dynamics<common::DoubleTime, B>(name, context),
+      _value(0) {
+    input_ports({{IN, "in"}});
+    output_ports({{OUT, "out"}});
+  }
+
+  ~B() override = default;
+
+  void dint(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_INT,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_INT,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == SEND) {
-                        _phase = WAIT;
-                    }
-                }
+    if (_phase == SEND) {
+      _phase = WAIT;
+    }
+  }
 
-                void
-                dext(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& /* e */,
-                        const common::Bag<common::DoubleTime>& msgs) override
-                {
+  void
+  dext(const typename common::DoubleTime::type &t,
+       const typename common::DoubleTime::type & /* e */,
+       const common::Bag <common::DoubleTime> &msgs) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)msgs;
+    (void)t;
+    (void)msgs;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_EXT,
-                                    common::LevelType::USER)
-                            << "messages = " << msgs.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_EXT,
+                                                    common::LevelType::USER)
+        << "messages = " << msgs.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = SEND;
-                }
+    _phase = SEND;
+  }
 
-                void dconf(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& e,
-                        const common::Bag<common::DoubleTime>& msgs) override
-                {
+  void dconf(const typename common::DoubleTime::type &t,
+             const typename common::DoubleTime::type &e,
+             const common::Bag <common::DoubleTime> &msgs) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
-                    (void)msgs;
+    (void)t;
+    (void)msgs;
 #endif
 
-                    dext(t, e, msgs);
+    dext(t, e, msgs);
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::DELTA_CONF,
-                                    common::LevelType::USER)
-                            << "messages = " << msgs.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::DELTA_CONF,
+                                                    common::LevelType::USER)
+        << "messages = " << msgs.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                }
+  }
 
-                void start(const typename common::DoubleTime::type& t) override
-                {
+  void start(const typename common::DoubleTime::type &t) override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::START,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::START,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    _phase = WAIT;
-                }
+    _phase = WAIT;
+  }
 
-                typename common::DoubleTime::type ta(
-                        const typename common::DoubleTime::type& t) const override
-                {
+  typename common::DoubleTime::type ta(
+      const typename common::DoubleTime::type &t) const override {
 
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::TA,
-                                    common::LevelType::USER);
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::TA,
+                                                    common::LevelType::USER);
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    if (_phase == WAIT) {
-                        return common::DoubleTime::infinity;
-                    } else {
-                        return 0;
-                    }
-                }
+    if (_phase == WAIT) {
+      return common::DoubleTime::infinity;
+    } else {
+      return 0;
+    }
+  }
 
-                common::Bag<common::DoubleTime> lambda(
-                        const typename common::DoubleTime::type& t) const override
-                {
+  common::Bag <common::DoubleTime> lambda(
+      const typename common::DoubleTime::type &t) const override {
 #ifndef WITH_TRACE
-                    (void)t;
+    (void)t;
 #endif
-                    common::Bag<common::DoubleTime> msgs;
+    common::Bag<common::DoubleTime> msgs;
 
-                    if (_phase == SEND) {
-                        msgs.push_back(
-                                artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
-                    }
+    if (_phase == SEND) {
+      msgs.push_back(
+          artis::common::ExternalEvent<common::DoubleTime>(OUT, _value));
+    }
 
 #ifdef WITH_TRACE
-                    common::Trace<common::DoubleTime>::trace()
-                            << common::TraceElement<common::DoubleTime>(get_name(), t,
-                                    common::FormalismType::PDEVS,
-                                    common::FunctionType::LAMBDA,
-                                    common::LevelType::USER)
-                            << "messages = " << msgs.to_string();
-                    common::Trace<common::DoubleTime>::trace().flush();
+    common::Trace<common::DoubleTime>::trace()
+        << common::TraceElement<common::DoubleTime>(get_name(), t,
+                                                    common::FormalismType::PDEVS,
+                                                    common::FunctionType::LAMBDA,
+                                                    common::LevelType::USER)
+        << "messages = " << msgs.to_string();
+    common::Trace<common::DoubleTime>::trace().flush();
 #endif
 
-                    return msgs;
-                }
-
-            private:
-                enum Phase {
-                    WAIT, SEND
-                };
-
-                Phase _phase;
-                double _value;
-            };
-
-            class TwoStateModel : public artis::pdevs::Dynamics<common::DoubleTime, TwoStateModel> {
-            public:
-                TwoStateModel(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, TwoStateModel, artis::common::NoParameters>& context)
-                        :
-                        artis::pdevs::Dynamics<common::DoubleTime, TwoStateModel>(name, context) { }
-
-                ~TwoStateModel() override = default;
-
-                void dint(const typename common::DoubleTime::type& t) override
-                {
-                    if (_phase == S1) {
-                        _phase = S2;
-                    } else if (_phase == S2) {
-                        _phase = S1;
-                    }
-                    _last_time = t;
-                }
-
-                void start(const typename common::DoubleTime::type& t) override
-                {
-                    _phase = S1;
-                    _last_time = t;
-                }
-
-                typename common::DoubleTime::type
-                ta(const typename common::DoubleTime::type& /* t */) const override
-                {
-                    if (_phase == S1) {
-                        return 5;
-                    } else {
-                        return 6;
-                    }
-                }
-
-                common::Bag<common::DoubleTime>
-                lambda(const typename common::DoubleTime::type& t) const override
-                {
-
-                    std::cout << (t - _last_time) << std::endl;
-
-                    return common::Bag<common::DoubleTime>();
-                }
-
-            private:
-                enum Phase {
-                    S1, S2
-                };
-
-                Phase _phase;
-                typename common::DoubleTime::type _last_time;
-            };
-
-            class ThreeStateModel
-                    : public artis::pdevs::Dynamics<common::DoubleTime, ThreeStateModel> {
-            public:
-                enum outputs {
-                    OUT
-                };
-
-                enum states {
-                    HEIGHTS, SPEEDS, SCALES, N, INDEX, SIGMA, LAST_TIME
-                };
-
-                ThreeStateModel(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, ThreeStateModel, artis::common::NoParameters>& context)
-                        :
-                        artis::pdevs::Dynamics<common::DoubleTime, ThreeStateModel>(name, context)
-                {
-                    DECLARE_STATES(std::vector<double>,
-                            ((HEIGHTS, &ThreeStateModel::heights), (SPEEDS, &ThreeStateModel::speeds), (SCALES, &ThreeStateModel::scales)));
-                    DECLARE_STATES(unsigned int,
-                            ((N, &ThreeStateModel::n), (INDEX, &ThreeStateModel::index)));
-                    DECLARE_STATES(typename common::DoubleTime::type,
-                            ((SIGMA, &ThreeStateModel::sigma), (LAST_TIME, &ThreeStateModel::_last_time)));
-
-                    output_ports({{OUT, "out"}});
-                }
-
-                ~ThreeStateModel() override = default;
-
-                void dconf(const typename common::DoubleTime::type& t,
-                        const typename common::DoubleTime::type& e,
-                        const common::Bag<common::DoubleTime>& msgs) override
-                {
-                    dext(t, e, msgs);
-                }
-
-                void dext(const typename common::DoubleTime::type& /* t */,
-                        const typename common::DoubleTime::type& /* e */,
-                        const common::Bag<common::DoubleTime>& msgs) override
-                {
-                    for (common::Bag<common::DoubleTime>::const_iterator it = msgs.begin();
-                         it != msgs.end();
-                         ++it) {
-                        ++n;
-                    }
-                    if (sigma == 1) {
-                        if (n > 3) {
-                            ++index;
-                            if (index == scales.size()) {
-                                index = 0;
-                            }
-                            sigma = common::DoubleTime::infinity;
-                            if (scales[index] == 1) {
-                                scales[index] = 2;
-                            } else {
-                                scales[index] = 1;
-                            }
-                            n = 0;
-                        }
-                    } else {
-                        sigma = 1;
-                        n = 0;
-                    }
-                }
-
-                void dint(const typename common::DoubleTime::type& t) override
-                {
-                    mark_full(t);
-                    if (full_N()) {
-                        raz();
-                    }
-                    compute();
-                }
-
-                void start(const typename common::DoubleTime::type& t) override
-                {
-                    heights = {0, 0, 0, 0, 0};
-                    speeds = {0.21, 0.3, 0.7, 0.56, 0.14};
-                    scales = {1, 1, 1, 1, 1};
-                    index = 0;
-                    n = 0;
-                    sigma = 0;
-                    _last_time = t;
-                }
-
-                typename common::DoubleTime::type
-                ta(const typename common::DoubleTime::type& /* t */) const override { return sigma; }
-
-                common::Bag<common::DoubleTime>
-                lambda(const typename common::DoubleTime::type& /* t */) const override
-                {
-                    common::Bag<common::DoubleTime> msgs;
-
-                    if (full()) {
-                        msgs.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, 0));
-                    }
-                    return msgs;
-                }
-
-            private:
-                void compute()
-                {
-                    for (unsigned int i = 0; i < heights.size(); ++i) {
-                        if (heights[i] != -1 and heights[i] < 10) {
-                            heights[i] += speeds[i] * scales[i];
-                        }
-                    }
-                }
-
-                void display() const
-                {
-                    for (std::vector<double>::const_iterator it = heights.begin();
-                         it != heights.end(); ++it) {
-                        std::cout << *it << " ";
-                    }
-                    std::cout << std::endl;
-                }
-
-                void display_full() const
-                {
-                    unsigned int i = 1;
-
-                    for (std::vector<double>::const_iterator it = heights.begin();
-                         it != heights.end(); ++it, ++i) {
-                        if (*it > 10) {
-                            std::cout << "S" << i;
-                        }
-                    }
-                    std::cout << std::endl;
-                }
-
-                bool full() const
-                {
-                    unsigned int n = 0;
-
-                    for (std::vector<double>::const_iterator it = heights.begin();
-                         it != heights.end(); ++it) {
-                        if (*it > 10) {
-                            ++n;
-                        }
-                    }
-                    return n > 0;
-                }
-
-                bool full_N() const
-                {
-                    unsigned int n = 0;
-
-                    for (std::vector<double>::const_iterator it = heights.begin();
-                         it != heights.end(); ++it) {
-                        if (*it == -1) {
-                            ++n;
-                        }
-                    }
-                    return n >= 2;
-                }
-
-                void mark_full(const typename common::DoubleTime::type& t)
-                {
-                    for (std::vector<double>::iterator it = heights.begin();
-                         it != heights.end(); ++it) {
-                        if (*it > 10) {
-                            *it = -1;
-                            _last_time = t;
-                        }
-                    }
-                }
-
-                void raz()
-                {
-                    for (std::vector<double>::iterator it = heights.begin();
-                         it != heights.end(); ++it) {
-                        if (*it == -1) {
-                            *it = 0;
-                        }
-                    }
-                }
-
-                // state
-                std::vector<double> heights;
-                std::vector<double> speeds;
-                std::vector<double> scales;
-                unsigned int index;
-                unsigned int n;
-                typename common::DoubleTime::type sigma;
-                typename common::DoubleTime::type _last_time;
-            };
-
+    return msgs;
+  }
+
+private:
+  enum Phase {
+    WAIT, SEND
+  };
+
+  Phase _phase;
+  double _value;
+};
+
+class TwoStateModel : public artis::pdevs::Dynamics<common::DoubleTime, TwoStateModel> {
+public:
+  TwoStateModel(const std::string &name,
+                const artis::pdevs::Context<common::DoubleTime,
+                                            TwoStateModel,
+                                            artis::common::NoParameters> &context)
+      :
+      artis::pdevs::Dynamics<common::DoubleTime, TwoStateModel>(name, context) {}
+
+  ~TwoStateModel() override = default;
+
+  void dint(const typename common::DoubleTime::type &t) override {
+    if (_phase == S1) {
+      _phase = S2;
+    } else if (_phase == S2) {
+      _phase = S1;
+    }
+    _last_time = t;
+  }
+
+  void start(const typename common::DoubleTime::type &t) override {
+    _phase = S1;
+    _last_time = t;
+  }
+
+  typename common::DoubleTime::type
+  ta(const typename common::DoubleTime::type & /* t */) const override {
+    if (_phase == S1) {
+      return 5;
+    } else {
+      return 6;
+    }
+  }
+
+  common::Bag <common::DoubleTime>
+  lambda(const typename common::DoubleTime::type &t) const override {
+
+    std::cout << (t - _last_time) << std::endl;
+
+    return common::Bag<common::DoubleTime>();
+  }
+
+private:
+  enum Phase {
+    S1, S2
+  };
+
+  Phase _phase;
+  typename common::DoubleTime::type _last_time;
+};
+
+class ThreeStateModel
+    : public artis::pdevs::Dynamics<common::DoubleTime, ThreeStateModel> {
+public:
+  enum outputs {
+    OUT
+  };
+
+  enum states {
+    HEIGHTS, SPEEDS, SCALES, N, INDEX, SIGMA, LAST_TIME
+  };
+
+  ThreeStateModel(const std::string &name,
+                  const artis::pdevs::Context<common::DoubleTime,
+                                              ThreeStateModel,
+                                              artis::common::NoParameters> &context)
+      :
+      artis::pdevs::Dynamics<common::DoubleTime, ThreeStateModel>(name, context) {
+    DECLARE_STATES(std::vector<double>,
+                   ((HEIGHTS, &ThreeStateModel::heights), (SPEEDS, &ThreeStateModel::speeds), (SCALES, &ThreeStateModel::scales)));
+    DECLARE_STATES(unsigned int,
+                   ((N, &ThreeStateModel::n), (INDEX, &ThreeStateModel::index)));
+    DECLARE_STATES(typename common::DoubleTime::type,
+                   ((SIGMA, &ThreeStateModel::sigma), (LAST_TIME, &ThreeStateModel::_last_time)));
+
+    output_ports({{OUT, "out"}});
+  }
+
+  ~ThreeStateModel() override = default;
+
+  void dconf(const typename common::DoubleTime::type &t,
+             const typename common::DoubleTime::type &e,
+             const common::Bag <common::DoubleTime> &msgs) override {
+    dext(t, e, msgs);
+  }
+
+  void dext(const typename common::DoubleTime::type & /* t */,
+            const typename common::DoubleTime::type & /* e */,
+            const common::Bag <common::DoubleTime> &msgs) override {
+    for (common::Bag<common::DoubleTime>::const_iterator it = msgs.begin();
+         it != msgs.end();
+         ++it) {
+      ++n;
+    }
+    if (sigma == 1) {
+      if (n > 3) {
+        ++index;
+        if (index == scales.size()) {
+          index = 0;
+        }
+        sigma = common::DoubleTime::infinity;
+        if (scales[index] == 1) {
+          scales[index] = 2;
+        } else {
+          scales[index] = 1;
         }
+        n = 0;
+      }
+    } else {
+      sigma = 1;
+      n = 0;
+    }
+  }
+
+  void dint(const typename common::DoubleTime::type &t) override {
+    mark_full(t);
+    if (full_N()) {
+      raz();
+    }
+    compute();
+  }
+
+  void start(const typename common::DoubleTime::type &t) override {
+    heights = {0, 0, 0, 0, 0};
+    speeds = {0.21, 0.3, 0.7, 0.56, 0.14};
+    scales = {1, 1, 1, 1, 1};
+    index = 0;
+    n = 0;
+    sigma = 0;
+    _last_time = t;
+  }
+
+  typename common::DoubleTime::type
+  ta(const typename common::DoubleTime::type & /* t */) const override { return sigma; }
+
+  common::Bag <common::DoubleTime>
+  lambda(const typename common::DoubleTime::type & /* t */) const override {
+    common::Bag<common::DoubleTime> msgs;
+
+    if (full()) {
+      msgs.push_back(artis::common::ExternalEvent<common::DoubleTime>(OUT, 0));
+    }
+    return msgs;
+  }
+
+private:
+  void compute() {
+    for (unsigned int i = 0; i < heights.size(); ++i) {
+      if (heights[i] != -1 and heights[i] < 10) {
+        heights[i] += speeds[i] * scales[i];
+      }
+    }
+  }
+
+  void display() const {
+    for (std::vector<double>::const_iterator it = heights.begin();
+         it != heights.end(); ++it) {
+      std::cout << *it << " ";
+    }
+    std::cout << std::endl;
+  }
+
+  void display_full() const {
+    unsigned int i = 1;
+
+    for (std::vector<double>::const_iterator it = heights.begin();
+         it != heights.end(); ++it, ++i) {
+      if (*it > 10) {
+        std::cout << "S" << i;
+      }
+    }
+    std::cout << std::endl;
+  }
+
+  bool full() const {
+    unsigned int n = 0;
+
+    for (std::vector<double>::const_iterator it = heights.begin();
+         it != heights.end(); ++it) {
+      if (*it > 10) {
+        ++n;
+      }
+    }
+    return n > 0;
+  }
+
+  bool full_N() const {
+    unsigned int n = 0;
+
+    for (std::vector<double>::const_iterator it = heights.begin();
+         it != heights.end(); ++it) {
+      if (*it == -1) {
+        ++n;
+      }
+    }
+    return n >= 2;
+  }
+
+  void mark_full(const typename common::DoubleTime::type &t) {
+    for (std::vector<double>::iterator it = heights.begin();
+         it != heights.end(); ++it) {
+      if (*it > 10) {
+        *it = -1;
+        _last_time = t;
+      }
+    }
+  }
+
+  void raz() {
+    for (std::vector<double>::iterator it = heights.begin();
+         it != heights.end(); ++it) {
+      if (*it == -1) {
+        *it = 0;
+      }
     }
+  }
+
+  // state
+  std::vector<double> heights;
+  std::vector<double> speeds;
+  std::vector<double> scales;
+  unsigned int index;
+  unsigned int n;
+  typename common::DoubleTime::type sigma;
+  typename common::DoubleTime::type _last_time;
+};
+
+}
+}
 } // namespace artis tests pdevs
 
 #endif

+ 302 - 306
src/tests/pdevs/tests.cpp

@@ -36,322 +36,318 @@
 using namespace artis::tests::pdevs;
 using namespace artis::common;
 
-TEST_CASE("pdevs/inactive", "run")
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
-    artis::common::RootCoordinator<
-            DoubleTime, artis::pdevs::Coordinator<
-                    DoubleTime,
-                    OnlyOneGraphManager<Inactive> >
-    > rc(context, "root");
-
-    rc.run(context);
+TEST_CASE("pdevs/inactive", "run") {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
+  artis::common::RootCoordinator<
+      DoubleTime, artis::pdevs::Coordinator<
+          DoubleTime,
+          OnlyOneGraphManager<Inactive> >
+  > rc(context, "root");
+
+  rc.run(context);
 }
 
-TEST_CASE("pdevs/only_one", "run")
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
-    artis::common::RootCoordinator<
-            DoubleTime, artis::pdevs::Coordinator<
-                    DoubleTime,
-                    OnlyOneGraphManager<A> >
-    > rc(context, "root", artis::common::NoParameters(), artis::common::NoParameters());
-
-    artis::common::Trace<DoubleTime>::trace().clear();
-    rc.run(context);
-
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a").
-            filter_function_type(artis::common::FunctionType::DELTA_EXT).empty());
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a").
-            filter_function_type(artis::common::FunctionType::DELTA_CONF).empty());
-
-    // at t = 0
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a").filter_time(0).
-            filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a").filter_time(0).
-            filter_function_type(artis::common::FunctionType::TA).size() == 2);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a").filter_time(0).
-            filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-
-    // at t > 0
-    for (unsigned int t = 1; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a").filter_time(t).
-                filter_function_type(artis::common::FunctionType::TA).size() == 2);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
-    }
+TEST_CASE("pdevs/only_one", "run") {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
+  artis::common::RootCoordinator<
+      DoubleTime, artis::pdevs::Coordinator<
+          DoubleTime,
+          OnlyOneGraphManager<A> >
+  > rc(context, "root", artis::common::NoParameters(), artis::common::NoParameters());
+
+  artis::common::Trace<DoubleTime>::trace().clear();
+  rc.run(context);
+
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a").
+      filter_function_type(artis::common::FunctionType::DELTA_EXT).empty());
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a").
+      filter_function_type(artis::common::FunctionType::DELTA_CONF).empty());
+
+  // at t = 0
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a").filter_time(0).
+      filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a").filter_time(0).
+      filter_function_type(artis::common::FunctionType::TA).size() == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a").filter_time(0).
+      filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+
+  // at t > 0
+  for (unsigned int t = 1; t <= 10; ++t) {
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a").filter_time(t).
+        filter_function_type(artis::common::FunctionType::TA).size() == 2);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
+  }
 }
 
-TEST_CASE("pdevs/flat", "run")
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
-    artis::common::RootCoordinator<
-            DoubleTime, artis::pdevs::Coordinator<
-                    DoubleTime,
-                    FlatGraphManager>
-    > rc(context, "root", artis::common::NoParameters(), artis::common::NoParameters());
-
-    artis::common::Trace<DoubleTime>::trace().clear();
-    rc.run(context);
-
-    std::cout << artis::common::Trace<DoubleTime>::trace().elements().filter_level_type(
-            LevelType::USER).to_string() << std::endl;
-
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("b1").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("b2").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").
-            filter_function_type(artis::common::FunctionType::DELTA_EXT).empty());
-    // at t = 0
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").filter_time(0).
-            filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").filter_time(0).
-            filter_function_type(artis::common::FunctionType::TA).size() == 2);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").filter_time(0).
-            filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-
-    // at t > 0
-    for (unsigned int t = 1; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::TA).size() == 2);
-    }
-
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
-        if (t == 0) {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b1").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 3);
-        } else {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b1").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 2);
-        }
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+TEST_CASE("pdevs/flat", "run") {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
+  artis::common::RootCoordinator<
+      DoubleTime, artis::pdevs::Coordinator<
+          DoubleTime,
+          FlatGraphManager>
+  > rc(context, "root", artis::common::NoParameters(), artis::common::NoParameters());
+
+  artis::common::Trace<DoubleTime>::trace().clear();
+  rc.run(context);
+
+  std::cout << artis::common::Trace<DoubleTime>::trace().elements().filter_level_type(
+      LevelType::USER).to_string() << std::endl;
+
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("b1").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("b2").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").
+      filter_function_type(artis::common::FunctionType::DELTA_EXT).empty());
+  // at t = 0
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").filter_time(0).
+      filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").filter_time(0).
+      filter_function_type(artis::common::FunctionType::TA).size() == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").filter_time(0).
+      filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+
+  // at t > 0
+  for (unsigned int t = 1; t <= 10; ++t) {
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::TA).size() == 2);
+  }
+
+  for (unsigned int t = 0; t <= 10; ++t) {
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
+    if (t == 0) {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b1").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 3);
+    } else {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b1").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 2);
     }
-
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_function_type(
-            artis::common::FunctionType::DELTA_CONF).empty());
-
-    // at t = 0
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::TA).size() == 4);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
-
-    // at t > 0
-    for (unsigned int t = 1; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 3);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 3);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::TA).size() == 4);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
-    }
-
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
-        if (t == 0) {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b2").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 5);
-        } else {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b2").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 4);
-        }
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 2);
+        filter_model_name("b1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+  }
+
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_function_type(
+      artis::common::FunctionType::DELTA_CONF).empty());
+
+  // at t = 0
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::TA).size() == 4);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+
+  // at t > 0
+  for (unsigned int t = 1; t <= 10; ++t) {
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 3);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 3);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::TA).size() == 4);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+  }
+
+  for (unsigned int t = 0; t <= 10; ++t) {
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
+    if (t == 0) {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b2").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 5);
+    } else {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b2").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 4);
     }
-}
-
-TEST_CASE("pdevs/hierachical", "run")
-{
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
-    artis::common::RootCoordinator<
-            DoubleTime, artis::pdevs::Coordinator<
-                    DoubleTime,
-                    RootGraphManager>
-    > rc(context, "root", artis::common::NoParameters(), artis::common::NoParameters());
-
-    artis::common::Trace<DoubleTime>::trace().clear();
-    rc.run(context);
-
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("b1").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("b2").
-            filter_function_type(artis::common::FunctionType::START).size() == 1);
-
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").
-            filter_function_type(artis::common::FunctionType::DELTA_EXT).empty());
-    // at t = 0
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").filter_time(0).
-            filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").filter_time(0).
-            filter_function_type(artis::common::FunctionType::TA).size() == 2);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a1").filter_time(0).
-            filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-
-    // at t > 0
-    for (unsigned int t = 1; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::TA).size() == 2);
-    }
+        filter_model_name("b2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 2);
+  }
+}
 
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
-        if (t == 0) {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b1").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 3);
-        } else {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b1").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 2);
-        }
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b1").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+TEST_CASE("pdevs/hierachical", "run") {
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 10);
+  artis::common::RootCoordinator<
+      DoubleTime, artis::pdevs::Coordinator<
+          DoubleTime,
+          RootGraphManager>
+  > rc(context, "root", artis::common::NoParameters(), artis::common::NoParameters());
+
+  artis::common::Trace<DoubleTime>::trace().clear();
+  rc.run(context);
+
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("b1").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("b2").
+      filter_function_type(artis::common::FunctionType::START).size() == 1);
+
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").
+      filter_function_type(artis::common::FunctionType::DELTA_EXT).empty());
+  // at t = 0
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").filter_time(0).
+      filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").filter_time(0).
+      filter_function_type(artis::common::FunctionType::TA).size() == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a1").filter_time(0).
+      filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+
+  // at t > 0
+  for (unsigned int t = 1; t <= 10; ++t) {
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::TA).size() == 2);
+  }
+
+  for (unsigned int t = 0; t <= 10; ++t) {
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 1);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 1);
+    if (t == 0) {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b1").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 3);
+    } else {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b1").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 2);
     }
-
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_function_type(
-            artis::common::FunctionType::DELTA_CONF).empty());
-
-    // at t = 0
     REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::TA).size() == 4);
-    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-            filter_model_name("a2").filter_time(0).
-            filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
-
-    // at t > 0
-    for (unsigned int t = 1; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 3);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 3);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::TA).size() == 4);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("a2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
-    }
-
-    for (unsigned int t = 0; t <= 10; ++t) {
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
-        if (t == 0) {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b2").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 5);
-        } else {
-            REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                    filter_model_name("b2").filter_time(t).
-                    filter_function_type(artis::common::FunctionType::TA).size() == 4);
-        }
-        REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
-                filter_model_name("b2").filter_time(t).
-                filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 2);
+        filter_model_name("b1").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+  }
+
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_function_type(
+      artis::common::FunctionType::DELTA_CONF).empty());
+
+  // at t = 0
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::TA).size() == 4);
+  REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+      filter_model_name("a2").filter_time(0).
+      filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+
+  // at t > 0
+  for (unsigned int t = 1; t <= 10; ++t) {
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 3);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 3);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::TA).size() == 4);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("a2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 1);
+  }
+
+  for (unsigned int t = 0; t <= 10; ++t) {
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::LAMBDA).size() == 2);
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_INT).size() == 2);
+    if (t == 0) {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b2").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 5);
+    } else {
+      REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+          filter_model_name("b2").filter_time(t).
+          filter_function_type(artis::common::FunctionType::TA).size() == 4);
     }
+    REQUIRE(artis::common::Trace<DoubleTime>::trace().elements().
+        filter_model_name("b2").filter_time(t).
+        filter_function_type(artis::common::FunctionType::DELTA_EXT).size() == 2);
+  }
 }

+ 340 - 325
src/tests/qss/graph_manager.hpp

@@ -36,331 +36,346 @@
 #include <artis-star/kernel/dtss/Policy.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace qss {
-
-            class ConstantGraphManager :
-                    public artis::qss::GraphManager<common::DoubleTime, Constant> {
-            public:
-                ConstantGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::qss::QSSParameters<artis::common::NoParameters>& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::qss::GraphManager<common::DoubleTime, Constant>(coordinator,
-                                parameters, graph_parameters) { }
-
-                ~ConstantGraphManager() override = default;
-            };
-
-            class OnlyOneGraphManager :
-                    public artis::qss::GraphManager<common::DoubleTime, Constant> {
-            public:
-                enum submodels {
-                    A
-                };
-
-                OnlyOneGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::qss::QSSParameters<artis::common::NoParameters>& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::qss::GraphManager<common::DoubleTime, Constant>(coordinator,
-                                parameters, graph_parameters),
-                        S("a", parameters, graph_parameters)
-                {
-                    add_child(A, &S);
-                }
-
-                ~OnlyOneGraphManager() override = default;
-
-            private:
-                artis::pdevs::Coordinator<common::DoubleTime, ConstantGraphManager, artis::qss::QSSParameters<artis::common::NoParameters>> S;
-            };
-
-            class ParabolaGraphManager :
-                    public artis::qss::GraphManager<common::DoubleTime, Parabola, ParabolaParameters> {
-            public:
-                ParabolaGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::qss::QSSParameters<ParabolaParameters>& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::qss::GraphManager<common::DoubleTime, Parabola, ParabolaParameters>(
-                                coordinator, parameters, graph_parameters) { }
-
-                ~ParabolaGraphManager() override = default;
-            };
-
-            class OnlyOneParabolaGraphManager :
-                    public artis::pdevs::GraphManager<common::DoubleTime, artis::qss::QSSParameters<ParabolaParameters>> {
-            public:
-                enum submodels {
-                    A
-                };
-
-                OnlyOneParabolaGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::qss::QSSParameters<ParabolaParameters>& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime, artis::qss::QSSParameters<ParabolaParameters>>(
-                                coordinator, parameters, graph_parameters),
-                        S("a", parameters, graph_parameters)
-                {
-                    add_child(A, &S);
-                }
-
-                ~OnlyOneParabolaGraphManager() override = default;
-
-            private:
-                artis::pdevs::Coordinator<common::DoubleTime, ParabolaGraphManager, artis::qss::QSSParameters<ParabolaParameters>> S;
-            };
-
-            class PredatorGraphManager :
-                    public artis::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters> {
-            public:
-                enum inputs {
-                    IN_X =
-                    artis::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters>::RESET
-                            + 1
-                };
-
-                PredatorGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::qss::QSSParameters<PreyPredatorParameters>& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters>(
-                                coordinator, parameters, graph_parameters)
-                {
-                    coordinator->input_port({IN_X, "in_x"});
-                    in({coordinator, IN_X}) >> in({derivative(), derivative()->dynamics().IN_X});
-                }
-
-                ~PredatorGraphManager() override = default;
-            };
-
-            class PreyGraphManager :
-                    public artis::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters> {
-            public:
-                enum inputs {
-                    IN_Y =
-                    artis::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters>::RESET
-                            + 1
-                };
-
-                PreyGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const artis::qss::QSSParameters<PreyPredatorParameters>& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters>(
-                                coordinator, parameters, graph_parameters)
-                {
-                    coordinator->input_port({IN_Y, "in_y"});
-                    in({coordinator, IN_Y}) >> in({derivative(), derivative()->dynamics().IN_Y});
-                }
-
-                ~PreyGraphManager() override = default;
-            };
-
-            struct PreyPredatorGraphManagerParameters {
-                artis::qss::QSSParameters<PreyPredatorParameters> _predator;
-                artis::qss::QSSParameters<PreyPredatorParameters> _prey;
-            };
-
-            class PreyPredatorGraphManager :
-                    public artis::pdevs::GraphManager<common::DoubleTime, PreyPredatorGraphManagerParameters> {
-            public:
-                enum submodels {
-                    PREDATOR, PREY
-                };
-
-                enum inputs {
-                    RESET_X, RESET_Y
-                };
-
-                enum outputs {
-                    OUT_X, OUT_Y
-                };
-
-                PreyPredatorGraphManager(common::Coordinator<common::DoubleTime>* coordinator,
-                        const PreyPredatorGraphManagerParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime, PreyPredatorGraphManagerParameters>(
-                                coordinator, parameters, graph_parameters),
-                        _predator("predator", parameters._predator, graph_parameters),
-                        _prey("prey", parameters._prey, graph_parameters)
-                {
-                    add_child(PREDATOR, &_predator);
-                    add_child(PREY, &_prey);
-
-                    coordinator->input_ports({{RESET_X, "reset_x"},
-                                              {RESET_Y, "reset_y"}});
-                    coordinator->output_ports({{OUT_X, "out_x"},
-                                               {OUT_Y, "out_y"}});
-
-                    in({coordinator, RESET_X}) >> in({&_prey, PreyGraphManager::RESET});
-                    in({coordinator, RESET_Y}) >> in({&_prey, PreyGraphManager::IN_Y});
-
-                    in({coordinator, RESET_X}) >> in({&_predator, PredatorGraphManager::IN_X});
-                    in({coordinator, RESET_Y}) >> in({&_predator, PredatorGraphManager::RESET});
-
-                    out({&_prey, PreyGraphManager::OUT}) >> out({coordinator, OUT_X});
-                    out({&_predator, PredatorGraphManager::OUT}) >> out({coordinator, OUT_Y});
-
-                    out({&_predator, PredatorGraphManager::OUT})
-                            >> in({&_prey, PreyGraphManager::IN_Y});
-                    out({&_prey, PreyGraphManager::OUT})
-                            >> in({&_predator, PredatorGraphManager::IN_X});
-                }
-
-                ~PreyPredatorGraphManager() override = default;
-
-            private:
-                artis::pdevs::Coordinator<common::DoubleTime, PredatorGraphManager, artis::qss::QSSParameters<PreyPredatorParameters>> _predator;
-                artis::pdevs::Coordinator<common::DoubleTime, PreyGraphManager, artis::qss::QSSParameters<PreyPredatorParameters>> _prey;
-            };
-
-            struct PreyPredatorSmartGardenerGraphManagerParameters {
-                PreyPredatorGraphManagerParameters _prey_predator;
-                SmartGardenerParameters _smart_gardener;
-            };
-
-            class PreyPredatorSmartGardenerGraphManager :
-                    public artis::pdevs::GraphManager<common::DoubleTime, PreyPredatorSmartGardenerGraphManagerParameters> {
-            public:
-                enum submodels {
-                    PREY_PREDATOR, SMART_GARDENER
-                };
-
-                PreyPredatorSmartGardenerGraphManager(
-                        common::Coordinator<common::DoubleTime>* coordinator,
-                        const PreyPredatorSmartGardenerGraphManagerParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<common::DoubleTime, PreyPredatorSmartGardenerGraphManagerParameters>(
-                                coordinator, parameters, graph_parameters),
-                        _prey_predator("prey_predator", parameters._prey_predator,
-                                graph_parameters),
-                        _smart_gardener("smart_gardener", parameters._smart_gardener)
-                {
-                    add_child(PREY_PREDATOR, &_prey_predator);
-                    add_child(SMART_GARDENER, &_smart_gardener);
-
-                    out({&_prey_predator, PreyPredatorGraphManager::OUT_X})
-                            >> in({&_smart_gardener, SmartGardener::IN_X});
-                    out({&_prey_predator, PreyPredatorGraphManager::OUT_Y})
-                            >> in({&_smart_gardener, SmartGardener::IN_Y});
-
-                    out({&_smart_gardener, SmartGardener::OUT_X})
-                            >> in({&_prey_predator, PreyPredatorGraphManager::RESET_X});
-                    out({&_smart_gardener, SmartGardener::OUT_Y})
-                            >> in({&_prey_predator, PreyPredatorGraphManager::RESET_Y});
-                }
-
-                ~PreyPredatorSmartGardenerGraphManager() override = default;
-
-            private:
-                artis::pdevs::Coordinator<common::DoubleTime, PreyPredatorGraphManager, PreyPredatorGraphManagerParameters> _prey_predator;
-                artis::pdevs::Simulator<common::DoubleTime, SmartGardener, SmartGardenerParameters> _smart_gardener;
-            };
-
-            class DiscretePredatorGraphManager :
-                    public artis::dtss::GraphManager<artis::common::DoubleTime, DiscretePreyPredatorParameters> {
-            public:
-                enum submodels {
-                    PREDATOR
-                };
-                enum inputs {
-                    RESET, IN_X
-                };
-                enum outputs {
-                    OUT
-                };
-
-                DiscretePredatorGraphManager(
-                        artis::common::Coordinator<artis::common::DoubleTime>* coordinator,
-                        const DiscretePreyPredatorParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::dtss::GraphManager<artis::common::DoubleTime, DiscretePreyPredatorParameters>(
-                                coordinator, parameters, graph_parameters
-                        ),
-                        _predator("predator", parameters)
-                {
-                    add_child(PREDATOR, &_predator);
-
-                    coordinator->input_ports({{RESET, "reset"},
-                                              {IN_X,  "in_x"}});
-                    coordinator->output_port({OUT, "out"});
-
-                    out({&_predator, DiscretePredator::OUT}) >> out({coordinator, OUT});
-                    in({coordinator, RESET}) >> in({&_predator, DiscretePredator::RESET});
-                    in({coordinator, IN_X}) >> in({&_predator, DiscretePredator::IN_X});
-                }
-
-                ~DiscretePredatorGraphManager() override = default;
-
-            private:
-                artis::dtss::Simulator<artis::common::DoubleTime, DiscretePredator, DiscretePreyPredatorParameters> _predator;
-            };
-
-            struct MixedPreyPredatorGraphManagerParameters {
-                DiscretePreyPredatorParameters _predator;
-                artis::qss::QSSParameters<PreyPredatorParameters> _prey;
-            };
-
-            class MixedPreyPredatorGraphManager :
-                    public artis::pdevs::GraphManager<artis::common::DoubleTime, MixedPreyPredatorGraphManagerParameters> {
-            public:
-                enum submodels {
-                    PREDATOR, PREY
-                };
-
-                enum inputs {
-                    RESET_X, RESET_Y
-                };
-
-                enum outputs {
-                    OUT_X, OUT_Y
-                };
-
-                MixedPreyPredatorGraphManager(
-                        artis::common::Coordinator<artis::common::DoubleTime>* coordinator,
-                        const MixedPreyPredatorGraphManagerParameters& parameters,
-                        const artis::common::NoParameters& graph_parameters)
-                        :
-                        artis::pdevs::GraphManager<artis::common::DoubleTime, MixedPreyPredatorGraphManagerParameters>(
-                                coordinator, parameters, graph_parameters),
-                        _predator("predator", parameters._predator, graph_parameters),
-                        _prey("prey", parameters._prey, graph_parameters)
-                {
-                    add_child(PREDATOR, &_predator);
-                    add_child(PREY, &_prey);
-
-                    coordinator->input_ports({{RESET_X, "reset_x"},
-                                              {RESET_Y, "reset_y"}});
-                    coordinator->output_ports({{OUT_X, "out_x"},
-                                               {OUT_Y, "out_y"}});
-
-                    in({coordinator, RESET_X}) >> in({&_prey, PreyGraphManager::RESET});
-                    in({coordinator, RESET_Y}) >> in({&_predator, PredatorGraphManager::RESET});
-
-                    out({&_prey, PreyGraphManager::OUT}) >> out({coordinator, OUT_X});
-                    out({&_predator, PredatorGraphManager::OUT}) >> out({coordinator, OUT_Y});
-
-                    out({&_predator, PredatorGraphManager::OUT})
-                            >> in({&_prey, PreyGraphManager::IN_Y});
-                    out({&_prey, PreyGraphManager::OUT})
-                            >> in({&_predator, PredatorGraphManager::IN_X});
-                }
-
-                ~MixedPreyPredatorGraphManager() override = default;
-
-            private:
-                artis::dtss::Coordinator<artis::common::DoubleTime, artis::dtss::LastBagPolicy, DiscretePredatorGraphManager, DiscretePreyPredatorParameters> _predator;
-                artis::pdevs::Coordinator<artis::common::DoubleTime, PreyGraphManager, artis::qss::QSSParameters<PreyPredatorParameters>> _prey;
-            };
-
-        }
-    }
+namespace tests {
+namespace qss {
+
+class ConstantGraphManager :
+    public artis::qss::GraphManager<common::DoubleTime, Constant> {
+public:
+  ConstantGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                       const artis::qss::QSSParameters<artis::common::NoParameters> &parameters,
+                       const artis::common::NoParameters &graph_parameters)
+      :
+      artis::qss::GraphManager<common::DoubleTime, Constant>(coordinator,
+                                                             parameters, graph_parameters) {}
+
+  ~ConstantGraphManager() override = default;
+};
+
+class OnlyOneGraphManager :
+    public artis::qss::GraphManager<common::DoubleTime, Constant> {
+public:
+  enum submodels {
+    A
+  };
+
+  OnlyOneGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                      const artis::qss::QSSParameters<artis::common::NoParameters> &parameters,
+                      const artis::common::NoParameters &graph_parameters)
+      :
+      artis::qss::GraphManager<common::DoubleTime, Constant>(coordinator,
+                                                             parameters, graph_parameters),
+      S("a", parameters, graph_parameters) {
+    add_child(A, &S);
+  }
+
+  ~OnlyOneGraphManager() override = default;
+
+private:
+  artis::pdevs::Coordinator<common::DoubleTime,
+                            ConstantGraphManager,
+                            artis::qss::QSSParameters<artis::common::NoParameters>> S;
+};
+
+class ParabolaGraphManager :
+    public artis::qss::GraphManager<common::DoubleTime, Parabola, ParabolaParameters> {
+public:
+  ParabolaGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                       const artis::qss::QSSParameters<ParabolaParameters> &parameters,
+                       const artis::common::NoParameters &graph_parameters)
+      :
+      artis::qss::GraphManager<common::DoubleTime, Parabola, ParabolaParameters>(
+          coordinator, parameters, graph_parameters) {}
+
+  ~ParabolaGraphManager() override = default;
+};
+
+class OnlyOneParabolaGraphManager :
+    public artis::pdevs::GraphManager<common::DoubleTime,
+                                      artis::qss::QSSParameters<ParabolaParameters>> {
+public:
+  enum submodels {
+    A
+  };
+
+  OnlyOneParabolaGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                              const artis::qss::QSSParameters<ParabolaParameters> &parameters,
+                              const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime, artis::qss::QSSParameters<ParabolaParameters>>(
+          coordinator, parameters, graph_parameters),
+      S("a", parameters, graph_parameters) {
+    add_child(A, &S);
+  }
+
+  ~OnlyOneParabolaGraphManager() override = default;
+
+private:
+  artis::pdevs::Coordinator<common::DoubleTime,
+                            ParabolaGraphManager,
+                            artis::qss::QSSParameters<ParabolaParameters>> S;
+};
+
+class PredatorGraphManager :
+    public artis::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters> {
+public:
+  enum inputs {
+    IN_X =
+    artis::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters>::RESET
+        + 1
+  };
+
+  PredatorGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                       const artis::qss::QSSParameters<PreyPredatorParameters> &parameters,
+                       const artis::common::NoParameters &graph_parameters)
+      :
+      artis::qss::GraphManager<common::DoubleTime, Predator, PreyPredatorParameters>(
+          coordinator, parameters, graph_parameters) {
+    coordinator->input_port({IN_X, "in_x"});
+    in({coordinator, IN_X}) >> in({derivative(), derivative()->dynamics().IN_X});
+  }
+
+  ~PredatorGraphManager() override = default;
+};
+
+class PreyGraphManager :
+    public artis::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters> {
+public:
+  enum inputs {
+    IN_Y =
+    artis::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters>::RESET
+        + 1
+  };
+
+  PreyGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                   const artis::qss::QSSParameters<PreyPredatorParameters> &parameters,
+                   const artis::common::NoParameters &graph_parameters)
+      :
+      artis::qss::GraphManager<common::DoubleTime, Prey, PreyPredatorParameters>(
+          coordinator, parameters, graph_parameters) {
+    coordinator->input_port({IN_Y, "in_y"});
+    in({coordinator, IN_Y}) >> in({derivative(), derivative()->dynamics().IN_Y});
+  }
+
+  ~PreyGraphManager() override = default;
+};
+
+struct PreyPredatorGraphManagerParameters {
+  artis::qss::QSSParameters<PreyPredatorParameters> _predator;
+  artis::qss::QSSParameters<PreyPredatorParameters> _prey;
+};
+
+class PreyPredatorGraphManager :
+    public artis::pdevs::GraphManager<common::DoubleTime, PreyPredatorGraphManagerParameters> {
+public:
+  enum submodels {
+    PREDATOR, PREY
+  };
+
+  enum inputs {
+    RESET_X, RESET_Y
+  };
+
+  enum outputs {
+    OUT_X, OUT_Y
+  };
+
+  PreyPredatorGraphManager(common::Coordinator<common::DoubleTime> *coordinator,
+                           const PreyPredatorGraphManagerParameters &parameters,
+                           const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime, PreyPredatorGraphManagerParameters>(
+          coordinator, parameters, graph_parameters),
+      _predator("predator", parameters._predator, graph_parameters),
+      _prey("prey", parameters._prey, graph_parameters) {
+    add_child(PREDATOR, &_predator);
+    add_child(PREY, &_prey);
+
+    coordinator->input_ports({{RESET_X, "reset_x"},
+                              {RESET_Y, "reset_y"}});
+    coordinator->output_ports({{OUT_X, "out_x"},
+                               {OUT_Y, "out_y"}});
+
+    in({coordinator, RESET_X}) >> in({&_prey, PreyGraphManager::RESET});
+    in({coordinator, RESET_Y}) >> in({&_prey, PreyGraphManager::IN_Y});
+
+    in({coordinator, RESET_X}) >> in({&_predator, PredatorGraphManager::IN_X});
+    in({coordinator, RESET_Y}) >> in({&_predator, PredatorGraphManager::RESET});
+
+    out({&_prey, PreyGraphManager::OUT}) >> out({coordinator, OUT_X});
+    out({&_predator, PredatorGraphManager::OUT}) >> out({coordinator, OUT_Y});
+
+    out({&_predator, PredatorGraphManager::OUT})
+        >> in({&_prey, PreyGraphManager::IN_Y});
+    out({&_prey, PreyGraphManager::OUT})
+        >> in({&_predator, PredatorGraphManager::IN_X});
+  }
+
+  ~PreyPredatorGraphManager() override = default;
+
+private:
+  artis::pdevs::Coordinator<common::DoubleTime,
+                            PredatorGraphManager,
+                            artis::qss::QSSParameters<PreyPredatorParameters>> _predator;
+  artis::pdevs::Coordinator<common::DoubleTime,
+                            PreyGraphManager,
+                            artis::qss::QSSParameters<PreyPredatorParameters>> _prey;
+};
+
+struct PreyPredatorSmartGardenerGraphManagerParameters {
+  PreyPredatorGraphManagerParameters _prey_predator;
+  SmartGardenerParameters _smart_gardener;
+};
+
+class PreyPredatorSmartGardenerGraphManager :
+    public artis::pdevs::GraphManager<common::DoubleTime,
+                                      PreyPredatorSmartGardenerGraphManagerParameters> {
+public:
+  enum submodels {
+    PREY_PREDATOR, SMART_GARDENER
+  };
+
+  PreyPredatorSmartGardenerGraphManager(
+      common::Coordinator<common::DoubleTime> *coordinator,
+      const PreyPredatorSmartGardenerGraphManagerParameters &parameters,
+      const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<common::DoubleTime,
+                                 PreyPredatorSmartGardenerGraphManagerParameters>(
+          coordinator, parameters, graph_parameters),
+      _prey_predator("prey_predator", parameters._prey_predator,
+                     graph_parameters),
+      _smart_gardener("smart_gardener", parameters._smart_gardener) {
+    add_child(PREY_PREDATOR, &_prey_predator);
+    add_child(SMART_GARDENER, &_smart_gardener);
+
+    out({&_prey_predator, PreyPredatorGraphManager::OUT_X})
+        >> in({&_smart_gardener, SmartGardener::IN_X});
+    out({&_prey_predator, PreyPredatorGraphManager::OUT_Y})
+        >> in({&_smart_gardener, SmartGardener::IN_Y});
+
+    out({&_smart_gardener, SmartGardener::OUT_X})
+        >> in({&_prey_predator, PreyPredatorGraphManager::RESET_X});
+    out({&_smart_gardener, SmartGardener::OUT_Y})
+        >> in({&_prey_predator, PreyPredatorGraphManager::RESET_Y});
+  }
+
+  ~PreyPredatorSmartGardenerGraphManager() override = default;
+
+private:
+  artis::pdevs::Coordinator<common::DoubleTime,
+                            PreyPredatorGraphManager,
+                            PreyPredatorGraphManagerParameters> _prey_predator;
+  artis::pdevs::Simulator<common::DoubleTime, SmartGardener, SmartGardenerParameters>
+      _smart_gardener;
+};
+
+class DiscretePredatorGraphManager :
+    public artis::dtss::GraphManager<artis::common::DoubleTime, DiscretePreyPredatorParameters> {
+public:
+  enum submodels {
+    PREDATOR
+  };
+  enum inputs {
+    RESET, IN_X
+  };
+  enum outputs {
+    OUT
+  };
+
+  DiscretePredatorGraphManager(
+      artis::common::Coordinator<artis::common::DoubleTime> *coordinator,
+      const DiscretePreyPredatorParameters &parameters,
+      const artis::common::NoParameters &graph_parameters)
+      :
+      artis::dtss::GraphManager<artis::common::DoubleTime, DiscretePreyPredatorParameters>(
+          coordinator, parameters, graph_parameters
+      ),
+      _predator("predator", parameters) {
+    add_child(PREDATOR, &_predator);
+
+    coordinator->input_ports({{RESET, "reset"},
+                              {IN_X, "in_x"}});
+    coordinator->output_port({OUT, "out"});
+
+    out({&_predator, DiscretePredator::OUT}) >> out({coordinator, OUT});
+    in({coordinator, RESET}) >> in({&_predator, DiscretePredator::RESET});
+    in({coordinator, IN_X}) >> in({&_predator, DiscretePredator::IN_X});
+  }
+
+  ~DiscretePredatorGraphManager() override = default;
+
+private:
+  artis::dtss::Simulator<artis::common::DoubleTime,
+                         DiscretePredator,
+                         DiscretePreyPredatorParameters> _predator;
+};
+
+struct MixedPreyPredatorGraphManagerParameters {
+  DiscretePreyPredatorParameters _predator;
+  artis::qss::QSSParameters<PreyPredatorParameters> _prey;
+};
+
+class MixedPreyPredatorGraphManager :
+    public artis::pdevs::GraphManager<artis::common::DoubleTime,
+                                      MixedPreyPredatorGraphManagerParameters> {
+public:
+  enum submodels {
+    PREDATOR, PREY
+  };
+
+  enum inputs {
+    RESET_X, RESET_Y
+  };
+
+  enum outputs {
+    OUT_X, OUT_Y
+  };
+
+  MixedPreyPredatorGraphManager(
+      artis::common::Coordinator<artis::common::DoubleTime> *coordinator,
+      const MixedPreyPredatorGraphManagerParameters &parameters,
+      const artis::common::NoParameters &graph_parameters)
+      :
+      artis::pdevs::GraphManager<artis::common::DoubleTime,
+                                 MixedPreyPredatorGraphManagerParameters>(
+          coordinator, parameters, graph_parameters),
+      _predator("predator", parameters._predator, graph_parameters),
+      _prey("prey", parameters._prey, graph_parameters) {
+    add_child(PREDATOR, &_predator);
+    add_child(PREY, &_prey);
+
+    coordinator->input_ports({{RESET_X, "reset_x"},
+                              {RESET_Y, "reset_y"}});
+    coordinator->output_ports({{OUT_X, "out_x"},
+                               {OUT_Y, "out_y"}});
+
+    in({coordinator, RESET_X}) >> in({&_prey, PreyGraphManager::RESET});
+    in({coordinator, RESET_Y}) >> in({&_predator, PredatorGraphManager::RESET});
+
+    out({&_prey, PreyGraphManager::OUT}) >> out({coordinator, OUT_X});
+    out({&_predator, PredatorGraphManager::OUT}) >> out({coordinator, OUT_Y});
+
+    out({&_predator, PredatorGraphManager::OUT})
+        >> in({&_prey, PreyGraphManager::IN_Y});
+    out({&_prey, PreyGraphManager::OUT})
+        >> in({&_predator, PredatorGraphManager::IN_X});
+  }
+
+  ~MixedPreyPredatorGraphManager() override = default;
+
+private:
+  artis::dtss::Coordinator<artis::common::DoubleTime,
+                           artis::dtss::LastBagPolicy,
+                           DiscretePredatorGraphManager,
+                           DiscretePreyPredatorParameters> _predator;
+  artis::pdevs::Coordinator<artis::common::DoubleTime,
+                            PreyGraphManager,
+                            artis::qss::QSSParameters<PreyPredatorParameters>> _prey;
+};
+
+}
+}
 } // namespace artis tests qss
 
 #endif

+ 142 - 152
src/tests/qss/main.cpp

@@ -36,204 +36,194 @@
 
 using namespace artis::tests::qss;
 
-void test_parabola()
-{
-    artis::qss::QSSParameters<ParabolaParameters> parameters = {{0.5},
-                                                                {true, true, 0.001, 3},
-                                                                {0.2}};
-
-    class View : public artis::observer::View<artis::common::DoubleTime> {
-    public:
-        View()
-        {
-            selector("Value", {OnlyOneParabolaGraphManager::A, ParabolaGraphManager::S_Integrator,
-                               artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
-        }
-    };
-
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 5);
-    artis::common::RootCoordinator<
-            artis::common::DoubleTime, artis::pdevs::Coordinator<
-                    artis::common::DoubleTime,
-                    OnlyOneParabolaGraphManager,
-                    artis::qss::QSSParameters<ParabolaParameters>>
-    > rc(context, "root", parameters, artis::common::NoParameters());
-
-    rc.attachView("Value", new View());
-
-    rc.run(context);
-
-    const View::Values& values = rc.observer().view("Value").get("Value");
-
-    for (const auto& value: values) {
-        double v;
-
-        value.second(v);
-        std::cout << value.first << ": " << v << std::endl;
+void test_parabola() {
+  artis::qss::QSSParameters<ParabolaParameters> parameters = {{0.5},
+                                                              {true, true, 0.001, 3},
+                                                              {0.2}};
+
+  class View : public artis::observer::View<artis::common::DoubleTime> {
+  public:
+    View() {
+      selector("Value", {OnlyOneParabolaGraphManager::A, ParabolaGraphManager::S_Integrator,
+                         artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
     }
+  };
+
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 5);
+  artis::common::RootCoordinator<
+      artis::common::DoubleTime, artis::pdevs::Coordinator<
+          artis::common::DoubleTime,
+          OnlyOneParabolaGraphManager,
+          artis::qss::QSSParameters<ParabolaParameters>>
+  > rc(context, "root", parameters, artis::common::NoParameters());
+
+  rc.attachView("Value", new View());
+
+  rc.run(context);
+
+  const View::Values &values = rc.observer().view("Value").get("Value");
+
+  for (const auto &value: values) {
+    double v;
+
+    value.second(v);
+    std::cout << value.first << ": " << v << std::endl;
+  }
 }
 
 class PredatorPreyView : public artis::observer::View<artis::common::DoubleTime> {
 public:
-    PredatorPreyView()
-    {
-        selector("PredatorView",
-                {PreyPredatorGraphManager::PREDATOR, PredatorGraphManager::S_Integrator,
-                 artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
-        selector("PreyView",
-                {PreyPredatorGraphManager::PREY, PreyGraphManager::S_Integrator,
-                 artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
-    }
+  PredatorPreyView() {
+    selector("PredatorView",
+             {PreyPredatorGraphManager::PREDATOR, PredatorGraphManager::S_Integrator,
+              artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
+    selector("PreyView",
+             {PreyPredatorGraphManager::PREY, PreyGraphManager::S_Integrator,
+              artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
+  }
 };
 
-void run_predator_prey(artis::common::context::Context<artis::common::DoubleTime>& context,
-        const PreyPredatorGraphManagerParameters& parameters)
-{
-    artis::common::RootCoordinator<
-            artis::common::DoubleTime, artis::pdevs::Coordinator<
-                    artis::common::DoubleTime,
-                    PreyPredatorGraphManager,
-                    PreyPredatorGraphManagerParameters>
-    > rc(context, "root", parameters, artis::common::NoParameters());
+void run_predator_prey(artis::common::context::Context<artis::common::DoubleTime> &context,
+                       const PreyPredatorGraphManagerParameters &parameters) {
+  artis::common::RootCoordinator<
+      artis::common::DoubleTime, artis::pdevs::Coordinator<
+          artis::common::DoubleTime,
+          PreyPredatorGraphManager,
+          PreyPredatorGraphManagerParameters>
+  > rc(context, "root", parameters, artis::common::NoParameters());
 
-    rc.attachView("Value1", new PredatorPreyView());
+  rc.attachView("Value1", new PredatorPreyView());
 
-    rc.run(context);
+  rc.run(context);
 
-    rc.save(context);
+  rc.save(context);
 
-    std::ofstream os("state");
-    boost::archive::binary_oarchive oa(os);
+  std::ofstream os("state");
+  boost::archive::binary_oarchive oa(os);
 
-    oa << context;
+  oa << context;
 
-    {
-        artis::observer::DiscreteTimeIterator<artis::common::DoubleTime> it(
-                rc.observer().view("Value").get("PredatorView"), context.begin(), 0.1);
+  {
+    artis::observer::DiscreteTimeIterator<artis::common::DoubleTime> it(
+        rc.observer().view("Value").get("PredatorView"), context.begin(), 0.1);
 
-        while (it.has_next()) {
-            double v;
+    while (it.has_next()) {
+      double v;
 
-            (*it).second(v);
-            std::cout << (*it).first << ";" << v << std::endl;
-            ++it;
-        }
+      (*it).second(v);
+      std::cout << (*it).first << ";" << v << std::endl;
+      ++it;
     }
-    {
-        artis::observer::DiscreteTimeIterator<artis::common::DoubleTime> it(
-                rc.observer().view("Value").get("PreyView"), context.begin(), 0.1);
+  }
+  {
+    artis::observer::DiscreteTimeIterator<artis::common::DoubleTime> it(
+        rc.observer().view("Value").get("PreyView"), context.begin(), 0.1);
 
-        while (it.has_next()) {
-            double v;
+    while (it.has_next()) {
+      double v;
 
-            (*it).second(v);
-            std::cout << (*it).first << ";" << v << std::endl;
-            ++it;
-        }
+      (*it).second(v);
+      std::cout << (*it).first << ";" << v << std::endl;
+      ++it;
     }
+  }
 }
 
-void test_predator_prey()
-{
-    PreyPredatorGraphManagerParameters parameters = {{{45.},
-                                                             {true, true, 0.1, 3},
-                                                             {0.5, 0.01, 0.01, 0.2}},
-                                                     {{5000.},
-                                                             {true, true, 1,   3},
-                                                             {0.5, 0.01, 0.01, 0.2}}};
+void test_predator_prey() {
+  PreyPredatorGraphManagerParameters parameters = {{{45.},
+                                                    {true, true, 0.1, 3},
+                                                    {0.5, 0.01, 0.01, 0.2}},
+                                                   {{5000.},
+                                                    {true, true, 1, 3},
+                                                    {0.5, 0.01, 0.01, 0.2}}};
 
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 100);
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 100);
 
-    run_predator_prey(context, parameters);
+  run_predator_prey(context, parameters);
 
-    artis::common::context::Context<artis::common::DoubleTime> new_context(context);
+  artis::common::context::Context<artis::common::DoubleTime> new_context(context);
 
-    new_context.end(200);
-    run_predator_prey(new_context, parameters);
+  new_context.end(200);
+  run_predator_prey(new_context, parameters);
 }
 
 class PredatorPreySmartGardenerView : public artis::observer::View<artis::common::DoubleTime> {
 public:
-    PredatorPreySmartGardenerView()
-    {
-        selector("PredatorView",
-                {PreyPredatorSmartGardenerGraphManager::PREY_PREDATOR,
-                 PreyPredatorGraphManager::PREDATOR, PredatorGraphManager::S_Integrator,
-                 artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
-        selector("PreyView",
-                {PreyPredatorSmartGardenerGraphManager::PREY_PREDATOR,
-                 PreyPredatorGraphManager::PREY, PreyGraphManager::S_Integrator,
-                 artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
-    }
+  PredatorPreySmartGardenerView() {
+    selector("PredatorView",
+             {PreyPredatorSmartGardenerGraphManager::PREY_PREDATOR,
+              PreyPredatorGraphManager::PREDATOR, PredatorGraphManager::S_Integrator,
+              artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
+    selector("PreyView",
+             {PreyPredatorSmartGardenerGraphManager::PREY_PREDATOR,
+              PreyPredatorGraphManager::PREY, PreyGraphManager::S_Integrator,
+              artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
+  }
 };
 
-void test_predator_prey_smart_gardener()
-{
-    PreyPredatorSmartGardenerGraphManagerParameters parameters = {{{{45.},
-                                                                           {true, true, 0.1, 3},
-                                                                           {0.5, 0.01, 0.01, 0.2}},
-                                                                          {{5000.},
-                                                                                  {true, true, 1, 3},
-                                                                                  {0.5, 0.01, 0.01, 0.2}}},
-                                                                  {2000,  0.25, 0.75, 5}};
+void test_predator_prey_smart_gardener() {
+  PreyPredatorSmartGardenerGraphManagerParameters parameters = {{{{45.},
+                                                                  {true, true, 0.1, 3},
+                                                                  {0.5, 0.01, 0.01, 0.2}},
+                                                                 {{5000.},
+                                                                  {true, true, 1, 3},
+                                                                  {0.5, 0.01, 0.01, 0.2}}},
+                                                                {2000, 0.25, 0.75, 5}};
 
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 100);
-    artis::common::RootCoordinator<
-            artis::common::DoubleTime, artis::pdevs::Coordinator<
-                    artis::common::DoubleTime,
-                    PreyPredatorSmartGardenerGraphManager,
-                    PreyPredatorSmartGardenerGraphManagerParameters>
-    > rc(context, "root", parameters, artis::common::NoParameters());
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 100);
+  artis::common::RootCoordinator<
+      artis::common::DoubleTime, artis::pdevs::Coordinator<
+          artis::common::DoubleTime,
+          PreyPredatorSmartGardenerGraphManager,
+          PreyPredatorSmartGardenerGraphManagerParameters>
+  > rc(context, "root", parameters, artis::common::NoParameters());
 
-    rc.attachView("Value2", new PredatorPreySmartGardenerView());
+  rc.attachView("Value2", new PredatorPreySmartGardenerView());
 
-    rc.run(context);
+  rc.run(context);
 
-    artis::observer::Output<artis::common::DoubleTime> output(rc.observer());
+  artis::observer::Output<artis::common::DoubleTime> output(rc.observer());
 
-    output(0, 100, 0.1);
+  output(0, 100, 0.1);
 }
 
 class MixedPredatorPreyView : public artis::observer::View<artis::common::DoubleTime> {
 public:
-    MixedPredatorPreyView()
-    {
-        selector("PredatorView",
-                {MixedPreyPredatorGraphManager::PREDATOR, DiscretePredatorGraphManager::PREDATOR,
-                 DiscretePredator::VALUE});
-        selector("PreyView",
-                {MixedPreyPredatorGraphManager::PREY, PreyGraphManager::S_Integrator,
-                 artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
-    }
+  MixedPredatorPreyView() {
+    selector("PredatorView",
+             {MixedPreyPredatorGraphManager::PREDATOR, DiscretePredatorGraphManager::PREDATOR,
+              DiscretePredator::VALUE});
+    selector("PreyView",
+             {MixedPreyPredatorGraphManager::PREY, PreyGraphManager::S_Integrator,
+              artis::qss::Integrator<artis::common::DoubleTime>::VALUE});
+  }
 };
 
-void test_mixed_predator_prey()
-{
-    MixedPreyPredatorGraphManagerParameters parameters = {{0.0001, 45., 0.5, 0.01, 0.01, 0.2},
-                                                          {{5000.},
-                                                                   {true, true, 1, 3},
-                                                                        {0.5, 0.01, 0.01, 0.2}}};
-    artis::common::context::Context<artis::common::DoubleTime> context(0, 100);
-    artis::common::RootCoordinator<
-            artis::common::DoubleTime, artis::pdevs::Coordinator<
-                    artis::common::DoubleTime,
-                    MixedPreyPredatorGraphManager,
-                    MixedPreyPredatorGraphManagerParameters>
-    > rc(context, "root", parameters, artis::common::NoParameters());
+void test_mixed_predator_prey() {
+  MixedPreyPredatorGraphManagerParameters parameters = {{0.0001, 45., 0.5, 0.01, 0.01, 0.2},
+                                                        {{5000.},
+                                                         {true, true, 1, 3},
+                                                         {0.5, 0.01, 0.01, 0.2}}};
+  artis::common::context::Context<artis::common::DoubleTime> context(0, 100);
+  artis::common::RootCoordinator<
+      artis::common::DoubleTime, artis::pdevs::Coordinator<
+          artis::common::DoubleTime,
+          MixedPreyPredatorGraphManager,
+          MixedPreyPredatorGraphManagerParameters>
+  > rc(context, "root", parameters, artis::common::NoParameters());
 
-    rc.attachView("Value3", new MixedPredatorPreyView());
+  rc.attachView("Value3", new MixedPredatorPreyView());
 
-    rc.run(context);
+  rc.run(context);
 
-    artis::observer::Output<artis::common::DoubleTime> output(rc.observer());
+  artis::observer::Output<artis::common::DoubleTime> output(rc.observer());
 
-    output(0, 100, 0.1);
+  output(0, 100, 0.1);
 }
 
-int main()
-{
-    test_parabola();
-    test_predator_prey();
-    test_predator_prey_smart_gardener();
-    test_mixed_predator_prey();
+int main() {
+  test_parabola();
+  test_predator_prey();
+  test_predator_prey_smart_gardener();
+  test_mixed_predator_prey();
 }

+ 321 - 327
src/tests/qss/models.hpp

@@ -34,339 +34,333 @@
 #include <artis-star/kernel/dtss/Dynamics.hpp>
 
 namespace artis {
-    namespace tests {
-        namespace qss {
-
-            class Constant : public artis::qss::Derivative<common::DoubleTime, Constant> {
-            public:
-                Constant(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, Constant, artis::common::NoParameters>& context)
-                        :
-                        artis::qss::Derivative<common::DoubleTime, Constant>(name,
-                                context) { }
-
-                ~Constant() override = default;
-
-                double compute() const override { return 0.5; }
-            };
-
-            struct ParabolaParameters {
-                double alpha;
-            };
-
-            class Parabola
-                    : public artis::qss::Derivative<common::DoubleTime, Parabola, ParabolaParameters> {
-            public:
-                Parabola(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, Parabola, ParabolaParameters>& context)
-                        :
-                        artis::qss::Derivative<common::DoubleTime, Parabola, ParabolaParameters>(
-                                name,
-                                context), _alpha(context.parameters().alpha)
-                {
-                    internal("X", &Parabola::_x);
-                }
-
-                ~Parabola() override = default;
-
-                double compute() const override { return _alpha * _x; }
-
-            private:
-                double _alpha;
-
-                double _x;
-            };
-
-            struct PreyPredatorParameters {
-                double a;
-                double b;
-                double d;
-                double e;
-            };
-
-            class Predator
-                    : public artis::qss::Derivative<common::DoubleTime, Predator, PreyPredatorParameters> {
-            public:
-                unsigned int IN_X;
-
-                Predator(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, Predator, PreyPredatorParameters>& context)
-                        :
-                        artis::qss::Derivative<common::DoubleTime, Predator, PreyPredatorParameters>(
-                                name,
-                                context), _b(context.parameters().b), _d(context.parameters().d),
-                        _e(context.parameters().e)
-                {
-                    internal("Y", &Predator::_y);
-                    IN_X = external("X", &Predator::_x);
-                }
-
-                ~Predator() override = default;
-
-                double compute() const override { return _b * _d * _x * _y - _e * _y; }
-
-            private:
-                // parameters
-                double _b;
-                double _d;
-                double _e;
-
-                // state
-                double _x;
-                double _y;
-            };
-
-            class Prey
-                    : public artis::qss::Derivative<common::DoubleTime, Prey, PreyPredatorParameters> {
-            public:
-                unsigned int IN_Y;
-
-                Prey(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, Prey, PreyPredatorParameters>& context)
-                        :
-                        artis::qss::Derivative<common::DoubleTime, Prey, PreyPredatorParameters>(
-                                name,
-                                context), _a(context.parameters().a), _b(context.parameters().b)
-                {
-                    internal("X", &Prey::_x);
-                    IN_Y = external("Y", &Prey::_y);
-                }
-
-                ~Prey() override = default;
-
-                double compute() const override { return _a * _x - _b * _y * _x; }
-
-            private:
-                // parameters
-                double _a;
-                double _b;
-
-                // state
-                double _x;
-                double _y;
-            };
-
-            struct SmartGardenerParameters {
-                double threshold;
-                double prey_proportion;
-                double predator_proportion;
-                double delay;
-            };
-
-            class SmartGardener
-                    : public artis::pdevs::Dynamics<common::DoubleTime, SmartGardener, SmartGardenerParameters> {
-            public:
-                enum inputs {
-                    IN_X, IN_Y
-                };
-                enum outputs {
-                    OUT_X, OUT_Y
-                };
-
-                SmartGardener(const std::string& name,
-                        const artis::pdevs::Context<common::DoubleTime, SmartGardener, SmartGardenerParameters>& context)
-                        :
-                        artis::pdevs::Dynamics<common::DoubleTime, SmartGardener, SmartGardenerParameters>(
-                                name, context),
-                        _threshold(context.parameters().threshold),
-                        _prey_proportion(context.parameters().prey_proportion),
-                        _predator_proportion(context.parameters().predator_proportion),
-                        _delay(context.parameters().delay)
-                {
-                    input_ports({{IN_X, "in_x"},
-                                 {IN_Y, "in_y"}});
-                    output_ports({{OUT_X, "out_x"},
-                                  {OUT_Y, "out_y"}});
-                }
-
-                ~SmartGardener() override = default;
-
-                void dint(const typename common::DoubleTime::type& /* t */) override
-                {
-                    switch (_phase) {
-                    case INIT:
-                        _phase = IDLE;
-                        _sigma = _delay;
-                        break;
-                    case IDLE:
-                        if (_prey_amount > _threshold) {
-                            _phase = PEST;
-                        } else {
-                            _phase = IDLE;
-                            _sigma = _delay;
-                        }
-                        break;
-                    case PEST:
-                        _phase = IDLE;
-                        _sigma = _delay;
-                        break;
-                    }
-                }
-
-                void
-                dext(const typename common::DoubleTime::type& /* t */,
-                        const typename common::DoubleTime::type& e,
-                        const common::Bag<common::DoubleTime>& bag) override
-                {
-                    std::for_each(bag.begin(), bag.end(),
-                            [this](const common::ExternalEvent<common::DoubleTime>& event) {
-                                artis::qss::IntegratorData data;
-
-                                event.data()(data);
-                                if (event.on_port(IN_X)) {
-                                    _prey_amount = data.value;
-                                } else if (event.on_port(IN_Y)) {
-                                    _predator_amount = data.value;
-                                }
-                            });
-                    _sigma -= e;
-                }
-
-                void
-                start(const typename common::DoubleTime::type& /* t */) override { _phase = INIT; }
-
-                typename common::DoubleTime::type
-                ta(const typename common::DoubleTime::type& /* t */) const override
-                {
-                    switch (_phase) {
-                    case INIT:
-                        return 0.0;
-                    case IDLE:
-                        return _sigma;
-                    case PEST:
-                        return 0.0;
+namespace tests {
+namespace qss {
+
+class Constant : public artis::qss::Derivative<common::DoubleTime, Constant> {
+public:
+  Constant(const std::string &name,
+           const artis::pdevs::Context<common::DoubleTime,
+                                       Constant,
+                                       artis::common::NoParameters> &context)
+      :
+      artis::qss::Derivative<common::DoubleTime, Constant>(name,
+                                                           context) {}
+
+  ~Constant() override = default;
+
+  double compute() const override { return 0.5; }
+};
+
+struct ParabolaParameters {
+  double alpha;
+};
+
+class Parabola
+    : public artis::qss::Derivative<common::DoubleTime, Parabola, ParabolaParameters> {
+public:
+  Parabola(const std::string &name,
+           const artis::pdevs::Context<common::DoubleTime, Parabola, ParabolaParameters> &context)
+      :
+      artis::qss::Derivative<common::DoubleTime, Parabola, ParabolaParameters>(
+          name,
+          context), _alpha(context.parameters().alpha) {
+    internal("X", &Parabola::_x);
+  }
+
+  ~Parabola() override = default;
+
+  double compute() const override { return _alpha * _x; }
+
+private:
+  double _alpha;
+
+  double _x;
+};
+
+struct PreyPredatorParameters {
+  double a;
+  double b;
+  double d;
+  double e;
+};
+
+class Predator
+    : public artis::qss::Derivative<common::DoubleTime, Predator, PreyPredatorParameters> {
+public:
+  unsigned int IN_X;
+
+  Predator(const std::string &name,
+           const artis::pdevs::Context<common::DoubleTime,
+                                       Predator,
+                                       PreyPredatorParameters> &context)
+      :
+      artis::qss::Derivative<common::DoubleTime, Predator, PreyPredatorParameters>(
+          name,
+          context), _b(context.parameters().b), _d(context.parameters().d),
+      _e(context.parameters().e) {
+    internal("Y", &Predator::_y);
+    IN_X = external("X", &Predator::_x);
+  }
+
+  ~Predator() override = default;
+
+  double compute() const override { return _b * _d * _x * _y - _e * _y; }
+
+private:
+  // parameters
+  double _b;
+  double _d;
+  double _e;
+
+  // state
+  double _x;
+  double _y;
+};
+
+class Prey
+    : public artis::qss::Derivative<common::DoubleTime, Prey, PreyPredatorParameters> {
+public:
+  unsigned int IN_Y;
+
+  Prey(const std::string &name,
+       const artis::pdevs::Context<common::DoubleTime, Prey, PreyPredatorParameters> &context)
+      :
+      artis::qss::Derivative<common::DoubleTime, Prey, PreyPredatorParameters>(
+          name,
+          context), _a(context.parameters().a), _b(context.parameters().b) {
+    internal("X", &Prey::_x);
+    IN_Y = external("Y", &Prey::_y);
+  }
+
+  ~Prey() override = default;
+
+  double compute() const override { return _a * _x - _b * _y * _x; }
+
+private:
+  // parameters
+  double _a;
+  double _b;
+
+  // state
+  double _x;
+  double _y;
+};
+
+struct SmartGardenerParameters {
+  double threshold;
+  double prey_proportion;
+  double predator_proportion;
+  double delay;
+};
+
+class SmartGardener
+    : public artis::pdevs::Dynamics<common::DoubleTime, SmartGardener, SmartGardenerParameters> {
+public:
+  enum inputs {
+    IN_X, IN_Y
+  };
+  enum outputs {
+    OUT_X, OUT_Y
+  };
+
+  SmartGardener(const std::string &name,
+                const artis::pdevs::Context<common::DoubleTime,
+                                            SmartGardener,
+                                            SmartGardenerParameters> &context)
+      :
+      artis::pdevs::Dynamics<common::DoubleTime, SmartGardener, SmartGardenerParameters>(
+          name, context),
+      _threshold(context.parameters().threshold),
+      _prey_proportion(context.parameters().prey_proportion),
+      _predator_proportion(context.parameters().predator_proportion),
+      _delay(context.parameters().delay) {
+    input_ports({{IN_X, "in_x"},
+                 {IN_Y, "in_y"}});
+    output_ports({{OUT_X, "out_x"},
+                  {OUT_Y, "out_y"}});
+  }
+
+  ~SmartGardener() override = default;
+
+  void dint(const typename common::DoubleTime::type & /* t */) override {
+    switch (_phase) {
+    case INIT:_phase = IDLE;
+      _sigma = _delay;
+      break;
+    case IDLE:
+      if (_prey_amount > _threshold) {
+        _phase = PEST;
+      } else {
+        _phase = IDLE;
+        _sigma = _delay;
+      }
+      break;
+    case PEST:_phase = IDLE;
+      _sigma = _delay;
+      break;
+    }
+  }
+
+  void
+  dext(const typename common::DoubleTime::type & /* t */,
+       const typename common::DoubleTime::type &e,
+       const common::Bag<common::DoubleTime> &bag) override {
+    std::for_each(bag.begin(), bag.end(),
+                  [this](const common::ExternalEvent<common::DoubleTime> &event) {
+                    artis::qss::IntegratorData data;
+
+                    event.data()(data);
+                    if (event.on_port(IN_X)) {
+                      _prey_amount = data.value;
+                    } else if (event.on_port(IN_Y)) {
+                      _predator_amount = data.value;
                     }
-                    return common::DoubleTime::infinity;
-                }
+                  });
+    _sigma -= e;
+  }
+
+  void
+  start(const typename common::DoubleTime::type & /* t */) override { _phase = INIT; }
+
+  typename common::DoubleTime::type
+  ta(const typename common::DoubleTime::type & /* t */) const override {
+    switch (_phase) {
+    case INIT:return 0.0;
+    case IDLE:return _sigma;
+    case PEST:return 0.0;
+    }
+    return common::DoubleTime::infinity;
+  }
 
-                common::Bag<common::DoubleTime>
-                lambda(const typename common::DoubleTime::type& /* t */) const override
-                {
-                    common::Bag<common::DoubleTime> bag;
+  common::Bag<common::DoubleTime>
+  lambda(const typename common::DoubleTime::type & /* t */) const override {
+    common::Bag<common::DoubleTime> bag;
 
-                    if (_phase == PEST) {
-                        artis::qss::IntegratorData data = {_prey_amount * _prey_proportion};
+    if (_phase == PEST) {
+      artis::qss::IntegratorData data = {_prey_amount * _prey_proportion};
 
-                        bag.push_back(common::ExternalEvent<common::DoubleTime>(OUT_X, data));
-                        data = {_predator_amount * _predator_proportion};
-                        bag.push_back(common::ExternalEvent<common::DoubleTime>(OUT_Y, data));
-                    }
-                    return bag;
-                }
-
-            private:
-                enum Phase {
-                    INIT, IDLE, PEST
-                };
-
-                // parameters
-                double _threshold;
-                double _prey_proportion;
-                double _predator_proportion;
-                double _delay;
-
-                // state
-                Phase _phase;
-                common::DoubleTime::type _sigma;
-                double _prey_amount;
-                double _predator_amount;
-            };
-
-            struct DiscretePreyPredatorParameters {
-                artis::common::DoubleTime::type time_step;
-                double init_value;
-                double a;
-                double b;
-                double d;
-                double e;
-            };
-
-            class DiscretePredator
-                    : public artis::dtss::Dynamics<artis::common::DoubleTime, DiscretePredator, DiscretePreyPredatorParameters> {
-            public:
-                enum inputs {
-                    RESET, IN_X, IN_Y
-                };
-                enum outputs {
-                    OUT
-                };
-                enum vars {
-                    VALUE
-                };
-
-                DiscretePredator(const std::string& name,
-                        const artis::dtss::Context<artis::common::DoubleTime, DiscretePredator, DiscretePreyPredatorParameters>& context)
-                        :
-                        artis::dtss::Dynamics<artis::common::DoubleTime, DiscretePredator, DiscretePreyPredatorParameters>(
-                                name, context), _init_value(context.parameters().init_value),
-                        _b(context.parameters().b), _d(context.parameters().d),
-                        _e(context.parameters().e)
-                {
-                    input_ports({{RESET, "reset"},
-                                 {IN_X,  "in_x"},
-                                 {IN_Y,  "in_y"}});
-                    output_ports({{OUT, "out"}});
-                    observables({{VALUE, "value"}});
-                }
-
-                ~DiscretePredator() override = default;
-
-                void transition(const artis::common::Bag<artis::common::DoubleTime>& bag,
-                        const artis::common::DoubleTime::type& /* t */) override
-                {
-                    std::for_each(bag.begin(), bag.end(),
-                            [this](const artis::common::ExternalEvent<artis::common::DoubleTime>& event) {
-                                if (event.on_port(IN_X)) {
-                                    artis::qss::IntegratorData data;
-
-                                    event.data()(data);
-                                    _x = data.value;
-                                } else if (event.on_port(RESET)) {
-                                    // TODO
-                                }
-                            });
-                    _y += (_b * _d * _x * _y - _e * _y) * time_step();
-                }
-
-                void start(const artis::common::DoubleTime::type& /* t */) override
-                {
-                    _y = _init_value;
-                }
-
-                artis::common::Bag<artis::common::DoubleTime>
-                lambda(const artis::common::DoubleTime::type& /* t */) const override
-                {
-                    artis::common::Bag<artis::common::DoubleTime> msgs;
-                    artis::qss::IntegratorData data = {_y};
-
-                    msgs.push_back(
-                            artis::common::ExternalEvent<artis::common::DoubleTime>(OUT, data));
-                    return msgs;
-                }
-
-                artis::common::Value observe(const artis::common::DoubleTime::type& /* t */,
-                        unsigned int index) const override
-                {
-                    if (index == VALUE) {
-                        return (double) _y;
+      bag.push_back(common::ExternalEvent<common::DoubleTime>(OUT_X, data));
+      data = {_predator_amount * _predator_proportion};
+      bag.push_back(common::ExternalEvent<common::DoubleTime>(OUT_Y, data));
+    }
+    return bag;
+  }
+
+private:
+  enum Phase {
+    INIT, IDLE, PEST
+  };
+
+  // parameters
+  double _threshold;
+  double _prey_proportion;
+  double _predator_proportion;
+  double _delay;
+
+  // state
+  Phase _phase;
+  common::DoubleTime::type _sigma;
+  double _prey_amount;
+  double _predator_amount;
+};
+
+struct DiscretePreyPredatorParameters {
+  artis::common::DoubleTime::type time_step;
+  double init_value;
+  double a;
+  double b;
+  double d;
+  double e;
+};
+
+class DiscretePredator
+    : public artis::dtss::Dynamics<artis::common::DoubleTime,
+                                   DiscretePredator,
+                                   DiscretePreyPredatorParameters> {
+public:
+  enum inputs {
+    RESET, IN_X, IN_Y
+  };
+  enum outputs {
+    OUT
+  };
+  enum vars {
+    VALUE
+  };
+
+  DiscretePredator(const std::string &name,
+                   const artis::dtss::Context<artis::common::DoubleTime,
+                                              DiscretePredator,
+                                              DiscretePreyPredatorParameters> &context)
+      :
+      artis::dtss::Dynamics<artis::common::DoubleTime,
+                            DiscretePredator,
+                            DiscretePreyPredatorParameters>(
+          name, context), _init_value(context.parameters().init_value),
+      _b(context.parameters().b), _d(context.parameters().d),
+      _e(context.parameters().e) {
+    input_ports({{RESET, "reset"},
+                 {IN_X, "in_x"},
+                 {IN_Y, "in_y"}});
+    output_ports({{OUT, "out"}});
+    observables({{VALUE, "value"}});
+  }
+
+  ~DiscretePredator() override = default;
+
+  void transition(const artis::common::Bag<artis::common::DoubleTime> &bag,
+                  const artis::common::DoubleTime::type & /* t */) override {
+    std::for_each(bag.begin(), bag.end(),
+                  [this](const artis::common::ExternalEvent<artis::common::DoubleTime> &event) {
+                    if (event.on_port(IN_X)) {
+                      artis::qss::IntegratorData data;
+
+                      event.data()(data);
+                      _x = data.value;
+                    } else if (event.on_port(RESET)) {
+                      // TODO
                     }
-                    return artis::common::Value();
-                }
-
-            private:
-                // parameters
-                double _init_value;
-                double _b;
-                double _d;
-                double _e;
-
-                // state
-                double _x;
-                double _y;
-            };
-
-        }
+                  });
+    _y += (_b * _d * _x * _y - _e * _y) * time_step();
+  }
+
+  void start(const artis::common::DoubleTime::type & /* t */) override {
+    _y = _init_value;
+  }
+
+  artis::common::Bag<artis::common::DoubleTime>
+  lambda(const artis::common::DoubleTime::type & /* t */) const override {
+    artis::common::Bag<artis::common::DoubleTime> msgs;
+    artis::qss::IntegratorData data = {_y};
+
+    msgs.push_back(
+        artis::common::ExternalEvent<artis::common::DoubleTime>(OUT, data));
+    return msgs;
+  }
+
+  artis::common::Value observe(const artis::common::DoubleTime::type & /* t */,
+                               unsigned int index) const override {
+    if (index == VALUE) {
+      return (double) _y;
     }
+    return artis::common::Value();
+  }
+
+private:
+  // parameters
+  double _init_value;
+  double _b;
+  double _d;
+  double _e;
+
+  // state
+  double _x;
+  double _y;
+};
+
+}
+}
 } // namespace artis tests qss
 
 #endif