← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1754: 1. Do not save potential-only interactions to the XML; do not save pendingErase interactions (are...

 

------------------------------------------------------------
revno: 1754
committer: Václav Šmilauer <vaclav@flux>
branch nick: trunk
timestamp: Wed 2009-09-02 09:32:33 +0200
message:
  1. Do not save potential-only interactions to the XML; do not save pendingErase interactions (are only potential)
  2. Do not save interactions in SQLiteRecorder by default (saveInteractions=True if you want the old behavior)
  3. Add slider to the simulation player, in the "snaps" tab
added:
  gui/qt3/pictures/camera.png
modified:
  core/InteractionContainer.cpp
  gui/qt3/GLSimulationPlayerViewer.cpp
  gui/qt3/GLSimulationPlayerViewer.hpp
  gui/qt3/QtGeneratedSimulationPlayer.ui
  gui/qt3/QtSimulationPlayer.cpp
  gui/qt3/QtSimulationPlayer.hpp
  pkg/dem/Engine/StandAloneEngine/SQLiteRecorder.cpp
  pkg/dem/Engine/StandAloneEngine/SQLiteRecorder.hpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'core/InteractionContainer.cpp'
--- core/InteractionContainer.cpp	2009-08-24 14:59:16 +0000
+++ core/InteractionContainer.cpp	2009-09-02 07:32:33 +0000
@@ -65,10 +65,12 @@
 		interaction.clear(); interaction.reserve(this->size());
 		InteractionContainer::iterator i    = this->begin();
 		InteractionContainer::iterator iEnd = this->end();
-		for( ; i!=iEnd ; ++i )
-			interaction.push_back(*i);
+		for( ; i!=iEnd ; ++i ){
+			if((*i)->interactionGeometry || (*i)->interactionPhysics) interaction.push_back(*i);
+		}
 		if(serializeSorted) std::sort(interaction.begin(),interaction.end(),compPtrInteraction());
-		#ifdef YADE_OPENMP
+		// since requestErase'd interactions have no interaction physics/geom, they were not saved anyway
+		#if 0 // ifdef YADE_OPENMP
 			// copy per-thread erasable pairs to the global attribute that will be serialized
 			FOREACH(const list<bodyIdPair>& threadPendingErase, threadsPendingErase){ pendingErase.insert(pendingErase.end(),threadPendingErase.begin(),threadPendingErase.end()); }
 		#endif
@@ -86,10 +88,12 @@
 		for( ; it != itEnd ; ++it)
 			this->insert(*it);
 		interaction.clear();
-		#ifdef YADE_OPENMP
+		#if 0 // ifdef YADE_OPENMP
 			// copy global deserialized pairs to be erased to the list of thread #0
 			threadsPendingErase[0].insert(threadsPendingErase[0].end(),pendingErase.begin(),pendingErase.end());
 		#endif
+		// forc compatibility, if the list was saved
+		pendingErase.clear();
 	}
 	else
 	{

=== modified file 'gui/qt3/GLSimulationPlayerViewer.cpp'
--- gui/qt3/GLSimulationPlayerViewer.cpp	2009-08-21 10:06:00 +0000
+++ gui/qt3/GLSimulationPlayerViewer.cpp	2009-09-02 07:32:33 +0000
@@ -25,6 +25,7 @@
 #include<yade/lib-opengl/OpenGLWrapper.hpp>
 #include<yade/pkg-common/FilterEngine.hpp>
 #include<qspinbox.h>
+#include<qslider.h>
 #include"QtSimulationPlayer.hpp"
 
 
@@ -152,7 +153,7 @@
 			if(dIter->leaf().find(inputBaseName)!=0 || filesystem::extension(*dIter)==".rgb" || algorithm::ends_with(dIter->string(),".rgb.bz2") || filesystem::is_directory(*dIter) || !filesystem::exists(*dIter)) continue;
 			xyzNames.push_back(dIter->string());
 		}
-		xyzNames.sort();
+		std::sort(xyzNames.begin(),xyzNames.end());
 	} else { /* load from sqlite database */
 		LOG_INFO("Opening sqlite database `"<<fileName<<"'");
 		con=shared_ptr<sqlite3x::sqlite3_connection>(new sqlite3x::sqlite3_connection(fileName));
@@ -161,8 +162,8 @@
 		simPlayer->pushMessage("Database OK, loading simulation...");
 		// load simulation
 		string xml=con->executestring("select simulationXML from 'meta';");
+		istringstream xmlStream(xml); Omega::instance().loadSimulationFromStream(xmlStream);
 		simPlayer->pushMessage("Simulation loaded.");
-		istringstream xmlStream(xml); Omega::instance().loadSimulationFromStream(xmlStream);
 		{
 			sqlite3x::sqlite3_command cmd(*con,"select bodyTable,iter from 'records' ORDER BY iter;");
 			sqlite3x::sqlite3_cursor reader=cmd.executecursor();
@@ -174,7 +175,7 @@
 				maxIter=reader.getint(1);
 			}
 			Omega::instance().getRootBody()->stopAtIteration=maxIter;
-			LOG_INFO("Setting stopAtIter="<<maxIter);
+			LOG_DEBUG("Setting stopAtIter="<<maxIter);
 		}
 	}
 	/* Filters */
