Skip to content

Commit

Permalink
Fetch the initialization methods, linear & non-linear solvers from si…
Browse files Browse the repository at this point in the history
…mulation_options.h
  • Loading branch information
adeas31 committed Jun 25, 2015
1 parent 31836b5 commit 860a0ef
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 10 deletions.
45 changes: 44 additions & 1 deletion OMEdit/OMEditGUI/OMC/OMCProxy.cpp
Expand Up @@ -2311,7 +2311,8 @@ QStringList OMCProxy::getEnumerationLiterals(QString className)
/*!
* \brief OMCProxy::getSolverMethods
* Returns the list of solvers name and their description.
* \return
* \param methods
* \param descriptions
*/
void OMCProxy::getSolverMethods(QStringList *methods, QStringList *descriptions)
{
Expand All @@ -2321,6 +2322,48 @@ void OMCProxy::getSolverMethods(QStringList *methods, QStringList *descriptions)
}
}

/*!
* \brief OMCProxy::getInitializationMethods
* Returns the list of initialization methods name and their description.
* \param methods
* \param descriptions
*/
void OMCProxy::getInitializationMethods(QStringList *methods, QStringList *descriptions)
{
for (int i = IIM_UNKNOWN + 1 ; i < IIM_MAX ; i++) {
*methods << INIT_METHOD_NAME[i];
*descriptions << INIT_METHOD_DESC[i];
}
}

/*!
* \brief OMCProxy::getLinearSolvers
* Returns the list of linear solvers name and their description.
* \param methods
* \param descriptions
*/
void OMCProxy::getLinearSolvers(QStringList *methods, QStringList *descriptions)
{
for (int i = LS_NONE + 1 ; i < LS_MAX ; i++) {
*methods << LS_NAME[i];
*descriptions << LS_DESC[i];
}
}

/*!
* \brief OMCProxy::getNonLinearSolvers
* Returns the list of non-linear solvers name and their description.
* \param methods
* \param descriptions
*/
void OMCProxy::getNonLinearSolvers(QStringList *methods, QStringList *descriptions)
{
for (int i = NLS_NONE + 1 ; i < NLS_MAX ; i++) {
*methods << NLS_NAME[i];
*descriptions << NLS_DESC[i];
}
}

