diff --git a/doc/downloads/index.js b/doc/downloads/index.js index e1f37b1670..accea330e2 100644 --- a/doc/downloads/index.js +++ b/doc/downloads/index.js @@ -38,6 +38,7 @@ var jsonData = { "versions": [ ], "changes": [ { "change": "General: improved our support for DAE models (see issues #188 and #536)." }, + { "change": "Solvers: can now parameterise the KINSOL solver (see issue #1510)." }, { "change": "Third-party libraries: upgraded the SUNDIALS library to version 3.1.0 (see issue #1507)." } ] }, diff --git a/doc/user/whatIsNew.js b/doc/user/whatIsNew.js index 33f1f93492..9309f0f5c2 100644 --- a/doc/user/whatIsNew.js +++ b/doc/user/whatIsNew.js @@ -93,12 +93,17 @@ var jsonData = { "versions": [ "entries": [ { "type": "subCategory", "name": "CVODES solver (formerly known as the CVODE solver)", "entries": [ - { "type": "Improved", "description": "Ready for sensitivity analysis." } + { "type": "Added", "description": "Support for sensitivity analysis." } ] }, { "type": "subCategory", "name": "IDAS solver (formerly known as the IDA solver)", "entries": [ - { "type": "Improved", "description": "Ready for sensitivity analysis." } + { "type": "Added", "description": "Support for sensitivity analysis." } + ] + }, + { "type": "subCategory", "name": "KINSOL solver", + "entries": [ + { "type": "Added", "description": "Parametrisation of the solver." } ] } ] diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewinformationsolverswidget.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewinformationsolverswidget.cpp index fb23258b07..c87f98e0e5 100644 --- a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewinformationsolverswidget.cpp +++ b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewinformationsolverswidget.cpp @@ -358,9 +358,7 @@ void SimulationExperimentViewInformationSolversWidget::initialize(SimulationSupp foreach (Core::Property *property, mNlaSolverData->solversProperties().value(pSimulation->data()->nlaSolverName())) { pSimulation->data()->addNlaSolverProperty(property->id(), - (property->type() == Core::Property::Integer)? - property->integerValue(): - property->doubleValue(), + property->valueAsVariant(), false); } } diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp index 7595e23064..db02aff1eb 100644 --- a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp +++ b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp @@ -1318,7 +1318,8 @@ void SimulationExperimentViewSimulationWidget::runPauseResumeSimulation() } // Finish any editing of our simulation information, and update our - // simulation and solvers properties before running/resuming it + // simulation and solvers properties (without resetting our NLA solver) + // before running/resuming it mContentsWidget->informationWidget()->finishEditing(mSimulation->isPaused()); @@ -1594,8 +1595,9 @@ void SimulationExperimentViewSimulationWidget::addSedmlSimulation(libsedml::SedD if (runtime->needNlaSolver()) { QString nlaSolverProperties = QString(); + Solver::Solver::Properties solverProperties = mSimulation->data()->nlaSolverProperties(); - foreach (const QString &solverProperty, mSimulation->data()->nlaSolverProperties().keys()) { + foreach (const QString &solverProperty, solverProperties.keys()) { nlaSolverProperties += QString("<%1 %2=\"%3\" %4=\"%5\"/>").arg(SEDMLSupport::SolverProperty, SEDMLSupport::Id, solverProperty, @@ -2634,12 +2636,17 @@ bool SimulationExperimentViewSimulationWidget::furtherInitialize() if ( !QString::fromStdString(nlaSolverNode.getURI()).compare(SEDMLSupport::OpencorNamespace) && !QString::fromStdString(nlaSolverNode.getName()).compare(SEDMLSupport::NlaSolver)) { + SimulationExperimentViewInformationSolversWidgetData *solverData = solversWidget->nlaSolverData(); + Core::Properties solverProperties = Core::Properties(); + mustHaveNlaSolver = true; nlaSolverName = QString::fromStdString(nlaSolverNode.getAttrValue(nlaSolverNode.getAttrIndex(SEDMLSupport::Name.toStdString()))); foreach (SolverInterface *solverInterface, solverInterfaces) { if (!nlaSolverName.compare(solverInterface->solverName())) { - solversWidget->nlaSolverData()->solversListProperty()->setValue(nlaSolverName); + solverProperties = solverData->solversProperties().value(solverInterface->solverName()); + + solverData->solversListProperty()->setValue(nlaSolverName); hasNlaSolver = true; @@ -2647,8 +2654,37 @@ bool SimulationExperimentViewSimulationWidget::furtherInitialize() } } - if (hasNlaSolver) + if (hasNlaSolver) { + for (uint j = 0, jMax = nlaSolverNode.getNumChildren(); j < jMax; ++j) { + const libsbml::XMLNode &solverPropertyNode = nlaSolverNode.getChild(j); + + if ( !QString::fromStdString(solverPropertyNode.getURI()).compare(SEDMLSupport::OpencorNamespace) + && !QString::fromStdString(solverPropertyNode.getName()).compare(SEDMLSupport::SolverProperty)) { + QString id = QString::fromStdString(solverPropertyNode.getAttrValue(solverPropertyNode.getAttrIndex(SEDMLSupport::Id.toStdString()))); + QString value = QString::fromStdString(solverPropertyNode.getAttrValue(solverPropertyNode.getAttrIndex(SEDMLSupport::Value.toStdString()))); + bool propertySet = false; + + foreach (Core::Property *solverProperty, solverProperties) { + if (!solverProperty->id().compare(id)) { + solverProperty->setValue(value); + + propertySet = true; + + break; + } + } + + if (!propertySet) { + simulationError(tr("the requested property (%1) could not be set").arg(id), + InvalidSimulationEnvironment); + + return false; + } + } + } + break; + } } } diff --git a/src/plugins/solver/CVODESSolver/i18n/CVODESSolver_fr.ts b/src/plugins/solver/CVODESSolver/i18n/CVODESSolver_fr.ts index 8479d92174..86b7c8f6bc 100644 --- a/src/plugins/solver/CVODESSolver/i18n/CVODESSolver_fr.ts +++ b/src/plugins/solver/CVODESSolver/i18n/CVODESSolver_fr.ts @@ -4,64 +4,64 @@ OpenCOR::CVODESSolver::CvodesSolver - the 'maximum step' property value could not be retrieved - la valeur de la propriété 'pas maximum' n'a pas pu être retrouvée + the "Maximum step" property value could not be retrieved + la valeur de la propriété "Pas maximum" n'a pas pu être retrouvée - the 'maximum number of steps' property value could not be retrieved - la valeur de la propriété 'nombre maximum de pas' n'a pas pu être retrouvée + the "Maximum number of steps" property value could not be retrieved + la valeur de la propriété "Nombre maximum de pas" n'a pas pu être retrouvée - the 'integration method' property value could not be retrieved - la valeur de la propriété 'méthode d'intégration' n'a pas pu être retrouvée + the "Integration method" property value could not be retrieved + la valeur de la propriété "Méthode d'intégration" n'a pas pu être retrouvée - the 'preconditioner' property value could not be retrieved - la valeur de la propriété 'préconditionneur' n'a pas pu être retrouvée + the "Preconditioner" property value could not be retrieved + la valeur de la propriété "Préconditionneur" n'a pas pu être retrouvée - the 'upper half-bandwidth' property must have a value between 0 and %1 - la propriété 'demi largeur de bande supérieure' doit avoir une valeur comprise entre 0 et %1 + the "Upper half-bandwidth" property must have a value between 0 and %1 + la propriété "Demi largeur de bande supérieure" doit avoir une valeur comprise entre 0 et %1 - the 'upper half-bandwidth' property value could not be retrieved - la valeur de la propriété 'demi largeur de bande supérieure' n'a pas pu être retrouvée + the "Upper half-bandwidth" property value could not be retrieved + la valeur de la propriété "Demi largeur de bande supérieure" n'a pas pu être retrouvée - the 'lower half-bandwidth' property must have a value between 0 and %1 - la propriété 'demi largeur de bande inférieure' doit avoir une valeur comprise entre 0 et %1 + the "Lower half-bandwidth" property must have a value between 0 and %1 + la propriété "Demi largeur de bande inférieure" doit avoir une valeur comprise entre 0 et %1 - the 'lower half-bandwidth' property value could not be retrieved - la valeur de la propriété 'demi largeur de bande inférieure' n'a pas pu être retrouvée + the "Lower half-bandwidth" property value could not be retrieved + la valeur de la propriété "Demi largeur de bande inférieure" n'a pas pu être retrouvée - the 'linear solver' property value could not be retrieved - la valeur de la propriété 'solveur linéaire' n'a pas pu être retrouvée + the "Linear solver" property value could not be retrieved + la valeur de la propriété "Solveur linéaire" n'a pas pu être retrouvée - the 'iteration type' property value could not be retrieved - la valeur de la propriété 'type d'itération' n'a pas pu être retrouvée + the "Iteration type" property value could not be retrieved + la valeur de la propriété "Type d'itération" n'a pas pu être retrouvée - the 'relative tolerance' property must have a value greater than or equal to 0 - la propriété 'tolérance relative' doit avoir une valeur plus grande que ou égale à 0 + the "Relative tolerance" property must have a value greater than or equal to 0 + la propriété "Tolérance relative" doit avoir une valeur plus grande que ou égale à 0 - the 'relative tolerance' property value could not be retrieved - la valeur de la propriété 'tolérance relative' n'a pas pu être retrouvée + the "Relative tolerance" property value could not be retrieved + la valeur de la propriété "Tolérance relative" n'a pas pu être retrouvée - the 'absolute tolerance' property must have a value greater than or equal to 0 - la propriété 'tolérance absolue' doit avoir une valeur plus grande que ou égale à 0 + the "Absolute tolerance" property must have a value greater than or equal to 0 + la propriété "Tolérance absolue" doit avoir une valeur plus grande que ou égale à 0 - the 'absolute tolerance' property value could not be retrieved - la valeur de la propriété 'tolérance absolue' n'a pas pu être retrouvée + the "Absolute tolerance" property value could not be retrieved + la valeur de la propriété "Tolérance absolue" n'a pas pu être retrouvée - the 'interpolate solution' property value could not be retrieved - la valeur de la propriété 'interpoler solution' n'a pas pu être retrouvée + the "Interpolate solution" property value could not be retrieved + la valeur de la propriété "Interpoler solution" n'a pas pu être retrouvée diff --git a/src/plugins/solver/CVODESSolver/src/cvodessolver.cpp b/src/plugins/solver/CVODESSolver/src/cvodessolver.cpp index d80d82b1a3..4fa6453a80 100644 --- a/src/plugins/solver/CVODESSolver/src/cvodessolver.cpp +++ b/src/plugins/solver/CVODESSolver/src/cvodessolver.cpp @@ -166,7 +166,7 @@ void CvodesSolver::initialize(const double &pVoiStart, if (mProperties.contains(MaximumStepId)) { maximumStep = mProperties.value(MaximumStepId).toDouble(); } else { - emit error(tr("the 'maximum step' property value could not be retrieved")); + emit error(tr("the \"Maximum step\" property value could not be retrieved")); return; } @@ -174,7 +174,7 @@ void CvodesSolver::initialize(const double &pVoiStart, if (mProperties.contains(MaximumNumberOfStepsId)) { maximumNumberOfSteps = mProperties.value(MaximumNumberOfStepsId).toInt(); } else { - emit error(tr("the 'maximum number of steps' property value could not be retrieved")); + emit error(tr("the \"Maximum number of steps\" property value could not be retrieved")); return; } @@ -182,7 +182,7 @@ void CvodesSolver::initialize(const double &pVoiStart, if (mProperties.contains(IntegrationMethodId)) { integrationMethod = mProperties.value(IntegrationMethodId).toString(); } else { - emit error(tr("the 'integration method' property value could not be retrieved")); + emit error(tr("the \"Integration method\" property value could not be retrieved")); return; } @@ -215,7 +215,7 @@ void CvodesSolver::initialize(const double &pVoiStart, if (mProperties.contains(PreconditionerId)) { preconditioner = mProperties.value(PreconditionerId).toString(); } else { - emit error(tr("the 'preconditioner' property value could not be retrieved")); + emit error(tr("the \"Preconditioner\" property value could not be retrieved")); return; } @@ -234,12 +234,12 @@ void CvodesSolver::initialize(const double &pVoiStart, if ( (upperHalfBandwidth < 0) || (upperHalfBandwidth >= pRatesStatesCount)) { - emit error(tr("the 'upper half-bandwidth' property must have a value between 0 and %1").arg(pRatesStatesCount-1)); + emit error(tr("the \"Upper half-bandwidth\" property must have a value between 0 and %1").arg(pRatesStatesCount-1)); return; } } else { - emit error(tr("the 'upper half-bandwidth' property value could not be retrieved")); + emit error(tr("the \"Upper half-bandwidth\" property value could not be retrieved")); return; } @@ -249,24 +249,24 @@ void CvodesSolver::initialize(const double &pVoiStart, if ( (lowerHalfBandwidth < 0) || (lowerHalfBandwidth >= pRatesStatesCount)) { - emit error(tr("the 'lower half-bandwidth' property must have a value between 0 and %1").arg(pRatesStatesCount-1)); + emit error(tr("the \"Lower half-bandwidth\" property must have a value between 0 and %1").arg(pRatesStatesCount-1)); return; } } else { - emit error(tr("the 'lower half-bandwidth' property value could not be retrieved")); + emit error(tr("the \"Lower half-bandwidth\" property value could not be retrieved")); return; } } } else { - emit error(tr("the 'linear solver' property value could not be retrieved")); + emit error(tr("the \"Linear solver\" property value could not be retrieved")); return; } } } else { - emit error(tr("the 'iteration type' property value could not be retrieved")); + emit error(tr("the \"Iteration type\" property value could not be retrieved")); return; } @@ -275,12 +275,12 @@ void CvodesSolver::initialize(const double &pVoiStart, relativeTolerance = mProperties.value(RelativeToleranceId).toDouble(); if (relativeTolerance < 0) { - emit error(tr("the 'relative tolerance' property must have a value greater than or equal to 0")); + emit error(tr("the \"Relative tolerance\" property must have a value greater than or equal to 0")); return; } } else { - emit error(tr("the 'relative tolerance' property value could not be retrieved")); + emit error(tr("the \"Relative tolerance\" property value could not be retrieved")); return; } @@ -289,12 +289,12 @@ void CvodesSolver::initialize(const double &pVoiStart, absoluteTolerance = mProperties.value(AbsoluteToleranceId).toDouble(); if (absoluteTolerance < 0) { - emit error(tr("the 'absolute tolerance' property must have a value greater than or equal to 0")); + emit error(tr("the \"Absolute tolerance\" property must have a value greater than or equal to 0")); return; } } else { - emit error(tr("the 'absolute tolerance' property value could not be retrieved")); + emit error(tr("the \"Absolute tolerance\" property value could not be retrieved")); return; } @@ -302,7 +302,7 @@ void CvodesSolver::initialize(const double &pVoiStart, if (mProperties.contains(InterpolateSolutionId)) { mInterpolateSolution = mProperties.value(InterpolateSolutionId).toBool(); } else { - emit error(tr("the 'interpolate solution' property value could not be retrieved")); + emit error(tr("the \"Interpolate solution\" property value could not be retrieved")); return; } diff --git a/src/plugins/solver/CVODESSolver/src/cvodessolver.h b/src/plugins/solver/CVODESSolver/src/cvodessolver.h index 52e9c31d09..77d43da909 100644 --- a/src/plugins/solver/CVODESSolver/src/cvodessolver.h +++ b/src/plugins/solver/CVODESSolver/src/cvodessolver.h @@ -81,8 +81,8 @@ static const auto BandedPreconditioner = QStringLiteral("Banded"); // Default CVODES parameter values // Note #1: a maximum step of 0 means that there is no maximum step as such and // that CVODES can use whatever step it sees fit... -// Note #2: CVODES' default maximum number of steps is 500 which ought to be big -// enough in most cases... +// Note #2: CVODES' default maximum number of steps is 500, which ought to be +// big enough in most cases... static const double MaximumStepDefaultValue = 0.0; @@ -144,9 +144,12 @@ class CvodesSolver : public OpenCOR::Solver::OdeSolver private: void *mSolver; + N_Vector mStatesVector; + SUNMatrix mMatrix; SUNLinearSolver mLinearSolver; + CvodesSolverUserData *mUserData; bool mInterpolateSolution; diff --git a/src/plugins/solver/ForwardEulerSolver/i18n/ForwardEulerSolver_fr.ts b/src/plugins/solver/ForwardEulerSolver/i18n/ForwardEulerSolver_fr.ts index 454a1ca360..30acb29529 100644 --- a/src/plugins/solver/ForwardEulerSolver/i18n/ForwardEulerSolver_fr.ts +++ b/src/plugins/solver/ForwardEulerSolver/i18n/ForwardEulerSolver_fr.ts @@ -4,12 +4,12 @@ OpenCOR::ForwardEulerSolver::ForwardEulerSolver - the 'step' property value cannot be equal to zero - la valeur de la propriété 'pas' ne peut pas être égale à zéro + the "Step" property value cannot be equal to zero + la valeur de la propriété "Pas" ne peut pas être égale à zéro - the 'step' property value could not be retrieved - la valeur de la propriété 'pas' n'a pas pu être retrouvée + the "Step" property value could not be retrieved + la valeur de la propriété "Pas" n'a pas pu être retrouvée diff --git a/src/plugins/solver/ForwardEulerSolver/src/forwardeulersolver.cpp b/src/plugins/solver/ForwardEulerSolver/src/forwardeulersolver.cpp index ea81ad9f8e..035330fdd6 100644 --- a/src/plugins/solver/ForwardEulerSolver/src/forwardeulersolver.cpp +++ b/src/plugins/solver/ForwardEulerSolver/src/forwardeulersolver.cpp @@ -49,12 +49,12 @@ void ForwardEulerSolver::initialize(const double &pVoiStart, mStep = mProperties.value(StepId).toDouble(); if (!mStep) { - emit error(tr("the 'step' property value cannot be equal to zero")); + emit error(tr("the \"Step\" property value cannot be equal to zero")); return; } } else { - emit error(tr("the 'step' property value could not be retrieved")); + emit error(tr("the \"Step\" property value could not be retrieved")); return; } diff --git a/src/plugins/solver/FourthOrderRungeKuttaSolver/i18n/FourthOrderRungeKuttaSolver_fr.ts b/src/plugins/solver/FourthOrderRungeKuttaSolver/i18n/FourthOrderRungeKuttaSolver_fr.ts index 0682693f62..f85c268f24 100644 --- a/src/plugins/solver/FourthOrderRungeKuttaSolver/i18n/FourthOrderRungeKuttaSolver_fr.ts +++ b/src/plugins/solver/FourthOrderRungeKuttaSolver/i18n/FourthOrderRungeKuttaSolver_fr.ts @@ -4,12 +4,12 @@ OpenCOR::FourthOrderRungeKuttaSolver::FourthOrderRungeKuttaSolver - the 'step' property value cannot be equal to zero - la valeur de la propriété 'pas' ne peut pas être égale à zéro + the "Step" property value cannot be equal to zero + la valeur de la propriété "Pas" ne peut pas être égale à zéro - the 'step' property value could not be retrieved - la valeur de la propriété 'pas' n'a pas pu être retrouvée + the "Step" property value could not be retrieved + la valeur de la propriété "Pas" n'a pas pu être retrouvée diff --git a/src/plugins/solver/FourthOrderRungeKuttaSolver/src/fourthorderrungekuttasolver.cpp b/src/plugins/solver/FourthOrderRungeKuttaSolver/src/fourthorderrungekuttasolver.cpp index 70ef9753a9..3d2c12b771 100644 --- a/src/plugins/solver/FourthOrderRungeKuttaSolver/src/fourthorderrungekuttasolver.cpp +++ b/src/plugins/solver/FourthOrderRungeKuttaSolver/src/fourthorderrungekuttasolver.cpp @@ -64,12 +64,12 @@ void FourthOrderRungeKuttaSolver::initialize(const double &pVoiStart, mStep = mProperties.value(StepId).toDouble(); if (!mStep) { - emit error(tr("the 'step' property value cannot be equal to zero")); + emit error(tr("the \"Step\" property value cannot be equal to zero")); return; } } else { - emit error(tr("the 'step' property value could not be retrieved")); + emit error(tr("the \"Step\" property value could not be retrieved")); return; } diff --git a/src/plugins/solver/HeunSolver/i18n/HeunSolver_fr.ts b/src/plugins/solver/HeunSolver/i18n/HeunSolver_fr.ts index 298f9f98d6..0386ec728a 100644 --- a/src/plugins/solver/HeunSolver/i18n/HeunSolver_fr.ts +++ b/src/plugins/solver/HeunSolver/i18n/HeunSolver_fr.ts @@ -4,12 +4,12 @@ OpenCOR::HeunSolver::HeunSolver - the 'step' property value cannot be equal to zero - la valeur de la propriété 'pas' ne peut pas être égale à zéro + the "Step" property value cannot be equal to zero + la valeur de la propriété "Pas" ne peut pas être égale à zéro - the 'step' property value could not be retrieved - la valeur de la propriété 'pas' n'a pas pu être retrouvée + the "Step" property value could not be retrieved + la valeur de la propriété "Pas" n'a pas pu être retrouvée diff --git a/src/plugins/solver/HeunSolver/src/heunsolver.cpp b/src/plugins/solver/HeunSolver/src/heunsolver.cpp index 60c6f7b282..1855eb5b1a 100644 --- a/src/plugins/solver/HeunSolver/src/heunsolver.cpp +++ b/src/plugins/solver/HeunSolver/src/heunsolver.cpp @@ -60,12 +60,12 @@ void HeunSolver::initialize(const double &pVoiStart, mStep = mProperties.value(StepId).toDouble(); if (!mStep) { - emit error(tr("the 'step' property value cannot be equal to zero")); + emit error(tr("the \"Step\" property value cannot be equal to zero")); return; } } else { - emit error(tr("the 'step' property value could not be retrieved")); + emit error(tr("the \"Step\" property value could not be retrieved")); return; } diff --git a/src/plugins/solver/IDASSolver/i18n/IDASSolver_fr.ts b/src/plugins/solver/IDASSolver/i18n/IDASSolver_fr.ts index 96ec1a3606..04dfc62caf 100644 --- a/src/plugins/solver/IDASSolver/i18n/IDASSolver_fr.ts +++ b/src/plugins/solver/IDASSolver/i18n/IDASSolver_fr.ts @@ -4,52 +4,52 @@ OpenCOR::IDASSolver::IdasSolver - the 'maximum step' property value could not be retrieved - la valeur de la propriété 'pas maximum' n'a pas pu être retrouvée + the "Maximum step" property value could not be retrieved + la valeur de la propriété "Pas maximum" n'a pas pu être retrouvée - the 'maximum number of steps' property value could not be retrieved - la valeur de la propriété 'nombre maximum de pas' n'a pas pu être retrouvée + the "Maximum number of steps" property value could not be retrieved + la valeur de la propriété "Nombre maximum de pas" n'a pas pu être retrouvée - the 'upper half-bandwidth' property must have a value between 0 and %1 - la propriété 'demi largeur de bande supérieure' doit avoir une valeur comprise entre 0 et %1 + the "Upper half-bandwidth" property must have a value between 0 and %1 + la propriété "Demi largeur de bande supérieure" doit avoir une valeur comprise entre 0 et %1 - the 'upper half-bandwidth' property value could not be retrieved - la valeur de la propriété 'demi largeur de bande supérieure' n'a pas pu être retrouvée + the "Upper half-bandwidth" property value could not be retrieved + la valeur de la propriété "Demi largeur de bande supérieure" n'a pas pu être retrouvée - the 'lower half-bandwidth' property must have a value between 0 and %1 - la propriété 'demi largeur de bande inférieure' doit avoir une valeur comprise entre 0 et %1 + the "Lower half-bandwidth" property must have a value between 0 and %1 + la propriété "Demi largeur de bande inférieure" doit avoir une valeur comprise entre 0 et %1 - the 'lower half-bandwidth' property value could not be retrieved - la valeur de la propriété 'demi largeur de bande inférieure' n'a pas pu être retrouvée + the "Lower half-bandwidth" property value could not be retrieved + la valeur de la propriété "Demi largeur de bande inférieure" n'a pas pu être retrouvée - the 'linear solver' property value could not be retrieved - la valeur de la propriété 'solveur linéaire' n'a pas pu être retrouvée + the "Linear solver" property value could not be retrieved + la valeur de la propriété "Solveur linéaire" n'a pas pu être retrouvée - the 'relative tolerance' property must have a value greater than or equal to 0 - la propriété 'tolérance relative' doit avoir une valeur plus grande que ou égale à 0 + the "Relative tolerance" property must have a value greater than or equal to 0 + la propriété "Tolérance relative" doit avoir une valeur plus grande que ou égale à 0 - the 'relative tolerance' property value could not be retrieved - la valeur de la propriété 'tolérance relative' n'a pas pu être retrouvée + the "Relative tolerance" property value could not be retrieved + la valeur de la propriété "Tolérance relative" n'a pas pu être retrouvée - the 'absolute tolerance' property must have a value greater than or equal to 0 - la propriété 'tolérance absolue' doit avoir une valeur plus grande que ou égale à 0 + the "Absolute tolerance" property must have a value greater than or equal to 0 + la propriété "Tolérance absolue" doit avoir une valeur plus grande que ou égale à 0 - the 'absolute tolerance' property value could not be retrieved - la valeur de la propriété 'tolérance absolue' n'a pas pu être retrouvée + the "Absolute tolerance" property value could not be retrieved + la valeur de la propriété "Tolérance absolue" n'a pas pu être retrouvée - the 'interpolate solution' property value could not be retrieved - la valeur de la propriété 'interpoler solution' n'a pas pu être retrouvée + the "Interpolate solution" property value could not be retrieved + la valeur de la propriété "Interpoler solution" n'a pas pu être retrouvée diff --git a/src/plugins/solver/IDASSolver/src/idassolver.cpp b/src/plugins/solver/IDASSolver/src/idassolver.cpp index 1bf2b7111e..e54759bc1e 100644 --- a/src/plugins/solver/IDASSolver/src/idassolver.cpp +++ b/src/plugins/solver/IDASSolver/src/idassolver.cpp @@ -256,7 +256,7 @@ void IdasSolver::initialize(const double &pVoiStart, const double &pVoiEnd, if (mProperties.contains(MaximumStepId)) { maximumStep = mProperties.value(MaximumStepId).toDouble(); } else { - emit error(tr("the 'maximum step' property value could not be retrieved")); + emit error(tr("the \"Maximum step\" property value could not be retrieved")); return; } @@ -264,7 +264,7 @@ void IdasSolver::initialize(const double &pVoiStart, const double &pVoiEnd, if (mProperties.contains(MaximumNumberOfStepsId)) { maximumNumberOfSteps = mProperties.value(MaximumNumberOfStepsId).toInt(); } else { - emit error(tr("the 'maximum number of steps' property value could not be retrieved")); + emit error(tr("the \"Maximum number of steps\" property value could not be retrieved")); return; } @@ -278,12 +278,12 @@ void IdasSolver::initialize(const double &pVoiStart, const double &pVoiEnd, if ( (upperHalfBandwidth < 0) || (upperHalfBandwidth >= pRatesStatesCount)) { - emit error(tr("the 'upper half-bandwidth' property must have a value between 0 and %1").arg(pRatesStatesCount-1)); + emit error(tr("the \"Upper half-bandwidth\" property must have a value between 0 and %1").arg(pRatesStatesCount-1)); return; } } else { - emit error(tr("the 'upper half-bandwidth' property value could not be retrieved")); + emit error(tr("the \"Upper half-bandwidth\" property value could not be retrieved")); return; } @@ -293,18 +293,18 @@ void IdasSolver::initialize(const double &pVoiStart, const double &pVoiEnd, if ( (lowerHalfBandwidth < 0) || (lowerHalfBandwidth >= pRatesStatesCount)) { - emit error(tr("the 'lower half-bandwidth' property must have a value between 0 and %1").arg(pRatesStatesCount-1)); + emit error(tr("the \"Lower half-bandwidth\" property must have a value between 0 and %1").arg(pRatesStatesCount-1)); return; } } else { - emit error(tr("the 'lower half-bandwidth' property value could not be retrieved")); + emit error(tr("the \"Lower half-bandwidth\" property value could not be retrieved")); return; } } } else { - emit error(tr("the 'linear solver' property value could not be retrieved")); + emit error(tr("the \"Linear solver\" property value could not be retrieved")); return; } @@ -313,12 +313,12 @@ void IdasSolver::initialize(const double &pVoiStart, const double &pVoiEnd, relativeTolerance = mProperties.value(RelativeToleranceId).toDouble(); if (relativeTolerance < 0) { - emit error(tr("the 'relative tolerance' property must have a value greater than or equal to 0")); + emit error(tr("the \"Relative tolerance\" property must have a value greater than or equal to 0")); return; } } else { - emit error(tr("the 'relative tolerance' property value could not be retrieved")); + emit error(tr("the \"Relative tolerance\" property value could not be retrieved")); return; } @@ -327,12 +327,12 @@ void IdasSolver::initialize(const double &pVoiStart, const double &pVoiEnd, absoluteTolerance = mProperties.value(AbsoluteToleranceId).toDouble(); if (absoluteTolerance < 0) { - emit error(tr("the 'absolute tolerance' property must have a value greater than or equal to 0")); + emit error(tr("the \"Absolute tolerance\" property must have a value greater than or equal to 0")); return; } } else { - emit error(tr("the 'absolute tolerance' property value could not be retrieved")); + emit error(tr("the \"Absolute tolerance\" property value could not be retrieved")); return; } @@ -340,7 +340,7 @@ void IdasSolver::initialize(const double &pVoiStart, const double &pVoiEnd, if (mProperties.contains(InterpolateSolutionId)) { mInterpolateSolution = mProperties.value(InterpolateSolutionId).toBool(); } else { - emit error(tr("the 'interpolate solution' property value could not be retrieved")); + emit error(tr("the \"Interpolate solution\" property value could not be retrieved")); return; } diff --git a/src/plugins/solver/IDASSolver/src/idassolver.h b/src/plugins/solver/IDASSolver/src/idassolver.h index b4dc6d36dd..c5a2640e28 100644 --- a/src/plugins/solver/IDASSolver/src/idassolver.h +++ b/src/plugins/solver/IDASSolver/src/idassolver.h @@ -62,7 +62,7 @@ static const auto TfqmrLinearSolver = QStringLiteral("TFQMR"); // Default IDAS parameter values // Note #1: a maximum step of 0 means that there is no maximum step as such and // that IDAS can use whatever step it sees fit... -// Note #2: IDAS' default maximum number of steps is 500 which ought to be big +// Note #2: IDAS' default maximum number of steps is 500, which ought to be big // enough in most cases... static const double MaximumStepDefaultValue = 0.0; @@ -141,10 +141,13 @@ class IdasSolver : public OpenCOR::Solver::DaeSolver private: void *mSolver; + N_Vector mRatesVector; N_Vector mStatesVector; + SUNMatrix mMatrix; SUNLinearSolver mLinearSolver; + IdasSolverUserData *mUserData; bool mInterpolateSolution; diff --git a/src/plugins/solver/IDASSolver/src/idassolverplugin.cpp b/src/plugins/solver/IDASSolver/src/idassolverplugin.cpp index 3a4d814b74..ee8165e936 100644 --- a/src/plugins/solver/IDASSolver/src/idassolverplugin.cpp +++ b/src/plugins/solver/IDASSolver/src/idassolverplugin.cpp @@ -47,7 +47,6 @@ PLUGININFO_FUNC IDASSolverPluginInfo() // I18n interface //============================================================================== - void IDASSolverPlugin::retranslateUi() { // We don't handle this interface... @@ -60,7 +59,6 @@ void IDASSolverPlugin::retranslateUi() // Solver interface //============================================================================== - Solver::Solver * IDASSolverPlugin::solverInstance() const { // Create and return an instance of the solver diff --git a/src/plugins/solver/KINSOLSolver/CMakeLists.txt b/src/plugins/solver/KINSOLSolver/CMakeLists.txt index 29a0b0b973..bb682861cd 100644 --- a/src/plugins/solver/KINSOLSolver/CMakeLists.txt +++ b/src/plugins/solver/KINSOLSolver/CMakeLists.txt @@ -4,6 +4,7 @@ PROJECT(KINSOLSolverPlugin) ADD_PLUGIN(KINSOLSolver SOURCES + ../../i18ninterface.cpp ../../plugininfo.cpp ../../solverinterface.cpp @@ -12,9 +13,10 @@ ADD_PLUGIN(KINSOLSolver HEADERS_MOC ../../solverinterface.h + src/kinsolsolver.h src/kinsolsolverplugin.h PLUGINS SUNDIALS QT_MODULES - Core + Widgets ) diff --git a/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts b/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts new file mode 100644 index 0000000000..7a263d87cb --- /dev/null +++ b/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts @@ -0,0 +1,31 @@ + + + + + OpenCOR::KINSOLSolver::KinsolSolver + + the "Maximum number of iterations" property value could not be retrieved + la valeur de la propriété "Nombre maximum d'itérations" n'a pas pu être retrouvée + + + the "Upper half-bandwidth" property must have a value between 0 and %1 + la propriété "Demi largeur de bande supérieure" doit avoir une valeur comprise entre 0 et %1 + + + the "Upper half-bandwidth" property value could not be retrieved + la valeur de la propriété "Demi largeur de bande supérieure" n'a pas pu être retrouvée + + + the "Lower half-bandwidth" property must have a value between 0 and %1 + la propriété "Demi largeur de bande inférieure" doit avoir une valeur comprise entre 0 et %1 + + + the "Lower half-bandwidth" property value could not be retrieved + la valeur de la propriété "Demi largeur de bande inférieure" n'a pas pu être retrouvée + + + the "Linear solver" property value could not be retrieved + la valeur de la propriété "Solveur linéaire" n'a pas pu être retrouvée + + + diff --git a/src/plugins/solver/KINSOLSolver/res/KINSOLSolver_i18n.qrc.in b/src/plugins/solver/KINSOLSolver/res/KINSOLSolver_i18n.qrc.in new file mode 100644 index 0000000000..818bd0347c --- /dev/null +++ b/src/plugins/solver/KINSOLSolver/res/KINSOLSolver_i18n.qrc.in @@ -0,0 +1,5 @@ + + + ${PROJECT_BUILD_DIR}/${PLUGIN_NAME}_fr.qm + + diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp index eb9e760e21..00122c7838 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp @@ -27,7 +27,12 @@ along with this program. If not, see . #include "kinsol/kinsol.h" #include "kinsol/kinsol_direct.h" +#include "kinsol/kinsol_spils.h" +#include "sunlinsol/sunlinsol_band.h" #include "sunlinsol/sunlinsol_dense.h" +#include "sunlinsol/sunlinsol_spbcgs.h" +#include "sunlinsol/sunlinsol_spgmr.h" +#include "sunlinsol/sunlinsol_sptfqmr.h" //============================================================================== @@ -134,14 +139,70 @@ void KinsolSolver::reset() //============================================================================== void KinsolSolver::initialize(ComputeSystemFunction pComputeSystem, - double *pParameters, int pSize, void *pUserData) + double *pParameters, const int &pSize, + void *pUserData) { // Reset things, if the solver has already been initialised if (mSolver) reset(); - // Initialise the ODE solver itself + // Retrieve some of the KINSOL properties + + int maximumNumberOfIterations = MaximumNumberOfIterationsDefaultValue; + QString linearSolver = LinearSolverDefaultValue; + int upperHalfBandwidth = UpperHalfBandwidthDefaultValue; + int lowerHalfBandwidth = LowerHalfBandwidthDefaultValue; + + if (mProperties.contains(MaximumNumberOfIterationsId)) { + maximumNumberOfIterations = mProperties.value(MaximumNumberOfIterationsId).toInt(); + } else { + emit error(tr("the \"Maximum number of iterations\" property value could not be retrieved")); + + return; + } + + if (mProperties.contains(LinearSolverId)) { + linearSolver = mProperties.value(LinearSolverId).toString(); + + if (!linearSolver.compare(BandedLinearSolver)) { + if (mProperties.contains(UpperHalfBandwidthId)) { + upperHalfBandwidth = mProperties.value(UpperHalfBandwidthId).toInt(); + + if ( (upperHalfBandwidth < 0) + || (upperHalfBandwidth >= pSize)) { + emit error(tr("the \"Upper half-bandwidth\" property must have a value between 0 and %1").arg(pSize-1)); + + return; + } + } else { + emit error(tr("the \"Upper half-bandwidth\" property value could not be retrieved")); + + return; + } + + if (mProperties.contains(LowerHalfBandwidthId)) { + lowerHalfBandwidth = mProperties.value(LowerHalfBandwidthId).toInt(); + + if ( (lowerHalfBandwidth < 0) + || (lowerHalfBandwidth >= pSize)) { + emit error(tr("the \"Lower half-bandwidth\" property must have a value between 0 and %1").arg(pSize-1)); + + return; + } + } else { + emit error(tr("the \"Lower half-bandwidth\" property value could not be retrieved")); + + return; + } + } + } else { + emit error(tr("the \"Linear solver\" property value could not be retrieved")); + + return; + } + + // Initialise the NLA solver itself OpenCOR::Solver::NlaSolver::initialize(pComputeSystem, pParameters, pSize); @@ -172,10 +233,35 @@ void KinsolSolver::initialize(ComputeSystemFunction pComputeSystem, // Set the linear solver - mMatrix = SUNDenseMatrix(pSize, pSize); - mLinearSolver = SUNDenseLinearSolver(mParametersVector, mMatrix); + if (!linearSolver.compare(DenseLinearSolver)) { + mMatrix = SUNDenseMatrix(pSize, pSize); + mLinearSolver = SUNDenseLinearSolver(mParametersVector, mMatrix); + + KINDlsSetLinearSolver(mSolver, mLinearSolver, mMatrix); + } else if (!linearSolver.compare(BandedLinearSolver)) { + mMatrix = SUNBandMatrix(pSize, + upperHalfBandwidth, lowerHalfBandwidth, + upperHalfBandwidth+lowerHalfBandwidth); + mLinearSolver = SUNBandLinearSolver(mParametersVector, mMatrix); + + KINDlsSetLinearSolver(mSolver, mLinearSolver, mMatrix); + } else if (!linearSolver.compare(GmresLinearSolver)) { + mLinearSolver = SUNSPGMR(mParametersVector, PREC_NONE, 0); + + KINSpilsSetLinearSolver(mSolver, mLinearSolver); + } else if (!linearSolver.compare(BiCgStabLinearSolver)) { + mLinearSolver = SUNSPBCGS(mParametersVector, PREC_NONE, 0); + + KINSpilsSetLinearSolver(mSolver, mLinearSolver); + } else { + mLinearSolver = SUNSPTFQMR(mParametersVector, PREC_NONE, 0); + + KINSpilsSetLinearSolver(mSolver, mLinearSolver); + } + + // Set the maximum number of iterations - KINDlsSetLinearSolver(mSolver, mLinearSolver, mMatrix); + KINSetNumMaxIters(mSolver, maximumNumberOfIterations); } //============================================================================== diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h index b8b52c5d27..cce3ffd1f2 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h @@ -40,6 +40,38 @@ namespace KINSOLSolver { //============================================================================== +static const auto MaximumNumberOfIterationsId = QStringLiteral("MaximumNumberOfIterations"); +static const auto LinearSolverId = QStringLiteral("LinearSolver"); +static const auto UpperHalfBandwidthId = QStringLiteral("UpperHalfBandwidth"); +static const auto LowerHalfBandwidthId = QStringLiteral("LowerHalfBandwidth"); + +//============================================================================== + +static const auto DenseLinearSolver = QStringLiteral("Dense"); +static const auto BandedLinearSolver = QStringLiteral("Banded"); +static const auto GmresLinearSolver = QStringLiteral("GMRES"); +static const auto BiCgStabLinearSolver = QStringLiteral("BiCGStab"); +static const auto TfqmrLinearSolver = QStringLiteral("TFQMR"); + +//============================================================================== + +// Default KINSOL parameter values +// Note: KINSOL's default maximum number of iterations is 200, which ought to be +// big enough in most cases... + +enum { + MaximumNumberOfIterationsDefaultValue = 200 +}; + +static const auto LinearSolverDefaultValue = DenseLinearSolver; + +enum { + UpperHalfBandwidthDefaultValue = 0, + LowerHalfBandwidthDefaultValue = 0 +}; + +//============================================================================== + class KinsolSolverUserData { public: @@ -47,32 +79,40 @@ class KinsolSolverUserData void *pUserData); Solver::NlaSolver::ComputeSystemFunction computeSystem() const; + void * userData() const; private: Solver::NlaSolver::ComputeSystemFunction mComputeSystem; + void *mUserData; }; //============================================================================== -class KinsolSolver : public Solver::NlaSolver +class KinsolSolver : public OpenCOR::Solver::NlaSolver { + Q_OBJECT + public: explicit KinsolSolver(); ~KinsolSolver(); virtual void initialize(ComputeSystemFunction pComputeSystem, - double *pParameters, int pSize, void *pUserData); + double *pParameters, const int &pSize, + void *pUserData); virtual void solve() const; private: void *mSolver; + N_Vector mParametersVector; N_Vector mOnesVector; + SUNMatrix mMatrix; SUNLinearSolver mLinearSolver; + KinsolSolverUserData *mUserData; void reset(); diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp b/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp index 2f97dab182..d6e16a582a 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp @@ -43,6 +43,18 @@ PLUGININFO_FUNC KINSOLSolverPluginInfo() descriptions); } +//============================================================================== +// I18n interface +//============================================================================== + +void KINSOLSolverPlugin::retranslateUi() +{ + // We don't handle this interface... + // Note: even though we don't handle this interface, we still want to + // support it since some other aspects of our plugin are + // multilingual... +} + //============================================================================== // Solver interface //============================================================================== @@ -62,6 +74,14 @@ QString KINSOLSolverPlugin::id(const QString &pKisaoId) const if (!pKisaoId.compare("KISAO:0000282")) return solverName(); + else if (!pKisaoId.compare("KISAO:0000486")) + return MaximumNumberOfIterationsId; + else if (!pKisaoId.compare("KISAO:0000477")) + return LinearSolverId; + else if (!pKisaoId.compare("KISAO:0000479")) + return UpperHalfBandwidthId; + else if (!pKisaoId.compare("KISAO:0000480")) + return LowerHalfBandwidthId; return QString(); } @@ -74,6 +94,14 @@ QString KINSOLSolverPlugin::kisaoId(const QString &pId) const if (!pId.compare(solverName())) return "KISAO:0000282"; + else if (!pId.compare(MaximumNumberOfIterationsId)) + return "KISAO:0000486"; + else if (!pId.compare(LinearSolverId)) + return "KISAO:0000477"; + else if (!pId.compare(UpperHalfBandwidthId)) + return "KISAO:0000479"; + else if (!pId.compare(LowerHalfBandwidthId)) + return "KISAO:0000480"; return QString(); } @@ -100,20 +128,61 @@ QString KINSOLSolverPlugin::solverName() const Solver::Properties KINSOLSolverPlugin::solverProperties() const { - // Return the properties supported by the solver, i.e. none in our case + // Return the properties supported by the solver + + Descriptions MaximumNumberOfIterationsDescriptions; + Descriptions LinearSolverDescriptions; + Descriptions UpperHalfBandwidthDescriptions; + Descriptions LowerHalfBandwidthDescriptions; + + MaximumNumberOfIterationsDescriptions.insert("en", QString::fromUtf8("Maximum number of iterations")); + MaximumNumberOfIterationsDescriptions.insert("fr", QString::fromUtf8("Nombre maximum d'itérations")); - return Solver::Properties(); + LinearSolverDescriptions.insert("en", QString::fromUtf8("Linear solver")); + LinearSolverDescriptions.insert("fr", QString::fromUtf8("Solveur linéaire")); + + UpperHalfBandwidthDescriptions.insert("en", QString::fromUtf8("Upper half-bandwidth")); + UpperHalfBandwidthDescriptions.insert("fr", QString::fromUtf8("Demi largeur de bande supérieure")); + + LowerHalfBandwidthDescriptions.insert("en", QString::fromUtf8("Lower half-bandwidth")); + LowerHalfBandwidthDescriptions.insert("fr", QString::fromUtf8("Demi largeur de bande inférieure")); + + QStringList LinearSolverListValues = QStringList() << DenseLinearSolver + << BandedLinearSolver + << GmresLinearSolver + << BiCgStabLinearSolver + << TfqmrLinearSolver; + + return Solver::Properties() << Solver::Property(Solver::Property::Integer, MaximumNumberOfIterationsId, MaximumNumberOfIterationsDescriptions, QStringList(), MaximumNumberOfIterationsDefaultValue, false) + << Solver::Property(Solver::Property::List, LinearSolverId, LinearSolverDescriptions, LinearSolverListValues, LinearSolverDefaultValue, false) + << Solver::Property(Solver::Property::Integer, UpperHalfBandwidthId, UpperHalfBandwidthDescriptions, QStringList(), UpperHalfBandwidthDefaultValue, false) + << Solver::Property(Solver::Property::Integer, LowerHalfBandwidthId, LowerHalfBandwidthDescriptions, QStringList(), LowerHalfBandwidthDefaultValue, false); } //============================================================================== QMap KINSOLSolverPlugin::solverPropertiesVisibility(const QMap &pSolverPropertiesValues) const { - Q_UNUSED(pSolverPropertiesValues); + // Return the visibility of our properties based on the given properties + // values - // We don't handle this interface... + QMap res = QMap(); + + QString linearSolver = pSolverPropertiesValues.value(LinearSolverId); + + if (!linearSolver.compare(BandedLinearSolver)) { + // Banded linear solver + + res.insert(UpperHalfBandwidthId, true); + res.insert(LowerHalfBandwidthId, true); + } else { + // Dense/GMRES/Bi-CGStab/TFQMR linear solver + + res.insert(UpperHalfBandwidthId, false); + res.insert(LowerHalfBandwidthId, false); + } - return QMap(); + return res; } //============================================================================== diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.h b/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.h index 3ccf9f07e1..cdce779e2f 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.h +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.h @@ -25,6 +25,7 @@ along with this program. If not, see . //============================================================================== +#include "i18ninterface.h" #include "plugininfo.h" #include "solverinterface.h" @@ -39,15 +40,18 @@ PLUGININFO_FUNC KINSOLSolverPluginInfo(); //============================================================================== -class KINSOLSolverPlugin : public QObject, public SolverInterface +class KINSOLSolverPlugin : public QObject, public I18nInterface, + public SolverInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "OpenCOR.KINSOLSolverPlugin" FILE "kinsolsolverplugin.json") + Q_INTERFACES(OpenCOR::I18nInterface) Q_INTERFACES(OpenCOR::SolverInterface) public: +#include "i18ninterface.inl" #include "solverinterface.inl" }; diff --git a/src/plugins/solver/SecondOrderRungeKuttaSolver/i18n/SecondOrderRungeKuttaSolver_fr.ts b/src/plugins/solver/SecondOrderRungeKuttaSolver/i18n/SecondOrderRungeKuttaSolver_fr.ts index caeee47201..e960289d7f 100644 --- a/src/plugins/solver/SecondOrderRungeKuttaSolver/i18n/SecondOrderRungeKuttaSolver_fr.ts +++ b/src/plugins/solver/SecondOrderRungeKuttaSolver/i18n/SecondOrderRungeKuttaSolver_fr.ts @@ -4,12 +4,12 @@ OpenCOR::SecondOrderRungeKuttaSolver::SecondOrderRungeKuttaSolver - the 'step' property value cannot be equal to zero - la valeur de la propriété 'pas' ne peut pas être égale à zéro + the "Step" property value cannot be equal to zero + la valeur de la propriété "Pas" ne peut pas être égale à zéro - the 'step' property value could not be retrieved - la valeur de la propriété 'pas' n'a pas pu être retrouvée + the "Step" property value could not be retrieved + la valeur de la propriété "Pas" n'a pas pu être retrouvée diff --git a/src/plugins/solver/SecondOrderRungeKuttaSolver/src/secondorderrungekuttasolver.cpp b/src/plugins/solver/SecondOrderRungeKuttaSolver/src/secondorderrungekuttasolver.cpp index 00313f0fe2..9b455dd7e2 100644 --- a/src/plugins/solver/SecondOrderRungeKuttaSolver/src/secondorderrungekuttasolver.cpp +++ b/src/plugins/solver/SecondOrderRungeKuttaSolver/src/secondorderrungekuttasolver.cpp @@ -60,12 +60,12 @@ void SecondOrderRungeKuttaSolver::initialize(const double &pVoiStart, mStep = mProperties.value(StepId).toDouble(); if (!mStep) { - emit error(tr("the 'step' property value cannot be equal to zero")); + emit error(tr("the \"Step\" property value cannot be equal to zero")); return; } } else { - emit error(tr("the 'step' property value could not be retrieved")); + emit error(tr("the \"Step\" property value could not be retrieved")); return; } diff --git a/src/plugins/solverinterface.cpp b/src/plugins/solverinterface.cpp index 2f8ca84fbb..ec12a9c184 100644 --- a/src/plugins/solverinterface.cpp +++ b/src/plugins/solverinterface.cpp @@ -223,7 +223,8 @@ NlaSolver::NlaSolver() : //============================================================================== void NlaSolver::initialize(ComputeSystemFunction pComputeSystem, - double *pParameters, int pSize, void *pUserData) + double *pParameters, const int &pSize, + void *pUserData) { // Initialise ourselves diff --git a/src/plugins/solverinterface.h b/src/plugins/solverinterface.h index 7fc2a18777..dfebbfb393 100644 --- a/src/plugins/solverinterface.h +++ b/src/plugins/solverinterface.h @@ -149,7 +149,7 @@ class NlaSolver : public Solver explicit NlaSolver(); virtual void initialize(ComputeSystemFunction pComputeSystem, - double *pParameters, int pSize, + double *pParameters, const int &pSize, void *pUserData = 0); virtual void solve() const = 0; diff --git a/src/plugins/support/CellMLSupport/tests/data/calcium transient.cellml b/src/plugins/support/CellMLSupport/tests/data/calcium_transient.cellml similarity index 100% rename from src/plugins/support/CellMLSupport/tests/data/calcium transient.cellml rename to src/plugins/support/CellMLSupport/tests/data/calcium_transient.cellml diff --git a/src/plugins/support/CellMLSupport/tests/tests.cpp b/src/plugins/support/CellMLSupport/tests/tests.cpp index c211bde934..3ab0ccba7b 100644 --- a/src/plugins/support/CellMLSupport/tests/tests.cpp +++ b/src/plugins/support/CellMLSupport/tests/tests.cpp @@ -125,7 +125,7 @@ void Tests::runtimeTests() // Finally, test a CellML file that has, according to the CellML API at // least, several variables of integration - doRuntimeTest(OpenCOR::fileName("src/plugins/support/CellMLSupport/tests/data/calcium transient.cellml"), + doRuntimeTest(OpenCOR::fileName("src/plugins/support/CellMLSupport/tests/data/calcium_transient.cellml"), "1.1", QStringList(), false); // Clean up after ourselves diff --git a/src/plugins/support/SimulationSupport/src/simulation.cpp b/src/plugins/support/SimulationSupport/src/simulation.cpp index f27bb7b41c..704b6c24a9 100644 --- a/src/plugins/support/SimulationSupport/src/simulation.cpp +++ b/src/plugins/support/SimulationSupport/src/simulation.cpp @@ -248,7 +248,8 @@ void SimulationData::setOdeSolverName(const QString &pOdeSolverName) { // Set our ODE solver name and reset its properties - if (mSimulation->runtime() && mSimulation->runtime()->needOdeSolver()) { + if ( pOdeSolverName.compare(mOdeSolverName) + && mSimulation->runtime() && mSimulation->runtime()->needOdeSolver()) { mOdeSolverName = pOdeSolverName; mOdeSolverProperties.clear(); @@ -301,7 +302,8 @@ void SimulationData::setDaeSolverName(const QString &pDaeSolverName) { // Set our DAE solver name and reset its properties - if (mSimulation->runtime() && mSimulation->runtime()->needDaeSolver()) { + if ( pDaeSolverName.compare(mDaeSolverName) + && mSimulation->runtime() && mSimulation->runtime()->needDaeSolver()) { mDaeSolverName = pDaeSolverName; mDaeSolverProperties.clear(); @@ -355,7 +357,8 @@ void SimulationData::setNlaSolverName(const QString &pNlaSolverName, { // Set our NLA solver name and reset its properties - if (mSimulation->runtime() && mSimulation->runtime()->needNlaSolver()) { + if ( pNlaSolverName.compare(mNlaSolverName) + && mSimulation->runtime() && mSimulation->runtime()->needNlaSolver()) { mNlaSolverName = pNlaSolverName; mNlaSolverProperties.clear();