@@ -182,7 +183,7 @@
 
 	/* strided access is common for both db and file access */
 	if(stride>1){
-		list<string> xyz2;
+		vector<string> xyz2;
 		long i=stride-1;
 		FOREACH(string f,xyzNames){
 			if(i++<stride-1) continue;
@@ -192,7 +193,8 @@
 		xyzNames=xyz2;
 	}
 	simPlayer->pushMessage("Found "+lexical_cast<string>(xyzNames.size())+" states to process.");
-	xyzNamesIter=xyzNames.begin();
+	simPlayer->frameSlider->setMinValue(0); simPlayer->frameSlider->setMaxValue(xyzNames.size()-1);
+	xyzNamesPos=0;
 	simPlayer->enableControls(true);
 	updateGL();
 }
@@ -209,7 +211,7 @@
 {
 	frameNumber=0;
 	setSnapshotCounter(0);
-	xyzNamesIter=xyzNames.begin();
+	xyzNamesPos=0;
 	loadNextRecordedData();
 	frameNumber++;
 	updateGL();
@@ -229,10 +231,14 @@
 
 
 bool GLSimulationPlayerViewer::loadNextRecordedData(){
-	if(xyzNamesIter==xyzNames.end()) return false;
+	return loadRecordedData(xyzNamesPos++);
+}
+
+bool GLSimulationPlayerViewer::loadRecordedData(size_t pos){
+	if(pos>xyzNames.size()-1) return false;
 	MetaBody* rootBody=Omega::instance().getRootBody().get();
 	if(!useSQLite){
-		fileName=*(xyzNamesIter++);
+		fileName=xyzNames[pos];
 		iostreams::filtering_istream f; if(boost::algorithm::ends_with(fileName,".bz2")) f.push(iostreams::bzip2_decompressor()); f.push(iostreams::file_source(fileName));
 		// strip .bz2 from the filename
 		if(boost::algorithm::ends_with(fileName,".bz2")) algorithm::replace_last(fileName,".bz2","");
@@ -259,7 +265,7 @@
 		}
 		Omega::instance().setCurrentIteration(atoi(fileName.substr(fileName.rfind('_')+1).c_str()));
 	} else {
-		string tableName=*(xyzNamesIter++);
+		string tableName=xyzNames[pos];
 		simPlayer->pushMessage(lexical_cast<string>(frameNumber)+"/"+lexical_cast<string>(xyzNames.size())+" "+tableName);
 		sqlite3x::sqlite3_command cmd(*con,"select * from '"+tableName+"';");
 		sqlite3x::sqlite3_cursor reader=cmd.executecursor();
@@ -271,8 +277,9 @@
 			ASSIGN_COL(id) else ASSIGN_COL(se3_x) else ASSIGN_COL(se3_y) else ASSIGN_COL(se3_z) else ASSIGN_COL(se3_ori0) else ASSIGN_COL(se3_ori1) else ASSIGN_COL(se3_ori2) else ASSIGN_COL(se3_ori3) else ASSIGN_COL(rgb_r) else ASSIGN_COL(rgb_g) else ASSIGN_COL(rgb_b) else LOG_ERROR("Unhandled column name: '"<<col<<"'");
 		}
 		assert(col_id>=0);
+		MetaBody* rb=Omega::instance().getRootBody().get();
 		while(reader.step()){
-			const shared_ptr<Body>& b=Body::byId(reader.getint(col_id));
+			const shared_ptr<Body>& b=Body::byId(reader.getint(col_id),rb);
 			Se3r& se3=b->physicalParameters->se3;
 			if(col_se3_x>=0) se3.position[0]=reader.getdouble(col_se3_x);
 			if(col_se3_y>=0) se3.position[1]=reader.getdouble(col_se3_y);

=== modified file 'gui/qt3/GLSimulationPlayerViewer.hpp'
--- gui/qt3/GLSimulationPlayerViewer.hpp	2009-02-01 15:45:18 +0000
+++ gui/qt3/GLSimulationPlayerViewer.hpp	2009-09-02 07:32:33 +0000
@@ -41,9 +41,10 @@
 		int frameNumber;
 		int stride;
  		bool loadNextRecordedData();
+ 		bool loadRecordedData(size_t pos);
  		//! filenames or table names (if useSQLite)
- 		list<string> xyzNames;
- 		list<string>::iterator xyzNamesIter;
+ 		vector<string> xyzNames;
+ 		size_t xyzNamesPos;
 		vector< shared_ptr< FilterEngine > > filters;
 	public :
 		GLSimulationPlayerViewer(QWidget* parent,shared_ptr<OpenGLRenderingEngine> renderer);

=== modified file 'gui/qt3/QtGeneratedSimulationPlayer.ui'
--- gui/qt3/QtGeneratedSimulationPlayer.ui	2009-02-09 20:50:44 +0000
+++ gui/qt3/QtGeneratedSimulationPlayer.ui	2009-09-02 07:32:33 +0000
@@ -8,8 +8,8 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>362</width>
-            <height>430</height>
+            <width>404</width>
+            <height>442</height>
         </rect>
     </property>
     <property name="sizePolicy">
@@ -357,7 +357,7 @@
                                         <property name="sizeHint">
                                             <size>
                                                 <width>20</width>
-                                                <height>31</height>
+                                                <height>207</height>
                                             </size>
                                         </property>
                                     </spacer>
@@ -376,9 +376,6 @@
                             <property name="name">
                                 <cstring>unnamed</cstring>
                             </property>
-                            <property name="margin">
-                                <number>0</number>
-                            </property>
                             <widget class="QFrame" row="0" column="0">
                                 <property name="name">
                                     <cstring>frame4</cstring>
@@ -395,151 +392,209 @@
                                     </property>
                                     <widget class="QLayoutWidget" row="0" column="0">
                                         <property name="name">
-                                            <cstring>layout4</cstring>
+                                            <cstring>layout10</cstring>
                                         </property>
-                                        <grid>
+                                        <vbox>
                                             <property name="name">
                                                 <cstring>unnamed</cstring>
                                             </property>
-                                            <property name="margin">
-                                                <number>0</number>
-                                            </property>
-                                            <property name="spacing">
-                                                <number>0</number>
-                                            </property>
-                                            <widget class="QLabel" row="2" column="0">
-                                                <property name="name">
-                                                    <cstring>tlOutputDirectory</cstring>
-                                                </property>
-                                                <property name="sizePolicy">
-                                                    <sizepolicy>
-                                                        <hsizetype>4</hsizetype>
-                                                        <vsizetype>5</vsizetype>
-                                                        <horstretch>0</horstretch>
-                                                        <verstretch>0</verstretch>
-                                                    </sizepolicy>
-                                                </property>
-                                                <property name="text">
-                                                    <string>Directory:</string>
-                                                </property>
-                                            </widget>
-                                            <widget class="QLineEdit" row="2" column="1">
-                                                <property name="name">
-                                                    <cstring>leOutputDirectory</cstring>
-                                                </property>
-                                                <property name="sizePolicy">
-                                                    <sizepolicy>
-                                                        <hsizetype>1</hsizetype>
-                                                        <vsizetype>1</vsizetype>
-                                                        <horstretch>0</horstretch>
-                                                        <verstretch>0</verstretch>
-                                                    </sizepolicy>
-                                                </property>
-                                                <property name="text">
-                                                    <string>/tmp</string>
-                                                </property>
-                                            </widget>
-                                            <widget class="QPushButton" row="2" column="2">
-                                                <property name="name">
-                                                    <cstring>pbOutputDirectory</cstring>
-                                                </property>
-                                                <property name="sizePolicy">
-                                                    <sizepolicy>
-                                                        <hsizetype>0</hsizetype>
-                                                        <vsizetype>0</vsizetype>
-                                                        <horstretch>0</horstretch>
-                                                        <verstretch>0</verstretch>
-                                                    </sizepolicy>
-                                                </property>
-                                                <property name="text">
-                                                    <string></string>
-                                                </property>
-                                                <property name="pixmap">
-                                                    <pixmap>image0</pixmap>
-                                                </property>
-                                            </widget>
-                                            <widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="2">
-                                                <property name="name">
-                                                    <cstring>leOutputBaseName</cstring>
-                                                </property>
-                                                <property name="sizePolicy">
-                                                    <sizepolicy>
-                                                        <hsizetype>1</hsizetype>
-                                                        <vsizetype>1</vsizetype>
-                                                        <horstretch>0</horstretch>
-                                                        <verstretch>0</verstretch>
-                                                    </sizepolicy>
-                                                </property>
-                                                <property name="text">
-                                                    <string>frame-</string>
-                                                </property>
-                                            </widget>
-                                            <widget class="QLabel" row="1" column="0">
-                                                <property name="name">
-                                                    <cstring>tlOuputBaseName</cstring>
-                                                </property>
-                                                <property name="sizePolicy">
-                                                    <sizepolicy>
-                                                        <hsizetype>4</hsizetype>
-                                                        <vsizetype>5</vsizetype>
-                                                        <horstretch>0</horstretch>
-                                                        <verstretch>0</verstretch>
-                                                    </sizepolicy>
-                                                </property>
-                                                <property name="text">
-                                                    <string>Base Name:</string>
-                                                </property>
-                                            </widget>
-                                            <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="3">
-                                                <property name="name">
-                                                    <cstring>cbSaveSnapShots</cstring>
-                                                </property>
-                                                <property name="enabled">
-                                                    <bool>true</bool>
-                                                </property>
-                                                <property name="sizePolicy">
-                                                    <sizepolicy>
-                                                        <hsizetype>1</hsizetype>
-                                                        <vsizetype>1</vsizetype>
-                                                        <horstretch>0</horstretch>
-                                                        <verstretch>0</verstretch>
-                                                    </sizepolicy>
-                                                </property>
-                                                <property name="minimumSize">
+                                            <widget class="QLayoutWidget">
+                                                <property name="name">
+                                                    <cstring>layout4</cstring>
+                                                </property>
+                                                <grid>
+                                                    <property name="name">
+                                                        <cstring>unnamed</cstring>
+                                                    </property>
+                                                    <property name="margin">
+                                                        <number>0</number>
+                                                    </property>
+                                                    <property name="spacing">
+                                                        <number>0</number>
+                                                    </property>
+                                                    <widget class="QLabel" row="2" column="0">
+                                                        <property name="name">
+                                                            <cstring>tlOutputDirectory</cstring>
+                                                        </property>
+                                                        <property name="sizePolicy">
+                                                            <sizepolicy>
+                                                                <hsizetype>4</hsizetype>
+                                                                <vsizetype>5</vsizetype>
+                                                                <horstretch>0</horstretch>
+                                                                <verstretch>0</verstretch>
+                                                            </sizepolicy>
+                                                        </property>
+                                                        <property name="text">
+                                                            <string>Directory:</string>
+                                                        </property>
+                                                    </widget>
+                                                    <widget class="QLineEdit" row="2" column="1">
+                                                        <property name="name">
+                                                            <cstring>leOutputDirectory</cstring>
+                                                        </property>
+                                                        <property name="sizePolicy">
+                                                            <sizepolicy>
+                                                                <hsizetype>1</hsizetype>
+                                                                <vsizetype>1</vsizetype>
+                                                                <horstretch>0</horstretch>
+                                                                <verstretch>0</verstretch>
+                                                            </sizepolicy>
+                                                        </property>
+                                                        <property name="text">
+                                                            <string>/tmp</string>
+                                                        </property>
+                                                    </widget>
+                                                    <widget class="QPushButton" row="2" column="2">
+                                                        <property name="name">
+                                                            <cstring>pbOutputDirectory</cstring>
+                                                        </property>
+                                                        <property name="sizePolicy">
+                                                            <sizepolicy>
+                                                                <hsizetype>0</hsizetype>
+                                                                <vsizetype>0</vsizetype>
+                                                                <horstretch>0</horstretch>
+                                                                <verstretch>0</verstretch>
+                                                            </sizepolicy>
+                                                        </property>
+                                                        <property name="text">
+                                                            <string></string>
+                                                        </property>
+                                                        <property name="pixmap">
+                                                            <pixmap>image0</pixmap>
+                                                        </property>
+                                                    </widget>
+                                                    <widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="2">
+                                                        <property name="name">
+                                                            <cstring>leOutputBaseName</cstring>
+                                                        </property>
+                                                        <property name="sizePolicy">
+                                                            <sizepolicy>
+                                                                <hsizetype>1</hsizetype>
+                                                                <vsizetype>1</vsizetype>
+                                                                <horstretch>0</horstretch>
+                                                                <verstretch>0</verstretch>
+                                                            </sizepolicy>
+                                                        </property>
+                                                        <property name="text">
+                                                            <string>frame-</string>
+                                                        </property>
+                                                    </widget>
+                                                    <widget class="QLabel" row="1" column="0">
+                                                        <property name="name">
+                                                            <cstring>tlOuputBaseName</cstring>
+                                                        </property>
+                                                        <property name="sizePolicy">
+                                                            <sizepolicy>
+                                                                <hsizetype>4</hsizetype>
+                                                                <vsizetype>5</vsizetype>
+                                                                <horstretch>0</horstretch>
+                                                                <verstretch>0</verstretch>
+                                                            </sizepolicy>
+                                                        </property>
+                                                        <property name="text">
+                                                            <string>Base Name:</string>
+                                                        </property>
+                                                    </widget>
+                                                    <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="3">
+                                                        <property name="name">
+                                                            <cstring>cbSaveSnapShots</cstring>
+                                                        </property>
+                                                        <property name="enabled">
+                                                            <bool>true</bool>
+                                                        </property>
+                                                        <property name="sizePolicy">
+                                                            <sizepolicy>
+                                                                <hsizetype>1</hsizetype>
+                                                                <vsizetype>1</vsizetype>
+                                                                <horstretch>0</horstretch>
+                                                                <verstretch>0</verstretch>
+                                                            </sizepolicy>
+                                                        </property>
+                                                        <property name="minimumSize">
+                                                            <size>
+                                                                <width>0</width>
+                                                                <height>0</height>
+                                                            </size>
+                                                        </property>
+                                                        <property name="text">
+                                                            <string>Automatically save snapshots</string>
+                                                        </property>
+                                                        <property name="checked">
+                                                            <bool>false</bool>
+                                                        </property>
+                                                        <property name="tristate">
+                                                            <bool>false</bool>
+                                                        </property>
+                                                    </widget>
+                                                </grid>
+                                            </widget>
+                                            <spacer>
+                                                <property name="name">
+                                                    <cstring>spacer3</cstring>
+                                                </property>
+                                                <property name="orientation">
+                                                    <enum>Vertical</enum>
+                                                </property>
+                                                <property name="sizeType">
+                                                    <enum>Expanding</enum>
+                                                </property>
+                                                <property name="sizeHint">
                                                     <size>
-                                                        <width>0</width>
-                                                        <height>0</height>
+                                                        <width>20</width>
+                                                        <height>192</height>
                                                     </size>
                                                 </property>
-                                                <property name="text">
-                                                    <string>Save snapshots</string>
-                                                </property>
-                                                <property name="checked">
-                                                    <bool>false</bool>
-                                                </property>
-                                                <property name="tristate">
-                                                    <bool>false</bool>
-                                                </property>
+                                            </spacer>
+                                            <widget class="QLayoutWidget">
+                                                <property name="name">
+                                                    <cstring>layout7</cstring>
+                                                </property>
+                                                <hbox>
+                                                    <property name="name">
+                                                        <cstring>unnamed</cstring>
+                                                    </property>
+                                                    <widget class="QSlider">
+                                                        <property name="name">
+                                                            <cstring>frameSlider</cstring>
+                                                        </property>
+                                                        <property name="sizePolicy">
+                                                            <sizepolicy>
+                                                                <hsizetype>3</hsizetype>
+                                                                <vsizetype>0</vsizetype>
+                                                                <horstretch>0</horstretch>
+                                                                <verstretch>0</verstretch>
+                                                            </sizepolicy>
+                                                        </property>
+                                                        <property name="tracking">
+                                                            <bool>false</bool>
+                                                        </property>
+                                                        <property name="orientation">
+                                                            <enum>Horizontal</enum>
+                                                        </property>
+                                                    </widget>
+                                                    <widget class="QPushButton">
+                                                        <property name="name">
+                                                            <cstring>takeShotButton</cstring>
+                                                        </property>
+                                                        <property name="sizePolicy">
+                                                            <sizepolicy>
+                                                                <hsizetype>0</hsizetype>
+                                                                <vsizetype>0</vsizetype>
+                                                                <horstretch>0</horstretch>
+                                                                <verstretch>0</verstretch>
+                                                            </sizepolicy>
+                                                        </property>
+                                                        <property name="text">
+                                                            <string></string>
+                                                        </property>
+                                                        <property name="pixmap">
+                                                            <pixmap>image1</pixmap>
+                                                        </property>
+                                                    </widget>
+                                                </hbox>
                                             </widget>
-                                        </grid>
+                                        </vbox>
                                     </widget>
-                                    <spacer row="1" column="0">
-                                        <property name="name">
-                                            <cstring>spacer3</cstring>
-                                        </property>
-                                        <property name="orientation">
-                                            <enum>Vertical</enum>
-                                        </property>
-                                        <property name="sizeType">
-                                            <enum>Expanding</enum>
-                                        </property>
-                                        <property name="sizeHint">
-                                            <size>
-                                                <width>20</width>
-                                                <height>41</height>
-                                            </size>
-                                        </property>
-                                    </spacer>
                                 </grid>
                             </widget>
                         </grid>
@@ -596,7 +651,7 @@
                                                     <string></string>
                                                 </property>
                                                 <property name="pixmap">
-                                                    <pixmap>image1</pixmap>
+                                                    <pixmap>image2</pixmap>
                                                 </property>
                                             </widget>
                                         </hbox>
@@ -732,7 +787,7 @@
                                 <string></string>
                             </property>
                             <property name="pixmap">
-                                <pixmap>image1</pixmap>
+                                <pixmap>image2</pixmap>
                             </property>
                         </widget>
                         <widget class="QPushButton" row="0" column="2">
@@ -743,7 +798,7 @@
                                 <string></string>
                             </property>
                             <property name="pixmap">
-                                <pixmap>image2</pixmap>
+                                <pixmap>image3</pixmap>
                             </property>
                         </widget>
                         <widget class="QPushButton" row="0" column="1">
@@ -754,7 +809,7 @@
                                 <string></string>
                             </property>
                             <property name="pixmap">
-                                <pixmap>image3</pixmap>
+                                <pixmap>image4</pixmap>
                             </property>
                         </widget>
                         <widget class="QPushButton" row="0" column="0">
@@ -765,7 +820,7 @@
                                 <string></string>
                             </property>
                             <property name="pixmap">
-                                <pixmap>image4</pixmap>
+                                <pixmap>image5</pixmap>
                             </property>
                         </widget>
                     </grid>
@@ -779,15 +834,18 @@
         <data format="PNG" length="892">89504e470d0a1a0a0000000d4948445200000018000000180806000000e0773df800000343494441544889ed95cf6f146518c73f5d5a8b96a5ab6de84230b6b02858b134023d28743de8414d6a8c7f01ff801aaf24c24d2f0ac6709693f1a0f5e4c5c42e8907f560a736c4d616322dd275b7753bdb617766f6fdf17898e9b26db798102f263ec924cfccfbe4f3fd3ecffb2403ffc743c408f00e3099493fbafefc338704986a53370e7c909c6dd6f46e2fea68c92780cfcf9d3e92397f26c7f8991ce363c748a552bcffe1249f5e2f5c023ce0cdde7d7bf3e74e1fe5a5178ef0daf967393cd0cbb52f7ee0e2d56f2f0197771398aafc319b4ffbdfd3914a01202288152a5e8deb5fff8888f0e2e810c3b92cc65a8cb1186dd0da50a9d6197dfb6307186d15e86c7df1aa1efb3ac03434d65aac8d018fa4e0c25b679b40dfafa38dc1688bd686a8a1d0da72b03f7daab8e64f259dbe0b2cb50a384b6595ef4f871863304630d6a055ecb01d501bc37a790d43378ff53dc5b5cfae706ae444fe9bafbee4bd8b571de072ab80e7380ec363d0084394d2281d0b6c07d6ea0d0e0c8d923994e3f8cbc364d25d1094e347cde3955c0077fb880a9ee761f61cc6f7570942454369362a1eb55a83fd0347c9648f317af669b2d9be045882fa34d40191982250f8690ea0b0e30e5cd7258a0ee0fb012b772b3c79f2154e8e3d4736fb440c0bca102d4269710b50442059082b961b3fcf7bc0d27601d7755d3a7bdee0aefb1df90b1f9131b720b809c5c4e12633015a2b8858ac3548b214337377009c765bb404201d5d74f6f493e98e60b5747f5d45106b6390c430b1a6b96db1806171b9d81ccf8e1101186bd9d3bd1fa915b15a379dd90420d292b7f9eefcb6bc85b745c07166101106064fa0c27be830481c9b16973be156ee9f19ad77efa05aad22081beb1542df60a260db185af264f69bc2c618b4d6fcba50dcbd03e2dd1ddcdb9326dc28b5779d8063a0a1d1d0440d451429eefc59e5e6ad32c08ddd054406b343c78956969b176713874a1b948a6161a49873d798febd84b350667671955aa80ac0950775c0bd0d9f747f1f4150472b4d4369c22886ce2dad313d5f6266a1cceced55af1628279977a1d5f503051e3f98a3abd3e216ffe297f9620c5c2c737ba5ead502b5092b0033ed80ff149f4c4cbc2eafe6c704580726897f3e230f03db2dc6ff6de07f3bfe067d9f88db21915f870000000049454e44ae426082</data>
     </image>
     <image name="image1">
+        <data format="PNG" length="249">89504e470d0a1a0a0000000d494844520000001c0000001408060000009e5e5df9000000c0494441544889d594b10dc2301045dfa1d000125e860118230c9005c218b04006c06bd0b38c29e8904ce1940e3e4b17147e63cbf7f5bff4efcef063483a42cc979d581baeac0517675888d41a4e9ab9a463dcaf8186314591e70b668c5444deb9f75a430f1cc7e9dda53b3e478c316e72fa353d3c83bbe64ba1072e6509275a430feef49d126e405b32d4463a1871d43d7c187196fbd31c8c386ac3ce88a3366cc7d19f40e8294e6842ed5fea8101dc1dc2961463a735abd94323e8f7f07ff1015d78278ed7475e150000000049454e44ae426082</data>
+    </image>
+    <image name="image2">
         <data format="PNG" length="305">89504e470d0a1a0a0000000d4948445200000015000000150806000000a917a596000000f849444154388db5943b12823010863f1f95158de839b0f5021ec00bd8702b8f2117e0326ab38d54385a844748086c66f49f49917d7c2cc966412501e4a38b85a536b081abc01350c9405e0dc882cd831701600daca6539340ae57a9a44d2533c069b9bf7f77f605706e96ad83922fb5a9b25bb9e5a3b7ab2559183880c6744b7bcbf201b945248eaafdf2c6b25d7f05b555fe03fafc07741b8790fdf092c7a1c7c8c2bcf8165a59b64b24d48eb739737d1a92e44e5ee6064cbc2815b06e3dcea4f19e6181e9db12d3155bcc195e80d330b49f5a2e34c51f2a1aed207904a01d5c314f017843b2768d810191ac31e3ad1af75319bf0f04f8024c83732f0a67978c0000000049454e44ae426082</data>
     </image>
-    <image name="image2">
+    <image name="image3">
         <data format="PNG" length="113">89504e470d0a1a0a0000000d4948445200000015000000150806000000a917a5960000003849444154388d633c76ec1803b50113d54da495a12cd804adacb4fe23f38f1dbbc6488c1c0c0c1def8f1a3a6ae8a8a123d350c6915df203007bf20ccfb0566fcb0000000049454e44ae426082</data>
     </image>
-    <image name="image3">
+    <image name="image4">
         <data format="PNG" length="255">89504e470d0a1a0a0000000d4948445200000015000000150806000000a917a596000000c649444154388db594d90a83400c458f0bd28542feff9ffa2f81822fadda87d176d4319d14bd20e38470b22a1c2fbd8ce7109e8fbdf050caf9555ad07bc2cf051d9db50679cdb30310176cd298690a98d2e4a37506340b5847bebdd5e7320f0840b778b7a0b99265f02ee9b68e660d4acb34683d4cb3e10b3569b30e7c073e80abfced72819ea86a0fd49014c0754f68153e6f79ec053d8743dad8e818943c41e3fb1e7b3a0b60fe13fe819e4037d62bc8b3a7004d6883adcc4cf516cedf4007942ad3ef38bd01af6e31af98932e9f0000000049454e44ae426082</data>
     </image>
-    <image name="image4">
+    <image name="image5">
         <data format="PNG" length="160">89504e470d0a1a0a0000000d4948445200000015000000150806000000a917a5960000006749444154388dadccd10d80300c03d1947118a1fbcb23b00e2c4013dbc9fd9ef4168098eecae6def73b8eba70893a3085aa308d2ab084b2b08c32b08556b08d66700b3dc16d1478d628fa07b6d01368a31968a11528a30c28a12c48a30a48a12a58a20e1811f101d3512a7c38fee1ac0000000049454e44ae426082</data>
     </image>
 </images>
@@ -864,7 +922,22 @@
         <receiver>QtGeneratedSimulationPlayer</receiver>
         <slot>pbApplyClicked()</slot>
     </connection>
+    <connection>
+        <sender>takeShotButton</sender>
+        <signal>pressed()</signal>
+        <receiver>QtGeneratedSimulationPlayer</receiver>
+        <slot>onTakeShotButtonPressed()</slot>
+    </connection>
+    <connection>
+        <sender>frameSlider</sender>
+        <signal>valueChanged(int)</signal>
+        <receiver>QtGeneratedSimulationPlayer</receiver>
+        <slot>onFrameSliderValueChanged(int)</slot>
+    </connection>
 </connections>
+<includes>
+    <include location="local" impldecl="in implementation">QtGeneratedSimulationPlayer.ui.h</include>
+</includes>
 <signals>
     <signal>closeSignal()</signal>
 </signals>
@@ -877,11 +950,14 @@
     <slot>pbStepClicked()</slot>
     <slot>pbResetClicked()</slot>
     <slot>pbInputConfigFileClicked()</slot>
-    <slot>cbSaveSnapShotsToggled(bool)</slot>
-    <slot>cbAllowFiltrationToggled(bool)</slot>
-    <slot>cbBodyWireToggled(bool)</slot>
+    <slot>cbSaveSnapShotsToggled( bool )</slot>
+    <slot>cbAllowFiltrationToggled( bool )</slot>
+    <slot>cbBodyWireToggled( bool )</slot>
     <slot>pbRefreshFiltersClicked()</slot>
     <slot>pbApplyClicked()</slot>
+    <slot>onTakeShotButtonPressed()</slot>
+    <slot>frameSlider_valueChanged( int )</slot>
+    <slot>onFrameSliderValueChanged( int )</slot>
 </slots>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>

=== modified file 'gui/qt3/QtSimulationPlayer.cpp'
--- gui/qt3/QtSimulationPlayer.cpp	2009-06-18 03:53:23 +0000
+++ gui/qt3/QtSimulationPlayer.cpp	2009-09-02 07:32:33 +0000
@@ -16,6 +16,7 @@
 #include <qspinbox.h>
 #include<qlabel.h>
 #include<qstring.h>
+#include<qslider.h>
 
 #include<yade/gui-qt3/YadeQtMainWindow.hpp>
 CREATE_LOGGER(QtSimulationPlayer);
@@ -49,6 +50,8 @@
 	scrollViewFrame->resize(s.width(),s.height());
 	guiGen.buildGUI(YadeQtMainWindow::self->renderer,scrollViewFrame);
 	scrollView->addChild(scrollViewFrame);
+	frameSlider->setMinValue(0);
+	frameSlider->setMaxValue(0);
 }
 QtSimulationPlayer::~QtSimulationPlayer(){
 	if(glSimulationPlayerViewer) delete glSimulationPlayerViewer;
@@ -68,6 +71,33 @@
 	YadeQtMainWindow::self->redrawAll(true);
 }
 
+void QtSimulationPlayer::onFrameSliderValueChanged(int value){
+	LOG_INFO("Will load state #"<<value<<" now.");
+	glSimulationPlayerViewer->loadRecordedData(value);
+	glSimulationPlayerViewer->updateGL();
+}
+
+void QtSimulationPlayer::onTakeShotButtonPressed(){
+	GLSimulationPlayerViewer* glpv=glSimulationPlayerViewer;
+	glpv->setSnapshotFormat("PNG");
+	string snapBase=string(leOutputDirectory->text().ascii())+"/"+leOutputBaseName->text().ascii(); int counter=0;
+	string snapName;
+	do{
+		ostringstream fss; fss<<snapBase<<"-single-"<<setw(4)<<setfill('0')<<counter++<<".png";
+		snapName=fss.str();
+	} while(filesystem::exists(snapName));
+	LOG_INFO("Taking snapshot into "<<snapName);
+	glpv->nextFrameSnapshotFilename=snapName;
+	glpv->updateGL();
+	// wait for the renderer to save the frame (will happen at next postDraw)
+	timespec t1,t2; t1.tv_sec=0; t1.tv_nsec=10000000; /* 10 ms */
+	long waiting=0;
+	while(!glpv->nextFrameSnapshotFilename.empty()){
+		nanosleep(&t1,&t2);
+		if(((++waiting) % 1000)==0) LOG_WARN("Already waiting "<<waiting/100<<"s for snapshot to be saved. Something went wrong?");
+	}
+}
+
 void QtSimulationPlayer::pbInputConfigFileClicked(){
 	string selectedFilter;
 	std::vector<string> filters;

=== modified file 'gui/qt3/QtSimulationPlayer.hpp'
--- gui/qt3/QtSimulationPlayer.hpp	2009-07-29 19:05:42 +0000
+++ gui/qt3/QtSimulationPlayer.hpp	2009-09-02 07:32:33 +0000
@@ -52,7 +52,9 @@
 		virtual void pbApplyClicked();
 		
 		virtual void cbAllowFiltrationToggled(bool b);
-        virtual void pbRefreshFiltersClicked();
+      virtual void pbRefreshFiltersClicked();
+		virtual void onFrameSliderValueChanged(int value);
+		virtual void onTakeShotButtonPressed();
 		
 	protected:
 		void closeEvent(QCloseEvent *);

=== added file 'gui/qt3/pictures/camera.png'
Binary files gui/qt3/pictures/camera.png	1970-01-01 00:00:00 +0000 and gui/qt3/pictures/camera.png	2009-09-02 07:32:33 +0000 differ
=== modified file 'pkg/dem/Engine/StandAloneEngine/SQLiteRecorder.cpp'
--- pkg/dem/Engine/StandAloneEngine/SQLiteRecorder.cpp	2009-08-03 10:02:11 +0000
+++ pkg/dem/Engine/StandAloneEngine/SQLiteRecorder.cpp	2009-09-02 07:32:33 +0000
@@ -28,7 +28,12 @@
 	con->executenonquery("PRAGMA synchronous = OFF");
 	// create supertable (only if the db is empty)
 	if(0==con->executeint("select count(*) from sqlite_master where name='meta';")){
+		shared_ptr<InteractionContainer> intrs;
+		if(!saveInteractions){
+			intrs=rootBody->interactions; rootBody->interactions=shared_ptr<InteractionContainer>();
+		}
 		LOG_DEBUG("Saving simulation to stream"); ostringstream out; Omega::instance().saveSimulationToStream(out);
+		if(!saveInteractions){ rootBody->interactions=intrs; }
 		con->executenonquery("create table meta (simulationXML STRING,maxIter INTEGER)");
 		LOG_DEBUG("Inserting simulation XML into the table 'meta'");
 		{ sqlite3x::sqlite3_command cmd(*con,"insert into meta values (?,-1)"); cmd.bind(1,out.str()); cmd.executenonquery(); }

=== modified file 'pkg/dem/Engine/StandAloneEngine/SQLiteRecorder.hpp'
--- pkg/dem/Engine/StandAloneEngine/SQLiteRecorder.hpp	2009-05-01 14:47:26 +0000
+++ pkg/dem/Engine/StandAloneEngine/SQLiteRecorder.hpp	2009-09-02 07:32:33 +0000
@@ -39,13 +39,17 @@
 		shared_ptr<sqlite3x::sqlite3_connection> con;
 	public:
 		enum {REC_SE3=0,REC_RGB,REC_SENTINEL};
+		//! List of recorders that will be used
 		vector<string> recorders;
+		//! If false (default), interactions will not be saved to the initial XML inside the database
+		bool saveInteractions;
+		//! Filename of the database to save to
 		string dbFile;
-		SQLiteRecorder() { /* we always want to save the first state as well */ initRun=true; };
+		SQLiteRecorder(): saveInteractions(false) { /* we always want to save the first state as well */ initRun=true; };
 		~SQLiteRecorder(){ if(con) con->close(); }
 		void init(MetaBody*);
 		virtual void action(MetaBody*);
-	REGISTER_ATTRIBUTES(PeriodicEngine,(recorders)(dbFile));
+	REGISTER_ATTRIBUTES(PeriodicEngine,(recorders)(dbFile)(saveInteractions));
 	REGISTER_CLASS_AND_BASE(SQLiteRecorder,PeriodicEngine);
 	DECLARE_LOGGER;
 };