Author: eudoxos
Date: 2009-03-26 10:56:16 +0100 (Thu, 26 Mar 2009)
New Revision: 1732

Modified:
   trunk/core/yade.cpp
   trunk/gui/py/yadeControl.cpp
Log:
1. add addF and addT to legacy ActionContainer


Modified: trunk/core/yade.cpp
===================================================================
--- trunk/core/yade.cpp 2009-03-26 09:14:05 UTC (rev 1731)
+++ trunk/core/yade.cpp 2009-03-26 09:56:16 UTC (rev 1732)
@@ -142,25 +142,28 @@
        -S file : load simulation from file (works with QtGUI only)\n\
        -v      : be verbose (may be repeated)\n\
 \n\
-       --      : pass all remaining options to the selected GUI\n\
+       --      : pass all remaining options to the selected GUI\n\n\
 ";
        cerr <<
-       "compilation flags:\n"
-               "   PREFIX=" PREFIX  "\n"
-               "   SUFFIX=" SUFFIX "\n"
+       "compilation flags:\n\n"
+               "   PREFIX   =    " PREFIX  "\n"
+               "   SUFFIX   =    " SUFFIX "\n"
        #ifdef YADE_DEBUG
-               "   YADE_DEBUG (debug information, crash traces)\n"
+               "   YADE_DEBUG    (debug information, crash traces)\n"
        #endif
        #ifdef NDEBUG
-               "   NDEBUG (heavy optimizations, no assertions and debugging 
features)\n"
+               "   NDEBUG        (heavy optimizations, no assertions and 
debugging features)\n"
        #endif
        #ifdef YADE_OPENMP
-               "   YADE_OPENMP (supports openMP; set OMP_NUM_THREADS env. var 
to control parallelism.\n"
+               "   YADE_OPENMP   (supports openMP; set OMP_NUM_THREADS env. 
var to control parallelism.\n"
        #endif
+       #ifdef LOG4CXX
+               "   LOG4CXX       configurable logging framework enabled 
(~/.yade-suffix/logging.conf)"
+       #endif
        #ifdef BEX_CONTAINER
                "   BEX_CONTAINER (uses BexContainer instead of 
PhysicalActionContainer)\n"
        #endif
-       "\n\n";
+       "\n";
 }
 
 
@@ -170,6 +173,7 @@
         * which locks renderMutex, calls instance() in turn, but since not 
constructed yet,
         * instance() → Omega::Omega → init → resetRootBody → lock renderMutex 
→ deadlock */
        Omega::instance().init();
+       Omega::instance().yadeVersionName = "Yet Another Dynamic Engine 0.12.x, 
beta, SVN snapshot.";
 
        // This makes boost stop bitching about dot-files and other files that 
may not exist on MS-DOS 3.3;
        // see 
http://www.boost.org/libs/filesystem/doc/portability_guide.htm#recommendations 
for what all they consider bad.
@@ -218,7 +222,6 @@
                else if (verbose>=2) logger->setLevel(debugLevel);
        #endif
 
-       Omega::instance().yadeVersionName = "Yet Another Dynamic Engine 0.12.x, 
beta, SVN snapshot.";
        Omega::instance().preferences    = shared_ptr<Preferences>(new 
Preferences);
        Omega::instance().yadeConfigPath = configPath; 
        filesystem::path yadeConfigPath  = 
filesystem::path(Omega::instance().yadeConfigPath, filesystem::native);

Modified: trunk/gui/py/yadeControl.cpp
===================================================================
--- trunk/gui/py/yadeControl.cpp        2009-03-26 09:14:05 UTC (rev 1731)
+++ trunk/gui/py/yadeControl.cpp        2009-03-26 09:56:16 UTC (rev 1732)
@@ -403,6 +403,7 @@
                void clear(){proxee->clear();}
 };
 
+Vector3r tuple2vec(const python::tuple& t){return 
Vector3r(python::extract<double>(t[0])(),python::extract<double>(t[1])(),python::extract<double>(t[2])());}
 
 BASIC_PY_PROXY(pyPhysicalAction,PhysicalAction);
 
@@ -424,9 +425,15 @@
                }
        python::tuple force_get(long id){ Shop::Bex::initCache(); Vector3r 
f=Shop::Bex::force(id); return python::make_tuple(f[0],f[1],f[2]);}
        python::tuple momentum_get(long id){ Shop::Bex::initCache(); Vector3r 
m=Shop::Bex::momentum(id); return python::make_tuple(m[0],m[1],m[2]);}
+       #ifndef BEX_CONTAINER
+               void force_add(long id, python::tuple f){ 
Shop::Bex::initCache(); Shop::Bex::force(id)+=tuple2vec(f);}
+               void torque_add(long id, python::tuple m){ 
Shop::Bex::initCache(); Shop::Bex::momentum(id)+=tuple2vec(m);}
+       #else
+               void force_add(long id, python::tuple f){ throw 
runtime_error("ActionContainer not supported with BexContainer");}
+               void torque_add(long id, python::tuple m){ throw 
runtime_error("ActionContainer not supported with BexContainer");}
+       #endif
 };
 
-Vector3r tuple2vec(const python::tuple& t){return 
Vector3r(python::extract<double>(t[0])(),python::extract<double>(t[1])(),python::extract<double>(t[2])());}
 
 #ifdef BEX_CONTAINER
 class pyBexContainer{
@@ -707,7 +714,9 @@
        
boost::python::class_<pyPhysicalActionContainer>("ActionContainer",python::init<pyPhysicalActionContainer&>())
                .def("__getitem__",&pyPhysicalActionContainer::pyGetitem)
                .def("f",&pyPhysicalActionContainer::force_get)
-               .def("m",&pyPhysicalActionContainer::momentum_get);
+               .def("m",&pyPhysicalActionContainer::momentum_get)
+               .def("addF",&pyPhysicalActionContainer::force_add)
+               .def("addT",&pyPhysicalActionContainer::torque_add);
 
        #ifdef BEX_CONTAINER
        
boost::python::class_<pyBexContainer>("BexContainer",python::init<pyBexContainer&>())


_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp
_______________________________________________
yade-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/yade-dev

Reply via email to