Skip to content

Commit

Permalink
Simulation support: all issues are now considered to be blocking.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Jun 29, 2021
1 parent bb0dc42 commit fff694b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 35 deletions.
Expand Up @@ -957,7 +957,7 @@ void SimulationExperimentViewSimulationWidget::initialize(bool pReloading)
bool validRuntime = (runtime != nullptr) && runtime->isValid();
CellMLSupport::CellmlFileRuntimeParameter *voi = validRuntime?runtime->voi():nullptr;

if (!mSimulation->hasBlockingIssues()) {
if (!mSimulation->hasIssues()) {
information += QString()+OutputTab+"<strong>"+tr("Runtime:")+"</strong> ";

if (voi != nullptr) {
Expand Down Expand Up @@ -1014,7 +1014,7 @@ void SimulationExperimentViewSimulationWidget::initialize(bool pReloading)

mValidSimulationEnvironment = false;

if (!mSimulation->hasBlockingIssues()) {
if (!mSimulation->hasIssues()) {
// Enable/disable our run/pause action depending on whether we have
// a VOI

Expand Down
Expand Up @@ -23,8 +23,8 @@
<context>
<name>OpenCOR::SimulationSupport::SimulationSupportPythonWrapper</name>
<message>
<source>The simulation has blocking issues and cannot therefore be run.</source>
<translation>La simulation a des problèmes blocants et ne peut donc pas être exécutée.</translation>
<source>The simulation has issues and cannot therefore be run.</source>
<translation>La simulation a des problèmes et ne peut donc pas être exécutée.</translation>
</message>
<message>
<source>The simulation has an invalid runtime and cannot therefore be run.</source>
Expand Down
28 changes: 2 additions & 26 deletions src/plugins/support/SimulationSupport/src/simulation.cpp
Expand Up @@ -1586,7 +1586,6 @@ void Simulation::checkIssues()

mNeedCheckIssues = false;
mIssues = SimulationIssues();
mHasBlockingIssues = false;

// Make sure that we are dealing with a CellML file, a SED-ML file or a
// COMBINE archive
Expand All @@ -1598,8 +1597,6 @@ void Simulation::checkIssues()
fileManagerInstance->url(mFileName):
mFileName)));

mHasBlockingIssues = true;

return;
}

Expand Down Expand Up @@ -1627,8 +1624,6 @@ void Simulation::checkIssues()
case COMBINESupport::CombineArchiveIssue::Type::Error:
issueType = SimulationIssue::Type::Error;

mHasBlockingIssues = true;

break;
case COMBINESupport::CombineArchiveIssue::Type::Warning:
issueType = SimulationIssue::Type::Warning;
Expand All @@ -1637,8 +1632,6 @@ void Simulation::checkIssues()
case COMBINESupport::CombineArchiveIssue::Type::Fatal:
issueType = SimulationIssue::Type::Fatal;

mHasBlockingIssues = true;

break;
}

Expand All @@ -1660,8 +1653,6 @@ void Simulation::checkIssues()
case SEDMLSupport::SedmlFileIssue::Type::Error:
issueType = SimulationIssue::Type::Error;

mHasBlockingIssues = true;

break;
case SEDMLSupport::SedmlFileIssue::Type::Warning:
issueType = SimulationIssue::Type::Warning;
Expand All @@ -1670,8 +1661,6 @@ void Simulation::checkIssues()
case SEDMLSupport::SedmlFileIssue::Type::Fatal:
issueType = SimulationIssue::Type::Fatal;

mHasBlockingIssues = true;

break;
}

Expand All @@ -1682,7 +1671,7 @@ void Simulation::checkIssues()
}
}

if (!mHasBlockingIssues) {
if (mIssues.empty()) {
bool validRuntime = (mRuntime != nullptr) && mRuntime->isValid();
CellMLSupport::CellmlFileRuntimeParameter *voi = validRuntime?
mRuntime->voi():
Expand Down Expand Up @@ -1746,20 +1735,7 @@ bool Simulation::hasIssues()
{
// Return whether we have issues, after having checked for them

checkIssues();

return !mIssues.empty();
}

//==============================================================================

bool Simulation::hasBlockingIssues()
{
// Return whether we have blocking issues, after having checked for them

checkIssues();

return mHasBlockingIssues;
return !issues().empty();
}

//==============================================================================
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/support/SimulationSupport/src/simulation.h
Expand Up @@ -397,7 +397,6 @@ class SIMULATIONSUPPORT_EXPORT Simulation : public QObject

bool mNeedCheckIssues = true;
SimulationIssues mIssues;
bool mHasBlockingIssues = false;

CellMLSupport::CellmlFileRuntime *mRuntime = nullptr;

Expand Down Expand Up @@ -428,7 +427,6 @@ public slots:
QString fileName() const;

bool hasIssues();
bool hasBlockingIssues();

void save();
void reload();
Expand Down
Expand Up @@ -245,7 +245,7 @@ bool SimulationSupportPythonWrapper::valid(Simulation *pSimulation)
{
// Return whether the given simulation is valid

if (!pSimulation->hasBlockingIssues()) {
if (!pSimulation->hasIssues()) {
CellMLSupport::CellmlFileRuntime *runtime = pSimulation->runtime();

return (runtime != nullptr) && runtime->isValid();
Expand All @@ -261,8 +261,8 @@ bool SimulationSupportPythonWrapper::run(Simulation *pSimulation)
// Run the given simulation, but only if it doesn't have blocking issues and
// if it is valid

if (pSimulation->hasBlockingIssues()) {
throw std::runtime_error(tr("The simulation has blocking issues and cannot therefore be run.").toStdString());
if (pSimulation->hasIssues()) {
throw std::runtime_error(tr("The simulation has issues and cannot therefore be run.").toStdString());
}

if (!valid(pSimulation)) {
Expand Down

0 comments on commit fff694b

Please sign in to comment.