Author: eudoxos
Date: 2009-02-23 22:25:32 +0100 (Mon, 23 Feb 2009)
New Revision: 1685

Added:
   trunk/core/Timing.hpp
Modified:
   trunk/core/Engine.hpp
   trunk/core/EngineUnit.hpp
   trunk/core/MetaBody.cpp
   trunk/extra/Brefcom.cpp
   trunk/extra/Brefcom.hpp
   trunk/gui/SConscript
   trunk/gui/py/_utils.cpp
   trunk/gui/py/utils.py
   trunk/gui/py/yadeControl.cpp
   trunk/gui/qt3/QtFileGenerator.cpp
   trunk/gui/qt3/QtFileGenerator.hpp
   trunk/gui/qt3/QtFileGeneratorController.ui
   trunk/gui/qt3/SimulationController.cpp
Log:
1. Add time-profiling classes. See 
http://yade.wikia.com/wiki/Speed_profiling_using_TimingInfo_and_TimingDeltas_classes
 for details. It is accessible from python as well.
2. SimulationController no longer asks for output format. It just uses XML, the 
only available one.
3. Engine, EngineUnit have timingInfo member and pointer to optional 
timingDeltas. Timing is disabled by default, but it may still have some 
overhead in the order <1% perhaps (will test)


Modified: trunk/core/Engine.hpp
===================================================================
--- trunk/core/Engine.hpp       2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/core/Engine.hpp       2009-02-23 21:25:32 UTC (rev 1685)
@@ -11,7 +11,8 @@
 #pragma once
 
 #include<yade/lib-serialization/Serializable.hpp>
-#include "Omega.hpp"
+#include"Omega.hpp"
+#include<yade/core/Timing.hpp>
 
 class Body;
 
@@ -19,6 +20,8 @@
 {
        public :
                string label; /* user-definable label, to convenienty retrieve 
this particular engine instance even if multiple engines of the same type exist 
*/
+               TimingInfo timingInfo; // hihg-level profiling information; not 
serializable
+               shared_ptr<TimingDeltas> timingDeltas;
                Engine() {};
                virtual ~Engine() {};
        
@@ -28,9 +31,7 @@
                virtual list<string> getNeededBex(){return list<string>();}
        REGISTER_ATTRIBUTES(/*no base*/,(label));
        REGISTER_CLASS_AND_BASE(Engine,Serializable);
-
 };
-
 REGISTER_SERIALIZABLE(Engine);
 
 

Modified: trunk/core/EngineUnit.hpp
===================================================================
--- trunk/core/EngineUnit.hpp   2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/core/EngineUnit.hpp   2009-02-23 21:25:32 UTC (rev 1685)
@@ -12,10 +12,13 @@
 
 #include<yade/lib-serialization/Serializable.hpp>
 
+class TimingDeltas;
+
 class EngineUnit : public Serializable
 {
        public: virtual vector<std::string> getFunctorTypes(){throw;}
                virtual list<string> getNeededBex(){return list<string>();}
+       shared_ptr<TimingDeltas> timingDeltas;
        REGISTER_CLASS_AND_BASE(EngineUnit,Serializable);
 };
 

Modified: trunk/core/MetaBody.cpp
===================================================================
--- trunk/core/MetaBody.cpp     2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/core/MetaBody.cpp     2009-02-23 21:25:32 UTC (rev 1685)
@@ -10,6 +10,7 @@
 
 #include"MetaBody.hpp"
 #include<yade/core/Engine.hpp>
+#include<yade/core/Timing.hpp>
 #include<yade/core/TimeStepper.hpp>
 
 #include<Wm3Math.h>
@@ -28,7 +29,11 @@
 // POSIX-only
 #include<pwd.h>
 #include<unistd.h>
+#include<time.h>
 
+// should be elsewhere, probably
+bool TimingInfo::enabled=false;
+
 MetaBody::MetaBody() :
          Body(),bodies(new BodyRedirectionVector), interactions(new 
InteractionVecSet), 
persistentInteractions(interactions),transientInteractions(interactions),physicalActions(new
 PhysicalActionVectorVector)
 {      
@@ -77,7 +82,13 @@
                FOREACH(shared_ptr<Engine> e, initializers){ 
if(e->isActivated()) e->action(this); }
                needsInitializers=false;
        }