/*!
\class CustomExpressionBox
\brief A text box for executing OMC commands.
Expand Down
3 changes: 3 additions & 0 deletions OMEdit/OMEditGUI/OMC/OMCProxy.h
Expand Up @@ -210,6 +210,9 @@ class OMCProxy : public QObject
bool copyClass(QString className, QString newClassName, QString withIn);
QStringList getEnumerationLiterals(QString className);
void getSolverMethods(QStringList *methods, QStringList *descriptions);
void getInitializationMethods(QStringList *methods, QStringList *descriptions);
void getLinearSolvers(QStringList *methods, QStringList *descriptions);
void getNonLinearSolvers(QStringList *methods, QStringList *descriptions);
signals:
void commandFinished();
public slots:
Expand Down
30 changes: 27 additions & 3 deletions OMEdit/OMEditGUI/Simulation/SimulationDialog.cpp
Expand Up @@ -329,8 +329,16 @@ void SimulationDialog::setUpForm()
// Initialization Methods
mpInitializationMethodLabel = new Label(tr("Initialization Method (Optional):"));
mpInitializationMethodLabel->setToolTip(tr("Specifies the initialization method."));
// get the initialization methods
QStringList initializationMethods, initializationMethodsDesc;
mpMainWindow->getOMCProxy()->getInitializationMethods(&initializationMethods, &initializationMethodsDesc);
initializationMethods.prepend("");
initializationMethodsDesc.prepend("");
mpInitializationMethodComboBox = new QComboBox;
mpInitializationMethodComboBox->addItems(Helper::ModelicaInitializationMethods.toLower().split(","));
mpInitializationMethodComboBox->addItems(initializationMethods);
for (int i = 0 ; i < initializationMethodsDesc.size() ; i++) {
mpInitializationMethodComboBox->setItemData(i, initializationMethodsDesc.at(i), Qt::ToolTipRole);
}
// Equation System Initialization File
mpEquationSystemInitializationFileLabel = new Label(tr("Equation System Initialization File (Optional):"));
mpEquationSystemInitializationFileLabel->setToolTip(tr("Specifies an external file for the initialization of the model."));
Expand All @@ -348,12 +356,28 @@ void SimulationDialog::setUpForm()
mpClockComboBox->addItems(Helper::clockOptions.split(","));
// Linear Solvers
mpLinearSolverLabel = new Label(tr("Linear Solver (Optional):"));
// get the linear solvers
QStringList linearSolverMethods, linearSolverMethodsDesc;
mpMainWindow->getOMCProxy()->getLinearSolvers(&linearSolverMethods, &linearSolverMethodsDesc);
linearSolverMethods.prepend("");
linearSolverMethodsDesc.prepend("");
mpLinearSolverComboBox = new QComboBox;
mpLinearSolverComboBox->addItems(Helper::linearSolvers.split(","));
mpLinearSolverComboBox->addItems(linearSolverMethods);
for (int i = 0 ; i < linearSolverMethodsDesc.size() ; i++) {
mpLinearSolverComboBox->setItemData(i, linearSolverMethodsDesc.at(i), Qt::ToolTipRole);
}
// Non Linear Solvers
mpNonLinearSolverLabel = new Label(tr("Non Linear Solver (Optional):"));
// get the non-linear solvers
QStringList nonLinearSolverMethods, nonLinearSolverMethodsDesc;
mpMainWindow->getOMCProxy()->getNonLinearSolvers(&nonLinearSolverMethods, &nonLinearSolverMethodsDesc);
nonLinearSolverMethods.prepend("");
nonLinearSolverMethodsDesc.prepend("");
mpNonLinearSolverComboBox = new QComboBox;
mpNonLinearSolverComboBox->addItems(Helper::nonLinearSolvers.split(","));
mpNonLinearSolverComboBox->addItems(nonLinearSolverMethods);
for (int i = 0 ; i < nonLinearSolverMethodsDesc.size() ; i++) {
mpNonLinearSolverComboBox->setItemData(i, nonLinearSolverMethodsDesc.at(i), Qt::ToolTipRole);
}
// time where the linearization of the model should be performed
mpLinearizationTimeLabel = new Label(tr("Linearization Time (Optional):"));
mpLinearizationTimeTextBox = new QLineEdit;
Expand Down
3 changes: 0 additions & 3 deletions OMEdit/OMEditGUI/Util/Helper.cpp
Expand Up @@ -74,11 +74,8 @@ QString Helper::modelicaComponentFormat = "image/modelica-component";
QString Helper::modelicaFileFormat = "text/uri-list";
qreal Helper::shapesStrokeWidth = 2.0;
int Helper::headingFontSize = 18;
QString Helper::ModelicaInitializationMethods = ",none,symbolic";
QString Helper::ModelicaSimulationOutputFormats = "mat,plt,csv";
QString Helper::clockOptions = ",RT,CYC,CPU";
QString Helper::linearSolvers = ",lapack";
QString Helper::nonLinearSolvers = ",hybrid,kinsol,newton";
QString Helper::notificationLevel = ".OpenModelica.Scripting.ErrorLevel.notification";
QString Helper::warningLevel = ".OpenModelica.Scripting.ErrorLevel.warning";
QString Helper::errorLevel = ".OpenModelica.Scripting.ErrorLevel.error";
Expand Down
3 changes: 0 additions & 3 deletions OMEdit/OMEditGUI/Util/Helper.h
Expand Up @@ -81,11 +81,8 @@ class Helper : public QObject
static QString modelicaFileFormat;
static qreal shapesStrokeWidth;
static int headingFontSize;
static QString ModelicaInitializationMethods;
static QString ModelicaSimulationOutputFormats;
static QString clockOptions;
static QString linearSolvers;
static QString nonLinearSolvers;
static QString notificationLevel;
static QString warningLevel;
static QString errorLevel;
Expand Down

0 comments on commit 860a0ef

Please sign in to comment.