Eric Ramat il y a 8 ans
Parent
commit
76b5a0ea69

+ 0 - 62
src/artis/kernel/AbstractAtomicModel.hpp

@@ -29,8 +29,6 @@
 #include <artis/kernel/States.hpp>
 #include <artis/kernel/States.hpp>
 #include <artis/utils/Exception.hpp>
 #include <artis/utils/Exception.hpp>
 
 
-#include <vector>
-
 namespace artis { namespace kernel {
 namespace artis { namespace kernel {
 
 
 template < typename T, typename U, typename V >
 template < typename T, typename U, typename V >
@@ -85,47 +83,12 @@ public:
     bool is_computed(typename U::type t, unsigned int /* index */) const
     bool is_computed(typename U::type t, unsigned int /* index */) const
     { return type::last_time == t; }
     { return type::last_time == t; }
 
 
-    // bool is_ready(typename U::type t, unsigned int index) const
-    // { return type::externalDates.at(index) == t; }
-
-    // bool is_readyV(typename U::type t, unsigned int index) const
-    // { return type::externalDatesV.at(index) == t; }
-
     bool is_stable(typename U::type t) const
     bool is_stable(typename U::type t) const
     { return type::last_time == t; }
     { return type::last_time == t; }
 
 
     virtual bool is_updated() const
     virtual bool is_updated() const
     { return Externals < T, U >::updated; }
     { return Externals < T, U >::updated; }
 
 
-    // void put(typename U::type t, unsigned int index, double value)
-    // {
-    //     if (type::externalDates.at(index) != t) {
-    //         static_cast < T* >(this)->*externals.at(index) = value;
-    //         type::externalDates.at(index) = t;
-    //         type::updated = true;
-    //     } else {
-    //         if (static_cast < T* >(this)->*externals.at(index) != value) {
-    //             static_cast < T* >(this)->*externals.at(index) = value;
-    //             type::updated = true;
-    //         }
-    //     }
-    // }
-
-    // void put(typename U::type t, unsigned int index,
-    //          const std::vector < double >& value)
-    // {
-    //     if (type::externalDatesV.at(index) != t) {
-    //         static_cast < T* >(this)->*externalsV.at(index) = value;
-    //         type::externalDatesV.at(index) = t;
-    //         type::updated = true;
-    //     } else {
-    //         if (static_cast < T* >(this)->*externalsV.at(index) != value) {
-    //             static_cast < T* >(this)->*externalsV.at(index) = value;
-    //             type::updated = true;
-    //         }
-    //     }
-    // }
-
     virtual void restore(const State < U >& state)
     virtual void restore(const State < U >& state)
     {
     {
         States < T, U >::restore(state);
         States < T, U >::restore(state);
@@ -142,31 +105,6 @@ public:
 
 
     virtual void stable()
     virtual void stable()
     { Externals < T, U >::updated = false; }
     { Externals < T, U >::updated = false; }
-
-protected:
-    // void external(unsigned int index, double T::* var)
-    // {
-    //     if (externals.size() <= index) {
-    //         externals.resize(index + 1);
-    //         type::externalDates.resize(index + 1);
-    //     }
-    //     externals[index] = var;
-    //     type::externalDates[index] = -1;
-    // }
-
-    // void externalV(unsigned int index, std::vector < double > T::* var)
-    // {
-    //     if (externalsV.size() <= index) {
-    //         externalsV.resize(index + 1);
-    //         type::externalDatesV.resize(index + 1);
-    //     }
-    //     externalsV[index] = var;
-    //     type::externalDatesV[index] = -1;
-    // }
-
-private:
-    // std::vector < double T::* > externals;
-    // std::vector < std::vector < double > T::* > externalsV;
 };
 };
 
 
 template < typename T, typename U, typename V >
 template < typename T, typename U, typename V >

+ 3 - 2
src/artis/kernel/AbstractCoupledModel.hpp

@@ -24,6 +24,7 @@
 #define __ARTIS_KERNEL_ABSTRACT_COUPLED_MODEL_HPP
 #define __ARTIS_KERNEL_ABSTRACT_COUPLED_MODEL_HPP
 
 
 #include <artis/kernel/AbstractModel.hpp>
 #include <artis/kernel/AbstractModel.hpp>
+#include <artis/kernel/Externals.hpp>
 #include <artis/kernel/Internals.hpp>
 #include <artis/kernel/Internals.hpp>
 #include <artis/kernel/States.hpp>
 #include <artis/kernel/States.hpp>
 
 
@@ -346,10 +347,10 @@ struct OUT_A_t
 template < typename T >
 template < typename T >
 struct OUT_A_I_t
 struct OUT_A_I_t
 {
 {
-    OUT_A_I_t(long t, T value) : t(t), value(value)
+    OUT_A_I_t(int t, T value) : t(t), value(value)
     { }
     { }
 
 
-    long t;
+    int t;
     T value;
     T value;
 };
 };
 
 

+ 0 - 5
src/artis/kernel/AbstractModel.hpp

@@ -23,12 +23,8 @@
 #ifndef __ARTIS_KERNEL_ABSTRACT_MODEL_HPP
 #ifndef __ARTIS_KERNEL_ABSTRACT_MODEL_HPP
 #define __ARTIS_KERNEL_ABSTRACT_MODEL_HPP
 #define __ARTIS_KERNEL_ABSTRACT_MODEL_HPP
 
 
-#include <artis/kernel/Externals.hpp>
 #include <artis/kernel/Node.hpp>
 #include <artis/kernel/Node.hpp>
 #include <artis/kernel/State.hpp>
 #include <artis/kernel/State.hpp>
-#include <artis/utils/DoubleTime.hpp>
-
-#include <vector>
 
 
 namespace artis { namespace kernel {
 namespace artis { namespace kernel {
 
 
@@ -76,7 +72,6 @@ public:
 
 
 protected:
 protected:
     typename U::type last_time;
     typename U::type last_time;
-//    std::vector < double > externalDatesV;
 };
 };
 
 
 } }
 } }

+ 6 - 0
src/artis/kernel/Externals.hpp

@@ -120,6 +120,12 @@ public:
         externalsD[index] = std::make_pair(-1, var);
         externalsD[index] = std::make_pair(-1, var);
     }
     }
 
 
