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

Merge remote-tracking branch 'origin/master'

Eric Ramat 7 лет назад
Родитель
Сommit
5d873ea169

+ 4 - 2
src/artis/context/Value.hpp

@@ -27,9 +27,11 @@
 #include <boost/serialization/array.hpp>
 
 #include <algorithm>
-#include <cstring>
 #include <typeinfo>
-
+#include <cstring>
+#if WIN32
+#include <string>
+#endif
 namespace artis { namespace context {
 
 class Value

+ 29 - 22
src/artis/kernel/AbstractCoupledModel.hpp

@@ -349,25 +349,25 @@ public:
     }
 
 protected:
-    // void change_internal(unsigned int index, double T::* var)
-    // {
-    //     submodel_internals.erase(index);
-    //     Internals < T, U, V >::internal(index, var);
-    // }
-
-    // void change_internal(unsigned int index, int T::* var)
-    // {
-    //     submodel_internals.erase(index);
-    //     Internals < T, U, V >::internalI(index, var);
-    // }
-
-    // void change_internal(unsigned int index, bool T::* var)
-    // {
-    //     submodel_internals.erase(index);
-    //     Internals < T, U, V >::internalB(index, var);
-    // }
-
-    void internal_(unsigned int index, type* model, int sub_index)
+     void change_internal(unsigned int index, double T::* var)
+     {
+         submodel_internals.erase(index);
+         Internals < T, U, V >::internal(index, var);
+     }
+
+     void change_internal(unsigned int index, int T::* var)
+     {
+         submodel_internals.erase(index);
+         Internals < T, U, V >::internalI(index, var);
+     }
+
+     void change_internal(unsigned int index, bool T::* var)
+     {
+         submodel_internals.erase(index);
+         Internals < T, U, V >::internalB(index, var);
+     }
+
+    void link_internal_(unsigned int index, type* model, int sub_index)
     {
         submodel_internals[index] =
             std::pair < type*, int >(model, sub_index);
@@ -408,7 +408,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__
@@ -428,7 +428,10 @@ private:
 #define LIST_S_3(L1, L2, L3) { UNWRAP_ITEM_S(L1), UNWRAP_ITEM_S(L2), UNWRAP_ITEM_S(L3) }
 #define LIST_S_2(L1, L2) { UNWRAP_ITEM_S(L1), UNWRAP_ITEM_S(L2) }
 #define LIST_S_1(L1) { UNWRAP_ITEM_S(L1) }
-#define UNWRAP_S_2(...) GET_MACRO(__VA_ARGS__, LIST_S_16, LIST_S_15, LIST_S_14, LIST_S_13, LIST_S_12, LIST_S_11, LIST_S_10, LIST_S_9, LIST_S_8, LIST_S_7, LIST_S_6, LIST_S_5, LIST_S_4, LIST_S_3, LIST_S_2, LIST_S_1)(__VA_ARGS__)
+#define LIST_S_(N) LIST_S_##N
+#define LIST_S_EVAL(N) LIST_S_(N)
+#define UNWRAP_S_2(...) EXPAND( LIST_S_EVAL(EXPAND( PP_NARG(__VA_ARGS__) ))(__VA_ARGS__) )
+//#define UNWRAP_S_2(...) GET_MACRO(__VA_ARGS__, LIST_S_16, LIST_S_15, LIST_S_14, LIST_S_13, LIST_S_12, LIST_S_11, LIST_S_10, LIST_S_9, LIST_S_8, LIST_S_7, LIST_S_6, LIST_S_5, LIST_S_4, LIST_S_3, LIST_S_2, LIST_S_1)(__VA_ARGS__)
 #define InternalsS(L) I_(UNWRAP_S_2 L)
 
 #define ITEM_Sub(index, model) { index, model }
@@ -449,9 +452,13 @@ private:
 #define LIST_Sub_3(L1, L2, L3) { UNWRAP_ITEM_Sub(L1), UNWRAP_ITEM_Sub(L2), UNWRAP_ITEM_Sub(L3) }
 #define LIST_Sub_2(L1, L2) { UNWRAP_ITEM_Sub(L1), UNWRAP_ITEM_Sub(L2) }
 #define LIST_Sub_1(L1) { UNWRAP_ITEM_Sub(L1) }
-#define UNWRAP_Sub_2(...) GET_MACRO(__VA_ARGS__, LIST_Sub_16, LIST_Sub_15, LIST_Sub_14, LIST_Sub_13, LIST_Sub_12, LIST_Sub_11, LIST_Sub_10, LIST_Sub_9, LIST_Sub_8, LIST_Sub_7, LIST_Sub_6, LIST_Sub_5, LIST_Sub_4, LIST_Sub_3, LIST_Sub_2, LIST_Sub_1)(__VA_ARGS__)
+#define LIST_Sub_(N) LIST_Sub_##N
+#define LIST_Sub_EVAL(N) LIST_Sub_(N)
+#define UNWRAP_Sub_2(...) EXPAND( LIST_Sub_EVAL(EXPAND( PP_NARG(__VA_ARGS__) ))(__VA_ARGS__) )
+//#define UNWRAP_Sub_2(...) GET_MACRO(__VA_ARGS__, LIST_Sub_16, LIST_Sub_15, LIST_Sub_14, LIST_Sub_13, LIST_Sub_12, LIST_Sub_11, LIST_Sub_10, LIST_Sub_9, LIST_Sub_8, LIST_Sub_7, LIST_Sub_6, LIST_Sub_5, LIST_Sub_4, LIST_Sub_3, LIST_Sub_2, LIST_Sub_1)(__VA_ARGS__)
 #define Submodels(L) SM_(UNWRAP_Sub_2 L)
 
+
 } }
 
 #endif

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

