Skip to content

Commit

Permalink
Fetch the solver methods from simulation_options.h
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Jun 25, 2015
1 parent 6127950 commit a1c898b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
14 changes: 14 additions & 0 deletions OMEdit/OMEditGUI/OMC/OMCProxy.cpp
Expand Up @@ -58,6 +58,7 @@ void omc_Main_setWindowsPaths(threadData_t *threadData, void* _inOMHome);
#include <iostream>

#include "OMCProxy.h"
#include "simulation_options.h"

static QVariant parseExpression(QString result)
{
Expand Down Expand Up @@ -2307,6 +2308,19 @@ QStringList OMCProxy::getEnumerationLiterals(QString className)
return enumerationLiterals;
}

/*!
* \brief OMCProxy::getSolverMethods
* Returns the list of solvers name and their description.
* \return
*/
void OMCProxy::getSolverMethods(QStringList *methods, QStringList *descriptions)
{
for (int i = S_UNKNOWN + 1 ; i < S_MAX ; i++) {
*methods << SOLVER_METHOD_NAME[i];
*descriptions << SOLVER_METHOD_DESC[i];
}
}

/*!
\class CustomExpressionBox
\brief A text box for executing OMC commands.
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/OMC/OMCProxy.h
Expand Up @@ -209,6 +209,7 @@ class OMCProxy : public QObject
bool exportToFigaro(QString className, QString directory, QString database, QString mode, QString options, QString processor);
bool copyClass(QString className, QString newClassName, QString withIn);
QStringList getEnumerationLiterals(QString className);
void getSolverMethods(QStringList *methods, QStringList *descriptions);
signals:
void commandFinished();
public slots:
Expand Down
3 changes: 2 additions & 1 deletion OMEdit/OMEditGUI/OMEditGUI.pro
Expand Up @@ -238,7 +238,8 @@ INCLUDEPATH += . \
TLM \
TransformationalDebugger \
Util \
$$OPENMODELICAHOME/include/omc/scripting-API
$$OPENMODELICAHOME/include/omc/scripting-API \
$$OPENMODELICAHOME/include/omc/c/util

OTHER_FILES += Resources/css/stylesheet.qss \
Resources/XMLSchema/tlmModelDescription.xsd \
Expand Down
29 changes: 12 additions & 17 deletions OMEdit/OMEditGUI/Simulation/SimulationDialog.cpp
Expand Up @@ -145,24 +145,19 @@ void SimulationDialog::setUpForm()
// Integration
mpIntegrationGroupBox = new QGroupBox(tr("Integration"));
mpMethodLabel = new Label(tr("Method:"));
// get the solver methods
QStringList solverMethods, solverMethodsDesc;
mpMainWindow->getOMCProxy()->getSolverMethods(&solverMethods, &solverMethodsDesc);
mpMethodComboBox = new QComboBox;
mpMethodComboBox->addItem("dassl");
mpMethodComboBox->setItemData(0, "dassl with colored numerical jacobian, with interval root finding", Qt::ToolTipRole);
mpMethodComboBox->addItem("euler");
mpMethodComboBox->addItem("rungekutta");
mpMethodComboBox->addItem("optimization");
mpMethodComboBox->addItem("radau1");
mpMethodComboBox->setItemData(4, "sundial/kinsol needed", Qt::ToolTipRole);
mpMethodComboBox->addItem("radau3");
mpMethodComboBox->setItemData(5, "sundial/kinsol needed", Qt::ToolTipRole);
mpMethodComboBox->addItem("radau5");
mpMethodComboBox->setItemData(6, "sundial/kinsol needed", Qt::ToolTipRole);
mpMethodComboBox->addItem("lobatto2");
mpMethodComboBox->setItemData(7, "sundial/kinsol needed", Qt::ToolTipRole);
mpMethodComboBox->addItem("lobatto4");
mpMethodComboBox->setItemData(8, "sundial/kinsol needed", Qt::ToolTipRole);
mpMethodComboBox->addItem("lobatto6");
mpMethodComboBox->setItemData(9, "sundial/kinsol needed", Qt::ToolTipRole);
mpMethodComboBox->addItems(solverMethods);
for (int i = 0 ; i < solverMethodsDesc.size() ; i++) {
mpMethodComboBox->setItemData(i, solverMethodsDesc.at(i), Qt::ToolTipRole);
}
// make dassl default solver method.
int currentIndex = mpMethodComboBox->findText("dassl", Qt::MatchExactly);
if (currentIndex > -1) {
mpMethodComboBox->setCurrentIndex(currentIndex);
}
connect(mpMethodComboBox, SIGNAL(currentIndexChanged(QString)), SLOT(enableDasslOptions(QString)));
mpMehtodHelpButton = new QToolButton;
mpMehtodHelpButton->setIcon(QIcon(":/Resources/icons/link-external.svg"));
Expand Down

0 comments on commit a1c898b

Please sign in to comment.