+    bool is_readyB(typename U::type t, unsigned int index) const
+    { return externalsB.at(index).first == t; }
+
+    bool is_readyI(typename U::type t, unsigned int index) const
+    { return externalsI.at(index).first == t; }
+
     bool is_ready(typename U::type t, unsigned int index) const
     bool is_ready(typename U::type t, unsigned int index) const
     { return externalsD.at(index).first == t; }
     { return externalsD.at(index).first == t; }
 
 

+ 1 - 0
src/artis/observer/View.hpp

@@ -24,6 +24,7 @@
 #define ARTIS_OBSERVER_VIEW_HPP
 #define ARTIS_OBSERVER_VIEW_HPP
 
 
 #include <artis/kernel/AbstractModel.hpp>
 #include <artis/kernel/AbstractModel.hpp>
+#include <artis/utils/DoubleTime.hpp>
 
 
 namespace artis { namespace observer {
 namespace artis { namespace observer {
 
 

+ 4 - 4
src/test/test.cpp

@@ -175,7 +175,7 @@ private:
 typedef artis::kernel::Simulator < RootModel,
 typedef artis::kernel::Simulator < RootModel,
                                    artis::utils::DoubleTime,
                                    artis::utils::DoubleTime,
                                    ModelParameters,
                                    ModelParameters,
-                                   GlobalParameters > Simulator;
+                                   GlobalParameters > ASimulator;
 
 
 class AView : public artis::observer::View < artis::utils::DoubleTime,
 class AView : public artis::observer::View < artis::utils::DoubleTime,
                                              ModelParameters >
                                              ModelParameters >
@@ -196,13 +196,13 @@ public:
 };
 };
 
 
 typedef artis::observer::Output < artis::utils::DoubleTime,
 typedef artis::observer::Output < artis::utils::DoubleTime,
-                                  ModelParameters > Output;
+                                  ModelParameters > AnOutput;
 
 
 TEST_CASE("Simulator_tests", "simple")
 TEST_CASE("Simulator_tests", "simple")
 {
 {
     GlobalParameters globalParameters;
     GlobalParameters globalParameters;
     ModelParameters modelParameters;
     ModelParameters modelParameters;
-    ::Simulator simulator(new RootModel, globalParameters);
+    ASimulator simulator(new RootModel, globalParameters);
 
 
     simulator.attachView("Root", new AView);
     simulator.attachView("Root", new AView);
 
 
@@ -210,7 +210,7 @@ TEST_CASE("Simulator_tests", "simple")
     simulator.init(0, modelParameters);
     simulator.init(0, modelParameters);
     simulator.run(0, 10);
     simulator.run(0, 10);
 
 
-    ::Output output(simulator.observer());
+    AnOutput output(simulator.observer());
 
 
     output();
     output();
 }
 }