@@ -30,6 +30,9 @@
 #include <boost/core/demangle.hpp>
 
 #include <typeinfo>
+#if WIN32
+#include <iso646.h>
+#endif
 
 namespace artis { namespace kernel {
 

+ 3 - 1
src/artis/kernel/Externals.hpp

@@ -27,7 +27,9 @@
 #include <artis/kernel/Macro.hpp>
 
 #include <vector>
-
+#if WIN32
+#include <iso646.h>
+#endif
 namespace artis { namespace kernel {
 
 template < typename T, typename U, typename V >

+ 13 - 2
src/artis/kernel/Macro.hpp

@@ -46,7 +46,18 @@
 #define LIST_3(L1, L2, L3) { UNWRAP_ITEM(L1), UNWRAP_ITEM(L2), UNWRAP_ITEM(L3) }
 #define LIST_2(L1, L2) { UNWRAP_ITEM(L1), UNWRAP_ITEM(L2) }
 #define LIST_1(L1) { UNWRAP_ITEM(L1) }
-#define GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, NAME, ...) NAME
-#define UNWRAP2(...) GET_MACRO(__VA_ARGS__, LIST_16, LIST_15, LIST_14, LIST_13, LIST_12, LIST_11, LIST_10, LIST_9, LIST_8, LIST_7, LIST_6, LIST_5, LIST_4, LIST_3, LIST_2, LIST_1)(__VA_ARGS__)
+//#define GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, NAME, ...) NAME
+//#define UNWRAP2(...) GET_MACRO(__VA_ARGS__, LIST_16, LIST_15, LIST_14, LIST_13, LIST_12, LIST_11, LIST_10, LIST_9, LIST_8, LIST_7, LIST_6, LIST_5, LIST_4, LIST_3, LIST_2, LIST_1)(__VA_ARGS__)
+
+//MVSC compatibility
+#define EXPAND(X) X
+#define PP_NARG(...) EXPAND( PP_NARG_(__VA_ARGS__, PP_RSEQ_N()) )
+#define PP_NARG_(...) EXPAND( PP_ARG_N(__VA_ARGS__) )
+#define PP_ARG_N(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10_,_11,_12,_13,_14,_15,_16,N, ...) N
+#define PP_RSEQ_N() 16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+#define LIST_(N) LIST_##N
+#define LIST_EVAL(N) LIST_(N)
+#define UNWRAP2(...) EXPAND( LIST_EVAL(EXPAND( PP_NARG(__VA_ARGS__) ))(__VA_ARGS__) )
+
 
 #endif

+ 3 - 0
src/artis/utils/DateTime.cpp

@@ -26,6 +26,9 @@
 #include <regex>
 #include <ctime>
 #include <cmath>
+#if WIN32
+#include <iso646.h>
+#endif
 
 namespace artis { namespace utils {
 

+ 8 - 3
src/test/models.hpp

@@ -20,14 +20,15 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef TEST_MODELS_HPP
+#define TEST_MODELS_HPP
+
 #include <artis/kernel/AbstractAtomicModel.hpp>
 #include <artis/kernel/AbstractCoupledModel.hpp>
 #include <artis/utils/Trace.hpp>
 
 #include <memory>
 
-#ifndef TEST_MODELS_HPP
-#define TEST_MODELS_HPP
 
 struct GlobalParameters
 { };
@@ -158,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)
@@ -167,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);
 
@@ -205,6 +207,9 @@ private:
     std::unique_ptr < AModel > _a;
     std::unique_ptr < BModel > _b;
 
+    //internals
+    double _dx;
+
     // states
     int _n;
 };