From 661c98b4ddd711374da835f71b7cd1b6555e097e Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 5 Jan 2018 17:38:11 +0100 Subject: [PATCH 01/21] KINSOL solver: settings things up for customisation (#1510). --- src/plugins/solver/KINSOLSolver/CMakeLists.txt | 4 +++- .../solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts | 4 ++++ .../solver/KINSOLSolver/res/KINSOLSolver_i18n.qrc.in | 5 +++++ .../solver/KINSOLSolver/src/kinsolsolverplugin.cpp | 12 ++++++++++++ .../solver/KINSOLSolver/src/kinsolsolverplugin.h | 6 +++++- 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts create mode 100644 src/plugins/solver/KINSOLSolver/res/KINSOLSolver_i18n.qrc.in 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..059d9c6e97 --- /dev/null +++ b/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts @@ -0,0 +1,4 @@ + + + + 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/kinsolsolverplugin.cpp b/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp index 2f97dab182..f79230ee11 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 //============================================================================== 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" }; From 51a8de2ab82e3ed4f560158dbd7a70ffc066022c Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 5 Jan 2018 18:07:50 +0100 Subject: [PATCH 02/21] Some minor cleaning up. --- src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp index eb9e760e21..8d96b04bcd 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp @@ -141,7 +141,7 @@ void KinsolSolver::initialize(ComputeSystemFunction pComputeSystem, if (mSolver) reset(); - // Initialise the ODE solver itself + // Initialise the NLA solver itself OpenCOR::Solver::NlaSolver::initialize(pComputeSystem, pParameters, pSize); From 96fc4fa6541295f8e9c2f19dfb21e69c53fc8fc4 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 5 Jan 2018 20:04:39 +0100 Subject: [PATCH 03/21] Some minor cleaning up. --- src/plugins/solver/CVODESSolver/src/cvodessolver.h | 4 ++-- src/plugins/solver/IDASSolver/src/idassolver.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/solver/CVODESSolver/src/cvodessolver.h b/src/plugins/solver/CVODESSolver/src/cvodessolver.h index 52e9c31d09..dbd1f8ed3d 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; diff --git a/src/plugins/solver/IDASSolver/src/idassolver.h b/src/plugins/solver/IDASSolver/src/idassolver.h index b4dc6d36dd..c6a247a21f 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; From 596c7a0394cb39eaa7117bf0613c5c4a398a4703 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 5 Jan 2018 23:08:27 +0100 Subject: [PATCH 04/21] Simulation class: make sure that we only update a solver' name when actually needed (#1510). Indeed, when it comes to our NLA solver, to update its name may result in our NLA solver being reset, which then causes problems when it comes to its properties (none can be found anymore). --- src/plugins/support/SimulationSupport/src/simulation.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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(); From 13c9f5ec677e71aa58c4a7b41e26374345ae3074 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 5 Jan 2018 23:16:09 +0100 Subject: [PATCH 05/21] KINSOL solver: added the "Maximum number of iterations" property (#1510). --- .../solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts | 7 +++++++ .../solver/KINSOLSolver/src/kinsolsolver.cpp | 16 ++++++++++++++++ .../solver/KINSOLSolver/src/kinsolsolver.h | 14 ++++++++++++++ .../KINSOLSolver/src/kinsolsolverplugin.cpp | 13 +++++++++++-- 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts b/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts index 059d9c6e97..de85dfcd18 100644 --- a/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts +++ b/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts @@ -1,4 +1,11 @@ + + 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 + + diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp index 8d96b04bcd..f709cfba68 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp @@ -141,6 +141,18 @@ void KinsolSolver::initialize(ComputeSystemFunction pComputeSystem, if (mSolver) reset(); + // Retrieve some of the KINSOL properties + + int maximumNumberOfIterations = MaximumNumberOfIterationsDefaultValue; + + 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; + } + // Initialise the NLA solver itself OpenCOR::Solver::NlaSolver::initialize(pComputeSystem, pParameters, pSize); @@ -170,6 +182,10 @@ void KinsolSolver::initialize(ComputeSystemFunction pComputeSystem, KINSetUserData(mSolver, mUserData); + // Set the maximum number of steps + + KINSetNumMaxIters(mSolver, maximumNumberOfIterations); + // Set the linear solver mMatrix = SUNDenseMatrix(pSize, pSize); diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h index b8b52c5d27..0cedf5a18e 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h @@ -40,6 +40,20 @@ namespace KINSOLSolver { //============================================================================== +static const auto MaximumNumberOfIterationsId = QStringLiteral("MaximumNumberOfIterations"); + +//============================================================================== + +// 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 +}; + +//============================================================================== + class KinsolSolverUserData { public: diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp b/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp index f79230ee11..d3fbe6b45f 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp @@ -74,6 +74,8 @@ QString KINSOLSolverPlugin::id(const QString &pKisaoId) const if (!pKisaoId.compare("KISAO:0000282")) return solverName(); + else if (!pKisaoId.compare("KISAO:0000486")) + return MaximumNumberOfIterationsId; return QString(); } @@ -86,6 +88,8 @@ QString KINSOLSolverPlugin::kisaoId(const QString &pId) const if (!pId.compare(solverName())) return "KISAO:0000282"; + else if (!pId.compare(MaximumNumberOfIterationsId)) + return "KISAO:0000486"; return QString(); } @@ -112,9 +116,14 @@ 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 - return Solver::Properties(); + Descriptions MaximumNumberOfIterationsDescriptions; + + MaximumNumberOfIterationsDescriptions.insert("en", QString::fromUtf8("Maximum number of iterations")); + MaximumNumberOfIterationsDescriptions.insert("fr", QString::fromUtf8("Nombre maximum d'itérations")); + + return Solver::Properties() << Solver::Property(Solver::Property::Integer, MaximumNumberOfIterationsId, MaximumNumberOfIterationsDescriptions, QStringList(), MaximumNumberOfIterationsDefaultValue, false); } //============================================================================== From 4fa42b528cd3dd122fadd1c94d2f43103bbb5b92 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Fri, 5 Jan 2018 23:58:09 +0100 Subject: [PATCH 06/21] Solvers: use double quotes rather than single quotes in property error messages. --- .../CVODESSolver/i18n/CVODESSolver_fr.ts | 60 +++++++++---------- .../solver/CVODESSolver/src/cvodessolver.cpp | 30 +++++----- .../i18n/ForwardEulerSolver_fr.ts | 8 +-- .../src/forwardeulersolver.cpp | 4 +- .../i18n/FourthOrderRungeKuttaSolver_fr.ts | 8 +-- .../src/fourthorderrungekuttasolver.cpp | 4 +- .../solver/HeunSolver/i18n/HeunSolver_fr.ts | 8 +-- .../solver/HeunSolver/src/heunsolver.cpp | 4 +- .../solver/IDASSolver/i18n/IDASSolver_fr.ts | 48 +++++++-------- .../solver/IDASSolver/src/idassolver.cpp | 24 ++++---- .../KINSOLSolver/i18n/KINSOLSolver_fr.ts | 4 +- .../solver/KINSOLSolver/src/kinsolsolver.cpp | 2 +- .../i18n/SecondOrderRungeKuttaSolver_fr.ts | 8 +-- .../src/secondorderrungekuttasolver.cpp | 4 +- 14 files changed, 108 insertions(+), 108 deletions(-) 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/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/KINSOLSolver/i18n/KINSOLSolver_fr.ts b/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts index de85dfcd18..403f468f8a 100644 --- a/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts +++ b/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts @@ -4,8 +4,8 @@ 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 "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 diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp index f709cfba68..7eba95e6f0 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp @@ -148,7 +148,7 @@ void KinsolSolver::initialize(ComputeSystemFunction pComputeSystem, if (mProperties.contains(MaximumNumberOfIterationsId)) { maximumNumberOfIterations = mProperties.value(MaximumNumberOfIterationsId).toInt(); } else { - emit error(tr("the 'maximum number of iterations' property value could not be retrieved")); + emit error(tr("the \"Maximum number of iterations\" property value could not be retrieved")); return; } 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; } From 7e17fd6f658ee8e3e52de8e82def44a8ef8f7c5e Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Sat, 6 Jan 2018 00:17:17 +0100 Subject: [PATCH 07/21] CellML support: renamed one of our test CellML files. --- .../data/{calcium transient.cellml => calcium_transient.cellml} | 0 src/plugins/support/CellMLSupport/tests/tests.cpp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/plugins/support/CellMLSupport/tests/data/{calcium transient.cellml => calcium_transient.cellml} (100%) 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 From 6c1e5a4d4bf11cedab68d5811cf4bab32f83ab1e Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Sat, 6 Jan 2018 18:32:08 +0100 Subject: [PATCH 08/21] KINSOL solver: added Q_OBJECT to our KinsolSolver class (#1510). --- src/plugins/solver/KINSOLSolver/src/kinsolsolver.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h index 0cedf5a18e..a260a0b005 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h @@ -72,6 +72,8 @@ class KinsolSolverUserData class KinsolSolver : public Solver::NlaSolver { + Q_OBJECT + public: explicit KinsolSolver(); ~KinsolSolver(); From 3c394b40c92bb30d3fadec2c09b9c62f8bd19168 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Sat, 6 Jan 2018 19:04:34 +0100 Subject: [PATCH 09/21] Some minor cleaning up. --- src/plugins/solver/CVODESSolver/src/cvodessolver.h | 3 +++ src/plugins/solver/IDASSolver/src/idassolver.h | 3 +++ src/plugins/solver/KINSOLSolver/src/kinsolsolver.h | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/src/plugins/solver/CVODESSolver/src/cvodessolver.h b/src/plugins/solver/CVODESSolver/src/cvodessolver.h index dbd1f8ed3d..77d43da909 100644 --- a/src/plugins/solver/CVODESSolver/src/cvodessolver.h +++ b/src/plugins/solver/CVODESSolver/src/cvodessolver.h @@ -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/IDASSolver/src/idassolver.h b/src/plugins/solver/IDASSolver/src/idassolver.h index c6a247a21f..c5a2640e28 100644 --- a/src/plugins/solver/IDASSolver/src/idassolver.h +++ b/src/plugins/solver/IDASSolver/src/idassolver.h @@ -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/KINSOLSolver/src/kinsolsolver.h b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h index a260a0b005..a1fc0ff5d2 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h @@ -61,10 +61,12 @@ class KinsolSolverUserData void *pUserData); Solver::NlaSolver::ComputeSystemFunction computeSystem() const; + void * userData() const; private: Solver::NlaSolver::ComputeSystemFunction mComputeSystem; + void *mUserData; }; @@ -85,10 +87,13 @@ class KinsolSolver : public Solver::NlaSolver private: void *mSolver; + N_Vector mParametersVector; N_Vector mOnesVector; + SUNMatrix mMatrix; SUNLinearSolver mLinearSolver; + KinsolSolverUserData *mUserData; void reset(); From 05c6f29ceb19d0d09257a950420ca5bfad78a712 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Sat, 6 Jan 2018 20:19:22 +0100 Subject: [PATCH 10/21] KINSOL solver: make sure that commit 6c1e5a4 can compile fine. --- src/plugins/solver/KINSOLSolver/src/kinsolsolver.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h index a1fc0ff5d2..33c536050b 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h @@ -72,7 +72,7 @@ class KinsolSolverUserData //============================================================================== -class KinsolSolver : public Solver::NlaSolver +class KinsolSolver : public OpenCOR::Solver::NlaSolver { Q_OBJECT From 74b8f4b2f979e133b0e1137f7e37e06a3114bf99 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Sat, 6 Jan 2018 20:57:54 +0100 Subject: [PATCH 11/21] Some minor cleaning up. --- .../src/simulationexperimentviewsimulationwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp index 7595e23064..8300bd5303 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()); From 39a0b47db83952e170df52c39184beda814a596b Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 8 Jan 2018 10:50:51 +0100 Subject: [PATCH 12/21] Simulation Experiment view: make sure that we properly export an NLA solver's properties to SED-ML (#1510). --- .../src/simulationexperimentviewsimulationwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp index 8300bd5303..f376e17435 100644 --- a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp +++ b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp @@ -1595,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, From b2829598d01d9941d6aa4189c0327b859867c708 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 8 Jan 2018 14:18:48 +0100 Subject: [PATCH 13/21] Simulation Experiment view: make sure that NLA solver properties are properly read from a SED-ML file / COMBINE archive (#1510). --- ...mulationexperimentviewsimulationwidget.cpp | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp index f376e17435..db02aff1eb 100644 --- a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp +++ b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp @@ -2636,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; @@ -2649,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; + } } } From 741de23dfb9d70fa3b895c3d60a5a8041ddc28f3 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 8 Jan 2018 14:51:07 +0100 Subject: [PATCH 14/21] Some minor cleaning up. --- src/plugins/solver/IDASSolver/src/idassolverplugin.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/solver/IDASSolver/src/idassolverplugin.cpp b/src/plugins/solver/IDASSolver/src/idassolverplugin.cpp index 3a4d814b74..58a5afb035 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... From 4d13fd458c5d4e8e0aa5693e06ef08114b49b317 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 8 Jan 2018 14:51:37 +0100 Subject: [PATCH 15/21] Some minor cleaning up. --- src/plugins/solver/IDASSolver/src/idassolverplugin.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/solver/IDASSolver/src/idassolverplugin.cpp b/src/plugins/solver/IDASSolver/src/idassolverplugin.cpp index 58a5afb035..ee8165e936 100644 --- a/src/plugins/solver/IDASSolver/src/idassolverplugin.cpp +++ b/src/plugins/solver/IDASSolver/src/idassolverplugin.cpp @@ -59,7 +59,6 @@ void IDASSolverPlugin::retranslateUi() // Solver interface //============================================================================== - Solver::Solver * IDASSolverPlugin::solverInstance() const { // Create and return an instance of the solver From 82f4e4c7df5fb6b24e8c5b4c74072f9852226ede Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 8 Jan 2018 15:54:30 +0100 Subject: [PATCH 16/21] Simulation Experiment view: can now specify different linear solvers for KINSOL (#1510). --- ...experimentviewinformationsolverswidget.cpp | 4 +- .../solver/KINSOLSolver/src/kinsolsolver.cpp | 81 +++++++++++++++++-- .../solver/KINSOLSolver/src/kinsolsolver.h | 18 +++++ .../KINSOLSolver/src/kinsolsolverplugin.cpp | 56 ++++++++++++- 4 files changed, 146 insertions(+), 13 deletions(-) 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/solver/KINSOLSolver/src/kinsolsolver.cpp b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp index 7eba95e6f0..404b4d6de9 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" //============================================================================== @@ -144,6 +149,9 @@ void KinsolSolver::initialize(ComputeSystemFunction pComputeSystem, // 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(); @@ -153,6 +161,46 @@ void KinsolSolver::initialize(ComputeSystemFunction pComputeSystem, 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); @@ -182,16 +230,37 @@ void KinsolSolver::initialize(ComputeSystemFunction pComputeSystem, KINSetUserData(mSolver, mUserData); - // Set the maximum number of steps + // Set the linear solver - KINSetNumMaxIters(mSolver, maximumNumberOfIterations); + if (!linearSolver.compare(DenseLinearSolver)) { + mMatrix = SUNDenseMatrix(pSize, pSize); + mLinearSolver = SUNDenseLinearSolver(mParametersVector, mMatrix); - // Set the linear solver + 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_BOTH, 0); - mMatrix = SUNDenseMatrix(pSize, pSize); - mLinearSolver = SUNDenseLinearSolver(mParametersVector, mMatrix); + KINSpilsSetLinearSolver(mSolver, mLinearSolver); + } else if (!linearSolver.compare(BiCgStabLinearSolver)) { + mLinearSolver = SUNSPBCGS(mParametersVector, PREC_BOTH, 0); - KINDlsSetLinearSolver(mSolver, mLinearSolver, mMatrix); + KINSpilsSetLinearSolver(mSolver, mLinearSolver); + } else { + mLinearSolver = SUNSPTFQMR(mParametersVector, PREC_BOTH, 0); + + KINSpilsSetLinearSolver(mSolver, mLinearSolver); + } + + // Set the maximum number of iterations + + KINSetNumMaxIters(mSolver, maximumNumberOfIterations); } //============================================================================== diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h index 33c536050b..6d2d6301a0 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h @@ -41,6 +41,17 @@ 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"); //============================================================================== @@ -52,6 +63,13 @@ enum { MaximumNumberOfIterationsDefaultValue = 200 }; +static const auto LinearSolverDefaultValue = DenseLinearSolver; + +enum { + UpperHalfBandwidthDefaultValue = 0, + LowerHalfBandwidthDefaultValue = 0 +}; + //============================================================================== class KinsolSolverUserData diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp b/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp index d3fbe6b45f..d6e16a582a 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolverplugin.cpp @@ -76,6 +76,12 @@ QString KINSOLSolverPlugin::id(const QString &pKisaoId) const 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(); } @@ -90,6 +96,12 @@ QString KINSOLSolverPlugin::kisaoId(const QString &pId) const 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(); } @@ -119,22 +131,58 @@ Solver::Properties KINSOLSolverPlugin::solverProperties() const // 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() << Solver::Property(Solver::Property::Integer, MaximumNumberOfIterationsId, MaximumNumberOfIterationsDescriptions, QStringList(), MaximumNumberOfIterationsDefaultValue, false); + 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; } //============================================================================== From f145c4d8524139c0dfbcdd6e902536a5d99d1718 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 8 Jan 2018 15:58:34 +0100 Subject: [PATCH 17/21] Some minor cleaning up. --- src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp | 3 ++- src/plugins/solver/KINSOLSolver/src/kinsolsolver.h | 3 ++- src/plugins/solverinterface.cpp | 3 ++- src/plugins/solverinterface.h | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp index 404b4d6de9..4c2bd3eb1c 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp @@ -139,7 +139,8 @@ 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 diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h index 6d2d6301a0..cce3ffd1f2 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.h @@ -99,7 +99,8 @@ class KinsolSolver : public OpenCOR::Solver::NlaSolver ~KinsolSolver(); virtual void initialize(ComputeSystemFunction pComputeSystem, - double *pParameters, int pSize, void *pUserData); + double *pParameters, const int &pSize, + void *pUserData); virtual void solve() const; 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; From df3f62a51b7703a2b22fb7e16022f79009b85dee Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 8 Jan 2018 16:21:48 +0100 Subject: [PATCH 18/21] Simulation Experiment view: can now specify different linear solvers for KINSOL (#1510). --- src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp index 4c2bd3eb1c..00122c7838 100644 --- a/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp +++ b/src/plugins/solver/KINSOLSolver/src/kinsolsolver.cpp @@ -246,15 +246,15 @@ void KinsolSolver::initialize(ComputeSystemFunction pComputeSystem, KINDlsSetLinearSolver(mSolver, mLinearSolver, mMatrix); } else if (!linearSolver.compare(GmresLinearSolver)) { - mLinearSolver = SUNSPGMR(mParametersVector, PREC_BOTH, 0); + mLinearSolver = SUNSPGMR(mParametersVector, PREC_NONE, 0); KINSpilsSetLinearSolver(mSolver, mLinearSolver); } else if (!linearSolver.compare(BiCgStabLinearSolver)) { - mLinearSolver = SUNSPBCGS(mParametersVector, PREC_BOTH, 0); + mLinearSolver = SUNSPBCGS(mParametersVector, PREC_NONE, 0); KINSpilsSetLinearSolver(mSolver, mLinearSolver); } else { - mLinearSolver = SUNSPTFQMR(mParametersVector, PREC_BOTH, 0); + mLinearSolver = SUNSPTFQMR(mParametersVector, PREC_NONE, 0); KINSpilsSetLinearSolver(mSolver, mLinearSolver); } From 1329405594695224b0b394d9cddb9867f1952a15 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 8 Jan 2018 16:34:48 +0100 Subject: [PATCH 19/21] Some minor cleaning up. --- doc/user/whatIsNew.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/user/whatIsNew.js b/doc/user/whatIsNew.js index 33f1f93492..14191520e2 100644 --- a/doc/user/whatIsNew.js +++ b/doc/user/whatIsNew.js @@ -93,12 +93,12 @@ 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." } ] } ] From 3c03a9292ec8837f1c80b3dde2e08828b1a23f9c Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 8 Jan 2018 16:35:13 +0100 Subject: [PATCH 20/21] Slight updates to our downloads and what is new pages (#1510). --- doc/downloads/index.js | 1 + doc/user/whatIsNew.js | 5 +++++ 2 files changed, 6 insertions(+) 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 14191520e2..9309f0f5c2 100644 --- a/doc/user/whatIsNew.js +++ b/doc/user/whatIsNew.js @@ -100,6 +100,11 @@ var jsonData = { "versions": [ "entries": [ { "type": "Added", "description": "Support for sensitivity analysis." } ] + }, + { "type": "subCategory", "name": "KINSOL solver", + "entries": [ + { "type": "Added", "description": "Parametrisation of the solver." } + ] } ] }, From 61bba930c32e2081bdbda07f6bb53a1e7119c662 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 8 Jan 2018 16:48:12 +0100 Subject: [PATCH 21/21] KINSOL solver: added French translations (#1510). --- .../KINSOLSolver/i18n/KINSOLSolver_fr.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts b/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts index 403f468f8a..7a263d87cb 100644 --- a/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts +++ b/src/plugins/solver/KINSOLSolver/i18n/KINSOLSolver_fr.ts @@ -7,5 +7,25 @@ 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 +