-       FOREACH(const shared_ptr<Engine>& e, engines){ if(e->isActivated()){ 
e->action(this); }}
+       TimingInfo::delta last=TimingInfo::getNow();
+       FOREACH(const shared_ptr<Engine>& e, engines){
+               if(e->isActivated()){
+                       e->action(this);
+                       if(TimingInfo::enabled) {TimingInfo::delta 
now=TimingInfo::getNow(); e->timingInfo.nsec+=now-last; e->timingInfo.nExec+=1; 
last=now;}
+               }
+       }
 }
 
 shared_ptr<Engine> MetaBody::engineByName(string s){

Added: trunk/core/Timing.hpp
===================================================================
--- trunk/core/Timing.hpp       2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/core/Timing.hpp       2009-02-23 21:25:32 UTC (rev 1685)
@@ -0,0 +1,32 @@
+// 2009 © Václav Šmilauer <[email protected]>
+#pragma once
+#include<time.h>
+
+struct TimingInfo{
+       typedef unsigned long long delta;
+       long nExec;
+       delta nsec;
+       TimingInfo():nExec(0),nsec(0){}
+       static delta getNow(){ if(!enabled) return 0L; struct timespec ts; 
clock_gettime(CLOCK_MONOTONIC,&ts); return delta(1e9*ts.tv_sec+ts.tv_nsec);}
+       static bool enabled;
+};
+
+/* Create TimingDeltas object, then every call to checkpoint() will add
+ * (or use existing) TimingInfo to data. It increases its nExec by 1
+ * and nsec by time elapsed since construction or last checkpoint.
+ */
+class TimingDeltas{
+               TimingInfo::delta last;
+               size_t i;
+       public:
+               vector<TimingInfo> data;
+               vector<string> labels;
+               TimingDeltas():i(0){}
+               void start(){if(!TimingInfo::enabled)return; 
i=0;last=TimingInfo::getNow();}
+               void checkpoint(const string& label){
+                       if(!TimingInfo::enabled) return;
+                       if(data.size()<=i) { data.resize(i+1); 
labels.resize(i+1); labels[i]=label;}
+                       TimingInfo::delta now=TimingInfo::getNow();
+                       data[i].nExec+=1; data[i].nsec+=now-last; last=now; i++;
+               }
+};

Modified: trunk/extra/Brefcom.cpp
===================================================================
--- trunk/extra/Brefcom.cpp     2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/extra/Brefcom.cpp     2009-02-23 21:25:32 UTC (rev 1685)
@@ -134,6 +134,7 @@
 CREATE_LOGGER(ef2_Spheres_Brefcom_BrefcomLaw);
 
 void ef2_Spheres_Brefcom_BrefcomLaw::go(shared_ptr<InteractionGeometry>& 
_geom, shared_ptr<InteractionPhysics>& _phys, Interaction* I, MetaBody* 
rootBody){
+       //timingDeltas->start();
        SpheresContactGeometry* 
contGeom=static_cast<SpheresContactGeometry*>(_geom.get());
        BrefcomContact* BC=static_cast<BrefcomContact*>(_phys.get());
 
@@ -149,16 +150,19 @@
        Real& omega(BC->omega); Real& sigmaN(BC->sigmaN);  Vector3r& 
sigmaT(BC->sigmaT); Real& Fn(BC->Fn); Vector3r& Fs(BC->Fs); // for python access
 
        assert(contGeom->hasShear);
+       //timingDeltas->checkpoint("setup");
        epsN=contGeom->epsN(); epsT=contGeom->epsT();
        // already in SpheresContactGeometry:
        // contGeom->relocateContactPoints(); // allow very large mutual 
rotations
        if(logStrain && epsN<0){ Real epsN0=epsN; epsN=log(epsN0+1); 
epsT*=epsN/epsN0; }
+       //timingDeltas->checkpoint("geom");
        #ifdef BREFCOM_MATERIAL_MODEL
                BREFCOM_MATERIAL_MODEL
        #else
                sigmaN=E*epsN;
                sigmaT=G*epsT;
        #endif
+       //timingDeltas->checkpoint("material");
        if(omega>omegaThreshold){
                I->isReal=false;
                const shared_ptr<Body>& body1=Body::byId(I->getId1(),rootBody), 
body2=Body::byId(I->getId2(),rootBody); assert(body1); assert(body2);
@@ -176,6 +180,7 @@
        Fs=sigmaT*crossSection; BC->shearForce=Fs;
 
        applyForceAtContactPoint(BC->normalForce+BC->shearForce, 
contGeom->contactPoint, I->getId1(), contGeom->pos1, I->getId2(), 
contGeom->pos2, rootBody);
+       //timingDeltas->checkpoint("rest");
 }
 
 

Modified: trunk/extra/Brefcom.hpp
===================================================================
--- trunk/extra/Brefcom.hpp     2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/extra/Brefcom.hpp     2009-02-23 21:25:32 UTC (rev 1685)
@@ -162,7 +162,7 @@
        }
        public:
                bool logStrain;
-               ef2_Spheres_Brefcom_BrefcomLaw(): logStrain(false){}
+               ef2_Spheres_Brefcom_BrefcomLaw(): logStrain(false){ 
/*timingDeltas=shared_ptr<TimingDeltas>(new TimingDeltas);*/ }
                void go(shared_ptr<InteractionGeometry>& _geom, 
shared_ptr<InteractionPhysics>& _phys, Interaction* I, MetaBody* rootBody);
        FUNCTOR2D(SpheresContactGeometry,BrefcomContact);
        REGISTER_CLASS_AND_BASE(ef2_Spheres_Brefcom_BrefcomLaw,ConstitutiveLaw);

Modified: trunk/gui/SConscript
===================================================================
--- trunk/gui/SConscript        2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/gui/SConscript        2009-02-23 21:25:32 UTC (rev 1685)
@@ -81,6 +81,7 @@
                env.File('ipython.py','py'),
                env.File('plot.py','py'),
                env.File('linterpolation.py','py'),
+               env.File('timing.py','py'),
                env.File('PythonTCPServer.py','py'),
        ])
 

