double SingleCellViewSimulation::size() { // Return the size of our simulation (i.e. the number of data points that // should be generated), if possible // Note: we return a double rather than a qulonglong in case the simulation // requires an insane amount of memory... if (simulationSettingsOk(false)) return ceil((mData->endingPoint()-mData->startingPoint())/mData->pointInterval())+1.0; else return 0.0; }
void SingleCellViewSimulation::run() { // It is only valid to run a simulation is the simulation is ready, and we // are in the 'got initial value' state (i.e. we are ready to simulate, but // no simulation is already running). if (!simulationSettingsOk() || data()->state() != SingleCellViewSimulationData::SIMSTATE_GOT_IV) return; mLastUpdate = QTime::currentTime(); mRunTime = QTime::currentTime(); emit running(this, true); data()->startMainSimulation(); }
double SingleCellViewSimulation::size() { // Return the size of our simulation (i.e. the number of data points which // should be generated) // Note: we return a double rather than a qulonglong in case the simulation // requires an insane amount of memory... if (simulationSettingsOk(false)) // Our simulation settings are fine, so... return ceil((mData->endingPoint()-mData->startingPoint())/mData->pointInterval())+1.0; else // Something wrong with our simulation settings, so... return 0.0; }
bool SingleCellViewSimulation::run() { if (!mRuntime) return false; // Initialise our worker, if not active if (mWorker) { return false; } else { // Make sure that that the simulation settings we were given are sound if (!simulationSettingsOk()) return false; // Create our worker mWorker = new SingleCellViewSimulationWorker(mSolverInterfaces, mRuntime, this, &mWorker); if (!mWorker) { emit error(tr("the simulation worker could not be created")); return false; } // Create a few connections connect(mWorker, SIGNAL(running(const bool &)), this, SIGNAL(running(const bool &))); connect(mWorker, SIGNAL(paused()), this, SIGNAL(paused())); connect(mWorker, SIGNAL(finished(const qint64 &)), this, SIGNAL(stopped(const qint64 &))); connect(mWorker, SIGNAL(error(const QString &)), this, SIGNAL(error(const QString &))); // Start our worker return mWorker->run(); } }