Browse Source

Add assertion (tn)

Eric Ramat 5 months ago
parent
commit
e3dfc45bab

+ 3 - 0
src/artis-star/common/RootCoordinator.hpp

@@ -102,6 +102,9 @@ public :
 
       _root.output(_tn);
       next_tn = _root.transition(_tn);
+
+      assert(next_tn >= _tn);
+
       _observer.observe(_tn, _t_max < next_tn ? _t_max : next_tn);
       _tn = next_tn;
     }

+ 8 - 9
src/artis-star/common/observer/View.hpp

@@ -43,9 +43,9 @@ class View
   typedef std::vector<int> Selector;
 
 public:
-  typedef std::vector<std::pair<double, common::Value> > Values;
-  typedef std::map<std::string, Values> VariableValues;
-  typedef std::map<std::string, VariableValues> SelectorValues;
+  typedef std::vector <std::pair<double, common::Value>> Values;
+  typedef std::map <std::string, Values> VariableValues;
+  typedef std::map <std::string, VariableValues> SelectorValues;
 
   enum vars
   {
@@ -140,7 +140,7 @@ public:
     }
   }
 
-  void observe(double time, const common::Model<common::DoubleTime> *model,
+  void observe(double time, const common::Model <common::DoubleTime> *model,
                const std::string &selector_name, unsigned int variable_index)
   {
     std::string path = (boost::format("%1%:%2%") % model->path() %
@@ -155,7 +155,7 @@ public:
   }
 
   void observe(const Selector &chain, unsigned int i,
-               double time, const common::Model<common::DoubleTime> *model,
+               double time, const common::Model <common::DoubleTime> *model,
                const std::string &selector_name, unsigned int variable_index)
   {
     assert(model != nullptr);
@@ -193,13 +193,12 @@ public:
   {
     for (typename Selectors::const_iterator it = _selectors.begin();
          it != _selectors.end(); ++it) {
-      const common::Model<common::DoubleTime> *model = _model;
+      const common::Model <common::DoubleTime> *model = _model;
 
       if (it->second.size() > 1) {
         size_t i = 0;
 
-        observe(it->second, i, time, model, it->first,
-                it->second.back());
+        observe(it->second, i, time, model, it->first, it->second.back());
       } else {
         if (model) {
           observe(time, model, it->first, it->second.back());
@@ -217,7 +216,7 @@ public:
   { return _values; }
 
 private:
-  typedef std::map<std::string, Selector> Selectors;
+  typedef std::map <std::string, Selector> Selectors;
 
   Selectors _selectors;
   SelectorValues _values;