Modified: trunk/gui/py/_utils.cpp
===================================================================
--- trunk/gui/py/_utils.cpp     2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/gui/py/_utils.cpp     2009-02-23 21:25:32 UTC (rev 1685)
@@ -286,7 +286,7 @@
                return python::make_tuple(python::make_tuple(r,h),theta);
        }
        else{
-               Real hPeriodStart=(periodStart-theta0)*dH_dTheta;
+               // Real hPeriodStart=(periodStart-theta0)*dH_dTheta;
                //TRVAR4(hPeriodStart,periodStart,theta0,theta);
                //Real 
h=Shop::periodicWrap(pt[axis]-hRef,hPeriodStart,hPeriodStart+2*Mathr::PI*dH_dTheta,&period);
                
theta=Shop::periodicWrap(theta,periodStart,periodStart+2*Mathr::PI,&period);

Modified: trunk/gui/py/utils.py
===================================================================
--- trunk/gui/py/utils.py       2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/gui/py/utils.py       2009-02-23 21:25:32 UTC (rev 1685)
@@ -16,6 +16,16 @@
 # c++ implementations for performance reasons
 from yade._utils import *
 
+def resetEngineClocks():
+       for e in O.engines: e.execTime=0
+def engineClockStats():
+       tSum=sum([e.execTime for e in O.engines])
+       for e in O.engines:
+               print 
e.name.ljust(30),(str(e.execTime/1000)+'ms').rjust(15),'%6.2f%%'%(e.execTime*100./tSum)
+       print '='*53
+       print 'TOTAL'.ljust(30),(str(tSum/1000)+'ms').rjust(15),'100.00%'
+
+
 def saveVars(mark='',loadNow=False,**kw):
        """Save passed variables into the simulation so that it can be 
recovered when the simulation is loaded again.
 

Modified: trunk/gui/py/yadeControl.cpp
===================================================================
--- trunk/gui/py/yadeControl.cpp        2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/gui/py/yadeControl.cpp        2009-02-23 21:25:32 UTC (rev 1685)
@@ -164,9 +164,34 @@
 BASIC_PY_PROXY(pyBoundingVolume,BoundingVolume);
 BASIC_PY_PROXY(pyInteractingGeometry,InteractingGeometry);
 
-BASIC_PY_PROXY(pyDeusExMachina,DeusExMachina);
-BASIC_PY_PROXY(pyStandAloneEngine,StandAloneEngine);
+struct pyTimingDeltas{
+       shared_ptr<TimingDeltas> proxee;
+       pyTimingDeltas(shared_ptr<TimingDeltas> td){proxee=td;}
+       python::list data_get(){
+               python::list ret;
+               for(size_t i=0; i<proxee->data.size(); i++){
+                       
ret.append(python::make_tuple(proxee->labels[i],proxee->data[i].nsec,proxee->data[i].nExec));
+               }
+               return ret;
+       }
+       void reset(){proxee->data.clear(); proxee->labels.clear();}
+};
 
+#define PY_PROXY_TIMING \
+       TimingInfo::delta execTime_get(void){return proxee->timingInfo.nsec;} 
void execTime_set(TimingInfo::delta t){proxee->timingInfo.nsec=t;} \
+       long execCount_get(void){return proxee->timingInfo.nExec;} void 
execCount_set(long n){proxee->timingInfo.nExec=n;} \
+       python::object timingDeltas_get(void){return 
proxee->timingDeltas?python::object(pyTimingDeltas(proxee->timingDeltas)):python::object();}
+
+
+BASIC_PY_PROXY_HEAD(pyDeusExMachina,DeusExMachina)
+       PY_PROXY_TIMING
+BASIC_PY_PROXY_TAIL;
+
+BASIC_PY_PROXY_HEAD(pyStandAloneEngine,StandAloneEngine)
+       PY_PROXY_TIMING
+BASIC_PY_PROXY_TAIL;
+       
+
 python::list anyEngines_get(const vector<shared_ptr<Engine> >&);
 void anyEngines_set(vector<shared_ptr<Engine> >&, python::object);
 
@@ -200,6 +225,7 @@
 
 BASIC_PY_PROXY_HEAD(pyEngineUnit,EngineUnit)
        python::list bases_get(void){ python::list ret; vector<string> 
t=proxee->getFunctorTypes(); for(size_t i=0; i<t.size(); i++) ret.append(t[i]); 
return ret; }
+       python::object timingDeltas_get(){return 
proxee->timingDeltas?python::object(pyTimingDeltas(proxee->timingDeltas)):python::object();}
 BASIC_PY_PROXY_TAIL;
 
 
@@ -244,6 +270,7 @@
                                #undef TRY_ADD_FUNCTOR
                        }
                }
+       PY_PROXY_TIMING
 BASIC_PY_PROXY_TAIL;
 
 python::list anyEngines_get(const vector<shared_ptr<Engine> >& engContainer){
@@ -436,6 +463,9 @@
        bool usesTimeStepper_get(){return OMEGA.timeStepperActive();}
        void usesTimeStepper_set(bool use){OMEGA.skipTimeStepper(!use);}
 
+       bool timingEnabled_get(){return TimingInfo::enabled;}
+       void timingEnabled_set(bool enabled){TimingInfo::enabled=enabled;}
+
        void run(long int numIter=-1,bool doWait=false){
                if(numIter>0) 
OMEGA.getRootBody()->stopAtIteration=OMEGA.getCurrentIteration()+numIter;
                OMEGA.startSimulationLoop();
@@ -619,6 +649,7 @@
                
.add_property("bodyContainer",&pyOmega::bodyContainer_get,&pyOmega::bodyContainer_set)
                
.add_property("interactionContainer",&pyOmega::interactionContainer_get,&pyOmega::interactionContainer_set)
                
.add_property("actionContainer",&pyOmega::physicalActionContainer_get,&pyOmega::physicalActionContainer_set)
+               
.add_property("timingEnabled",&pyOmega::timingEnabled_get,&pyOmega::timingEnabled_set)
                ;
        boost::python::class_<pyTags>("TagsWrapper",python::init<pyTags&>())
                .def("__getitem__",&pyTags::getItem)
@@ -652,17 +683,29 @@
                .def("m",&pyBexContainer::torque_get);
        #endif
 
-       BASIC_PY_PROXY_WRAPPER(pyStandAloneEngine,"StandAloneEngine");
+       
boost::python::class_<pyTimingDeltas>("TimingDeltas",python::init<pyTimingDeltas&>())
+               .def("reset",&pyTimingDeltas::reset)
+               .add_property("data",&pyTimingDeltas::data_get);
+
+       #define TIMING_PROPS(class) 
.add_property("execTime",&class::execTime_get,&class::execTime_set).add_property("execCount",&class::execCount_get,&class::execCount_set).add_property("timingDeltas",&class::timingDeltas_get)
+
+       BASIC_PY_PROXY_WRAPPER(pyStandAloneEngine,"StandAloneEngine")
+               TIMING_PROPS(pyStandAloneEngine);
        BASIC_PY_PROXY_WRAPPER(pyMetaEngine,"MetaEngine")
                
.add_property("functors",&pyMetaEngine::functors_get,&pyMetaEngine::functors_set)
+               TIMING_PROPS(pyMetaEngine)
                .def(python::init<string,python::list>());
        BASIC_PY_PROXY_WRAPPER(pyParallelEngine,"ParallelEngine")
                
.add_property("slaves",&pyParallelEngine::slaves_get,&pyParallelEngine::slaves_set)
                .def(python::init<python::list>());
-       BASIC_PY_PROXY_WRAPPER(pyDeusExMachina,"DeusExMachina");
+       BASIC_PY_PROXY_WRAPPER(pyDeusExMachina,"DeusExMachina")
+               TIMING_PROPS(pyDeusExMachina);
        BASIC_PY_PROXY_WRAPPER(pyEngineUnit,"EngineUnit")
+               .add_property("timingDeltas",&pyEngineUnit::timingDeltas_get)
                .add_property("bases",&pyEngineUnit::bases_get);
 
+       #undef TIMING_PROPS
+
        BASIC_PY_PROXY_WRAPPER(pyGeometricalModel,"GeometricalModel");
        BASIC_PY_PROXY_WRAPPER(pyInteractingGeometry,"InteractingGeometry");
        BASIC_PY_PROXY_WRAPPER(pyPhysicalParameters,"PhysicalParameters")       

Modified: trunk/gui/qt3/QtFileGenerator.cpp
===================================================================
--- trunk/gui/qt3/QtFileGenerator.cpp   2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/gui/qt3/QtFileGenerator.cpp   2009-02-23 21:25:32 UTC (rev 1685)
@@ -33,17 +33,15 @@
        setMinimumSize(s);
        setMaximumSize(QSize(s.width(),32000)); 
        textLabel1->setText("waiting for orders");
-       
+
        map<string,DynlibDescriptor>::const_iterator di    = 
Omega::instance().getDynlibsDescriptor().begin();
        map<string,DynlibDescriptor>::const_iterator diEnd = 
Omega::instance().getDynlibsDescriptor().end();
        for(;di!=diEnd;++di)
        {
                if 
(Omega::instance().isInheritingFrom((*di).first,"FileGenerator"))
                        cbGeneratorName->insertItem((*di).first);
-               if 
(Omega::instance().isInheritingFrom((*di).first,"IOFormatManager"))
-                       cbSerializationName->insertItem((*di).first);
        }
-       setSerializationName("XMLFormatManager");
+
        
        leOutputFileName->setText("./scene.xml");
 
@@ -69,15 +67,6 @@
 
 }
 
-void QtFileGenerator::setSerializationName(string n)
-{
-       for(int i=0 ; i<cbSerializationName->count() ; ++i)
-       {
-               cbSerializationName->setCurrentItem(i);
-               if(cbSerializationName->currentText() == n)
-                       return;
-       }
-}
 
 void QtFileGenerator::setGeneratorName(string n)
 {
@@ -93,26 +82,10 @@
 {
        string selectedFilter;
        std::vector<string> filters;
-       filters.push_back("Yade Binary File (*.yade)");
        filters.push_back("XML Yade File (*.xml)");
-       string fileName = FileDialog::getSaveFileName(".", filters , "Choose a 
file to save", 
-               #ifdef USE_WORKSPACE
-                       this->parentWidget()->parentWidget()
-               #else
-                       NULL
-               #endif
-       ,selectedFilter );
+       string fileName = FileDialog::getSaveFileName(".", filters , "Choose a 
file to save", NULL,selectedFilter );
 
-       if (fileName.size()!=0 && selectedFilter == "XML Yade File (*.xml)" && 
fileName!="/" )
-       {
-               setSerializationName("XMLFormatManager");
-               leOutputFileName->setText(fileName);
-       }
-       else if (fileName.size()!=0 && selectedFilter == "Yade Binary File 
(*.yade)" && fileName!="/" )
-       {
-               setSerializationName("BINFormatManager");
-               leOutputFileName->setText(fileName);
-       }
+       leOutputFileName->setText(fileName);
 }
 
 void 
QtFileGenerator::displayFileGeneratorAttributes(shared_ptr<FileGenerator>& fg)
@@ -158,21 +131,6 @@
        displayFileGeneratorAttributes(fg);
 }
 
-void QtFileGenerator::cbSerializationNameActivated(const QString& s)
-{
-       string fileName = leOutputFileName->text();
-       string ext;
-       if( s == "BINFormatManager")
-               ext = ".yade";
-       else if ( s == "XMLFormatManager")
-               ext = ".xml";
-       else ext = ".unknownFormat";
-       if( filesystem::extension(fileName) != "" )
-       {
-               filesystem::path p = filesystem::change_extension(fileName,ext);
-               leOutputFileName->setText(p.string());
-       }
-}
 
 #include <boost/thread/thread.hpp>
 #include <boost/function.hpp>
@@ -188,7 +146,7 @@
        guiGen.deserialize(m_worker);
 
        m_worker->setFileName(leOutputFileName->text());
-       m_worker->setSerializationLibrary(cbSerializationName->currentText());
+       m_worker->setSerializationLibrary("XMLFormatManager");
                
        m_runner   = shared_ptr<ThreadRunner>(new ThreadRunner(m_worker.get()));
        m_runner->spawnSingleAction();
@@ -219,13 +177,7 @@
                bool 
successfullyGenerated=boost::any_cast<bool>(m_worker->getReturnValue());
                string message=m_worker->message;
 
-               shared_ptr<MessageDialog> md = shared_ptr<MessageDialog>(new 
MessageDialog(string(successfullyGenerated?"SUCCESS:\n\n":"FAILURE!\n\n")+message,
-               #ifdef USE_WORKSPACE
-                       this->parentWidget()->parentWidget()
-               #else
-                       NULL
-               #endif
-               ));
+               shared_ptr<MessageDialog> md = shared_ptr<MessageDialog>(new 
MessageDialog(string(successfullyGenerated?"SUCCESS:\n\n":"FAILURE!\n\n")+message,
 NULL));
                md->exec();
 
                m_worker=shared_ptr<FileGenerator>();
@@ -273,13 +225,7 @@
        string selectedFilter;
        std::vector<string> filters;
        filters.push_back("XML Yade File (*.xml)");
-       string fileName = FileDialog::getOpenFileName(".", filters, "Choose a 
FileGenerator configuration to load", 
-               #ifdef USE_WORKSPACE
-                       this->parentWidget()->parentWidget()
-               #else
-                       NULL
-               #endif
-               , selectedFilter );
+       string fileName = FileDialog::getOpenFileName(".", filters, "Choose a 
FileGenerator configuration to load", NULL, selectedFilter );
        if (       fileName.size()!=0 
                && (selectedFilter == "XML Yade File (*.xml)") 
                && filesystem::exists(fileName) 
@@ -295,18 +241,11 @@
                        if(tmp!="./scene.xml") // this check to avoid resetting 
data, when loading older file.
                        {
                                leOutputFileName->setText(tmp);
-                               
setSerializationName(fg->getSerializationLibrary());
                        }
                } 
                catch(SerializableError& e) // catching it...
                {
-                       shared_ptr<MessageDialog> md = 
shared_ptr<MessageDialog>(new MessageDialog(string("FileGenerator failed to 
load: ") + e.what(),
-                       #ifdef USE_WORKSPACE
-                               this->parentWidget()->parentWidget()
-                       #else
-                               NULL
-                       #endif  
-                               ));
+                       shared_ptr<MessageDialog> md = 
shared_ptr<MessageDialog>(new MessageDialog(string("FileGenerator failed to 
load: ") + e.what(),NULL));
                        md->exec();
                        return;
                }
@@ -320,19 +259,13 @@
        
        guiGen.deserialize(fg);
        fg->setFileName(leOutputFileName->text());
-       fg->setSerializationLibrary(cbSerializationName->currentText());
+       fg->setSerializationLibrary("XMLFormatManager");
        
        string selectedFilter;
        std::vector<string> filters;
        filters.push_back("XML Yade File (*.xml)");
        string title = "Save FileGenerator \"" + fg->getClassName() + "\" 
configuration";
-       string fileName = FileDialog::getSaveFileName(".", filters, title, 
-               #ifdef USE_WORKSPACE
-                       this->parentWidget()->parentWidget()
-               #else
-                       NULL
-               #endif
-       , selectedFilter );
+       string fileName = FileDialog::getSaveFileName(".", filters, title, 
NULL, selectedFilter );
 
        if (       fileName.size()!=0
                && (selectedFilter == "XML Yade File (*.xml)") 
@@ -349,13 +282,7 @@
        }
        else
        {
-               shared_ptr<MessageDialog> md = shared_ptr<MessageDialog>(new 
MessageDialog("Save failed - bad file extension.",
-               #ifdef USE_WORKSPACE
-                       this->parentWidget()->parentWidget()
-               #else
-                       NULL
-               #endif
-               ));
+               shared_ptr<MessageDialog> md = shared_ptr<MessageDialog>(new 
MessageDialog("Save failed - bad file extension.",NULL));
                md->exec(); 
        }
 }

Modified: trunk/gui/qt3/QtFileGenerator.hpp
===================================================================
--- trunk/gui/qt3/QtFileGenerator.hpp   2009-02-23 16:18:55 UTC (rev 1684)
+++ trunk/gui/qt3/QtFileGenerator.hpp   2009-02-23 21:25:32 UTC (rev 1685)
@@ -40,7 +40,6 @@
        public slots :
                virtual void pbChooseClicked(); 
                virtual void cbGeneratorNameActivated(const QString& s);
-               virtual void cbSerializationNameActivated(const QString& s);
                virtual void pbGenerateClicked(); 
                virtual void pbCloseClicked(); // FIXME - stupid qt3-designer. 
This is now "Stop" not "Close"
                virtual void pbLoadClicked();

Modified: trunk/gui/qt3/QtFileGeneratorController.ui
===================================================================
--- trunk/gui/qt3/QtFileGeneratorController.ui  2009-02-23 16:18:55 UTC (rev 
1684)
+++ trunk/gui/qt3/QtFileGeneratorController.ui  2009-02-23 21:25:32 UTC (rev 
1685)
@@ -68,17 +68,6 @@
                 <property name="name">
                     <cstring>unnamed</cstring>
                 </property>
-                <widget class="QLabel" row="1" column="0">
-                    <property name="name">
-                        <cstring>tlOutputDynlibName</cstring>
-                    </property>
-                    <property name="text">
-                        <string>Output Library Name :</string>
-                    </property>
-                    <property name="alignment">
-                        <set>AlignVCenter|AlignRight</set>
-                    </property>
-                </widget>
                 <widget class="QLineEdit" row="0" column="1">
                     <property name="name">
                         <cstring>leOutputFileName</cstring>
@@ -95,11 +84,6 @@
                         <pixmap>image0</pixmap>
                     </property>
                 </widget>
-                <widget class="QComboBox" row="1" column="1" rowspan="1" 
colspan="2">
-                    <property name="name">
-                        <cstring>cbSerializationName</cstring>
-                    </property>
-                </widget>
                 <widget class="QLabel" row="2" column="0">
                     <property name="name">
                         <cstring>tlGeneratorName</cstring>
@@ -329,12 +313,6 @@
         <receiver>QtFileGeneratorController</receiver>
         <slot>pbSaveClicked()</slot>
     </connection>
-    <connection>
-        <sender>cbSerializationName</sender>
-        <signal>activated(const QString&amp;)</signal>
-        <receiver>QtFileGeneratorController</receiver>
-        <slot>cbSerializationNameActivated(const QString&amp;)</slot>
-    </connection>
 </connections>
 <signals>
     <signal>closeSignal()</signal>

Modified: trunk/gui/qt3/SimulationController.cpp
===================================================================
--- trunk/gui/qt3/SimulationController.cpp      2009-02-23 16:18:55 UTC (rev 
1684)
+++ trunk/gui/qt3/SimulationController.cpp      2009-02-23 21:25:32 UTC (rev 
1685)
@@ -222,13 +222,7 @@
        }
        else
        {
-               shared_ptr<MessageDialog> md = shared_ptr<MessageDialog>(new 
MessageDialog("Save aborted (check file extension).",
-               #ifdef USE_WORKSPACE
-                       this->parentWidget()->parentWidget()
-               #else
-                       NULL
-               #endif
-               ));
+               shared_ptr<MessageDialog> md = shared_ptr<MessageDialog>(new 
MessageDialog("Save aborted (check file extension).",NULL));
                md->exec(); 
        }
 }


_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to