Просмотр исходного кода

Add function for single subModel

gbeurier 6 лет назад
Родитель
Сommit
b3c7b9a191
1 измененных файлов с 17 добавлено и 13 удалено
  1. 17 13
      src/artis/kernel/AbstractCoupledModel.hpp

+ 17 - 13
src/artis/kernel/AbstractCoupledModel.hpp

@@ -491,22 +491,26 @@ protected:
         for (typename std::initializer_list < std::pair <  unsigned int,
                  type* > >::iterator it =
                  models.begin(); it != models.end(); ++it) {
-            submodels[it->first] = it->second;
-            it->second->set_parent(this);
+            subModel(it->first, it->second);
+        }
+    }
+
+    void subModel(unsigned int index, type* model)
+    {
+        submodels[index] = model;
+        model->set_parent(this);
 
 #ifdef WITH_TRACE
-            utils::Trace < utils::DoubleTime >::trace()
-                << utils::TraceElement < utils::DoubleTime >(
-                    true,
-                    AbstractCoupledModel < T, U, V, W >::path(this),
-                    utils::DoubleTime::null,
-                    utils::SUBMODEL_ADD)
-                << utils::KernelInfo(
-                    AbstractCoupledModel < T, U, V, W >::path(it->second));
-            utils::Trace < utils::DoubleTime >::trace().flush();
+        utils::Trace < utils::DoubleTime >::trace()
+            << utils::TraceElement < utils::DoubleTime >(
+                true,
+                AbstractCoupledModel < T, U, V, W >::path(this),
+                utils::DoubleTime::null,
+                utils::SUBMODEL_ADD)
+            << utils::KernelInfo(
+                AbstractCoupledModel < T, U, V, W >::path(model));
+        utils::Trace < utils::DoubleTime >::trace().flush();
 #endif
-
-        }
     }
 
     void setsubmodel(unsigned int index, type* model)