------------------------------------------------------------------------
r1463 | eudoxos | 2008-08-12 17:44:10 +0200 (wto, 12 sie 2008) | 4 lines
Changed paths:
M /trunk/extra/Brefcom.cpp
M /trunk/gui/qt3/QtFileGenerator.cpp
M /trunk/gui/qt3/SimulationController.cpp
M /trunk/gui/qt3/YadeQtMainWindow.cpp
1. Fix refresh period: use it for regular GL rendering as well
2. Make "open automatically" open generated simulation even if a simulation is
already loaded
3. Fix crasher (on some machines) the close() was emitted 2× for QtFileGenerato
------------------------------------------------------------------------
Index: extra/Brefcom.cpp
===================================================================
--- extra/Brefcom.cpp (revision 1462)
+++ extra/Brefcom.cpp (revision 1463)
@@ -252,7 +252,7 @@
if(omega>omegaThreshold){
I->isReal=false;
if(BC->isCohesive){rbp1->numBrokenCohesive+=1;
rbp2->numBrokenCohesive+=1;}
- LOG_INFO("Contact #"<<id1<<"=#"<<id2<<" is damaged over
thershold ("<<omega<<">"<<omegaThreshold<<") and has been deleted
(isReal="<<I->isReal<<")");
+ LOG_DEBUG("Contact #"<<id1<<"=#"<<id2<<" is damaged
over thershold ("<<omega<<">"<<omegaThreshold<<") and has been deleted
(isReal="<<I->isReal<<")");
continue;
}
@@ -303,11 +303,13 @@
Vector3r lineColor(BC->omega,1-BC->omega,0.0); /* damaged links red,
undamaged green */
Real epsTransNegAbs=-max(0.,BC->epsTrans);
- if(colorStrain)
lineColor=Vector3r(min(1.,max(0.,epsTransNegAbs/BC->epsCrackOnset-1)),min(1.,epsTransNegAbs/BC->epsCrackOnset),1);
+ if(colorStrain) lineColor=Vector3r(
+ min(1.,max(0.,abs(BC->epsTrans)/BC->epsCrackOnset-1)),
+ min(1.,epsTransNegAbs/BC->epsCrackOnset),1);
- if(contactLine)
Shop::GLDrawLine(b1->physicalParameters->dispSe3.position,b2->physicalParameters->dispSe3.position);
+ if(contactLine)
Shop::GLDrawLine(b1->physicalParameters->dispSe3.position,b2->physicalParameters->dispSe3.position,lineColor);
if(dmgLabel){
Shop::GLDrawNum(BC->omega,0.5*(b1->physicalParameters->dispSe3.position+b2->physicalParameters->dispSe3.position),lineColor);
}
- if(epsNLabel){
Shop::GLDrawNum(BC->epsN,0.5*(b1->physicalParameters->dispSe3.position+b2->physicalParameters->dispSe3.position),lineColor);
}
+ else if(epsNLabel){
Shop::GLDrawNum(BC->epsN,0.5*(b1->physicalParameters->dispSe3.position+b2->physicalParameters->dispSe3.position),lineColor);
}
const Vector3r&
cp=static_pointer_cast<SpheresContactGeometry>(i->interactionGeometry)->contactPoint;
if(epsT){
Index: gui/qt3/YadeQtMainWindow.cpp
===================================================================
--- gui/qt3/YadeQtMainWindow.cpp (revision 1462)
+++ gui/qt3/YadeQtMainWindow.cpp (revision 1463)
@@ -90,7 +90,8 @@
}
void YadeQtMainWindow::redrawAll(bool force){
- if(renderer && (force || (controller && !controller->syncRunning) ||
(!controller))){
+ // controller has its own timer -- and will update instead of us
periodically
+ if(renderer && (force /* || (controller && !controller->syncRunning )
*/ || (!controller))){
FOREACH(const shared_ptr<GLViewer>& glv,glViews){ if(glv)
glv->updateGL(); }
}
}
@@ -208,7 +209,7 @@
case EVENT_GENERATOR: createGenerator(); break;
case EVENT_RESIZE_VIEW: {
vector<int>* d=(vector<int>*)e->data();
- if(glViews.size()<d->at(0)+1 || !glViews[d->at(0)])
LOG_ERROR("No view #"+lexical_cast<string>(d->at(0))+", resize request
ignored");
+ if(glViews.size()<(size_t)(d->at(0)+1) ||
!glViews[d->at(0)]) LOG_ERROR("No view #"+lexical_cast<string>(d->at(0))+",
resize request ignored");
glViews[d->at(0)]->resize(d->at(1),d->at(2));
delete d;
}
Index: gui/qt3/SimulationController.cpp
===================================================================
--- gui/qt3/SimulationController.cpp (revision 1462)
+++ gui/qt3/SimulationController.cpp (revision 1463)
@@ -222,12 +222,9 @@
void SimulationController::cbSyncToggled(bool b){ sync=b; if(sync &&
refreshTime<20) refreshTime=20; pbStopClicked(); pbStartClicked(); }
void SimulationController::timerEvent( QTimerEvent* ){
doUpdate(); /* update the controller, like iteration number etc */
- if(sync && syncRunning){
- /* update GLViews */
- //LOG_DEBUG("Sync: iter
"<<Omega::instance().getCurrentIteration());
- YadeQtMainWindow::self->redrawAll(true);
- Omega::instance().spawnSingleSimulationLoop();
- }
+ /* update GLViews */
+ YadeQtMainWindow::self->redrawAll(true);
+ if(sync && syncRunning){ Omega::instance().spawnSingleSimulationLoop();
}
}
void SimulationController::pbResetClicked()
Index: gui/qt3/QtFileGenerator.cpp
===================================================================
--- gui/qt3/QtFileGenerator.cpp (revision 1462)
+++ gui/qt3/QtFileGenerator.cpp (revision 1463)
@@ -234,7 +234,7 @@
* 3. no simulation is open already (by checking Omega's
simulationFileName) */
if(cbOpenAutomatically->isChecked()
&& successfullyGenerated
//filesystem::exists(filesystem::path((const char*)(leOutputFileName->text())))
- && Omega::instance().getSimulationFileName()=="")
+ )
{
//Omega::instance().setSimulationFileName((const
char*)(leOutputFileName->text()));
YadeQtMainWindow::self->loadSimulation((const
char*)(leOutputFileName->text()));
_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help : https://help.launchpad.net/ListHelp