Skip to content

Commit

Permalink
Some minor cleaning up.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Nov 19, 2019
1 parent 82b59e8 commit 9a6b83e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Expand Up @@ -17,7 +17,7 @@
</message>
<message>
<source>the requested solver (%1) could not be found</source>
<translation type="unfinished"></translation>
<translation>le solveur demandé (%1) n&apos;a pas pu être trouvé</translation>
</message>
</context>
<context>
Expand Down Expand Up @@ -54,12 +54,8 @@
<context>
<name>QObject</name>
<message>
<source>Unknown ODE solver.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown NLA solver.</source>
<translation type="unfinished"></translation>
<source>The requested solver (%1) could not be found.</source>
<translation>Le solveur demandé (%1) n&apos;a pas pu être trouvé.</translation>
</message>
</context>
</TS>
Expand Up @@ -51,14 +51,16 @@ namespace SimulationSupport {
static void setOdeSolver(SimulationData *pSimulationData,
const QString &pOdeSolverName)
{
// Set the given ODE solver for the given simulation data

for (auto solverInterface : Core::solverInterfaces()) {
if (pOdeSolverName == solverInterface->solverName()) {
// Set the ODE solver's name

pSimulationData->setOdeSolverName(pOdeSolverName);

for (const auto &solverInterfaceProperty : solverInterface->solverProperties()) {
// Set each ODE solver property's default value
// Set each ODE solver property to their default value

pSimulationData->addOdeSolverProperty(solverInterfaceProperty.id(), solverInterfaceProperty.defaultValue());
}
Expand All @@ -67,22 +69,24 @@ static void setOdeSolver(SimulationData *pSimulationData,
}
}

throw std::runtime_error(QObject::tr("Unknown ODE solver.").toStdString());
throw std::runtime_error(QObject::tr("The requested solver (%1) could not be found.").arg(pOdeSolverName).toStdString());
}

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

static void setNlaSolver(SimulationData *pSimulationData,
const QString &pNlaSolverName)
{
// Set the given NLA solver for the given simulation data

for (auto solverInterface : Core::solverInterfaces()) {
if (pNlaSolverName == solverInterface->solverName()) {
// Set the NLA solver's name

pSimulationData->setNlaSolverName(pNlaSolverName);

for (const auto &solverInterfaceProperty : solverInterface->solverProperties()) {
// Set each NLA solver property's default value
// Set each NLA solver property to their default value

pSimulationData->addNlaSolverProperty(solverInterfaceProperty.id(), solverInterfaceProperty.defaultValue());
}
Expand All @@ -91,7 +95,7 @@ static void setNlaSolver(SimulationData *pSimulationData,
}
}

throw std::runtime_error(QObject::tr("Unknown NLA solver.").toStdString());
throw std::runtime_error(QObject::tr("The requested solver (%1) could not be found.").arg(pNlaSolverName).toStdString());
}

//==============================================================================
Expand Down Expand Up @@ -509,6 +513,8 @@ void SimulationSupportPythonWrapper::setPointInterval(SimulationData *pSimulatio
void SimulationSupportPythonWrapper::setOdeSolver(SimulationData *pSimulationData,
const QString &pOdeSolverName)
{
// Set the given ODE solver for the given simulation data

SimulationSupport::setOdeSolver(pSimulationData, pOdeSolverName);
}

Expand All @@ -517,6 +523,8 @@ void SimulationSupportPythonWrapper::setOdeSolver(SimulationData *pSimulationDat
void SimulationSupportPythonWrapper::setNlaSolver(SimulationData *pSimulationData,
const QString &pNlaSolverName)
{
// Set the given NLA solver for the given simulation data

SimulationSupport::setNlaSolver(pSimulationData, pNlaSolverName);
}

Expand Down

0 comments on commit 9a6b83e

Please sign in to comment.