Преглед на файлове

Fixed internal (local) on CoupledModels

gbeurier преди 7 години
родител
ревизия
b9d0330e50
променени са 2 файла, в които са добавени 7 реда и са изтрити 3 реда
  1. 2 2
      src/artis/kernel/AbstractCoupledModel.hpp
  2. 5 1
      src/test/models.hpp

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

@@ -368,7 +368,7 @@ protected:
          Internals < T, U, V >::internalB(index, var);
      }
 
-    void internal_(unsigned int index, type* model, int sub_index)
+    void link_internal_(unsigned int index, type* model, int sub_index)
     {
         submodel_internals[index] =
             std::pair < type*, int >(model, sub_index);
@@ -409,7 +409,7 @@ private:
     Setsubmodels setsubmodels;
 };
 
-#define InternalS(index, var, sub_index) internal_(index, var, sub_index)
+#define InternalS(index, var, sub_index) link_internal_(index, var, sub_index)
 
 #define ITEM_S(index, var, sub_index) Var(index, var, sub_index)
 #define UNWRAP_ITEM_S(...) ITEM_S __VA_ARGS__

+ 5 - 1
src/test/models.hpp

@@ -159,7 +159,7 @@ class RootModel : public CoupledModel < RootModel >
 {
 public:
     enum submodels { A, B };
-    enum internals { IY, BY, DY, IZ };
+    enum internals { IY, BY, DY, IZ, DX };
     enum states { N };
 
     RootModel() : _a(new AModel), _b(new BModel)
@@ -168,6 +168,7 @@ public:
         Submodels(((A, _a.get()), (B, _b.get())));
 
         // internals
+        Internal(DX, &RootModel::_dx);
         InternalsS(((IY, _b.get(), BModel::IY), (IZ, _b.get(), BModel::IZ)));
         InternalS(BY, _b.get(), BModel::BY);
 
@@ -206,6 +207,9 @@ private:
     std::unique_ptr < AModel > _a;
     std::unique_ptr < BModel > _b;
 
+    //internals
+    double _dx;
+
     // states
     int _n;
 };