Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Workflow/EXECUTION/RunPythonInThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RunPythonInThread::RunPythonInThread(const QString &theScript, const QStringList
void
RunPythonInThread::runProcess(void) {

RunPython *worker = new RunPython(script, args, workDir);
worker = new RunPython(script, args, workDir);
worker->moveToThread(&workerThread);

//
Expand Down Expand Up @@ -84,6 +84,13 @@ RunPythonInThread::statusMessage(const QString &message) {

}

void
RunPythonInThread::terminateProcess(void) {
if (worker != nullptr) {
QMetaObject::invokeMethod(worker, "terminate", Qt::QueuedConnection);
}
}


//
// and now the RunPython that runs the python script in the new thread using QProcess
Expand Down Expand Up @@ -234,3 +241,14 @@ void RunPython::handleProcessFinished(int exitCode, QProcess::ExitStatus exitSta
emit processFinished(0);
}

void
RunPython::terminate() {
if (process != nullptr) {
process->terminate();
if (!process->waitForFinished(2000)) {
process->kill();
process->waitForFinished(1000);
}
}
}

3 changes: 3 additions & 0 deletions Workflow/EXECUTION/RunPythonInThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public slots:
void handleProcessTextOutput(void);
void handleProcessErrorOutput(void);
void handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void terminate();

signals:
void processFinished(int errorCode);
Expand All @@ -44,6 +45,7 @@ class RunPythonInThread : public QObject
RunPythonInThread(const QString &script, const QStringList &args, const QString &);
virtual ~RunPythonInThread();
void runProcess(void);
void terminateProcess(void);


public slots:
Expand All @@ -59,4 +61,5 @@ public slots:
QString script;
QStringList args;
QString workDir;
RunPython *worker {nullptr};
};
5 changes: 5 additions & 0 deletions Workflow/SIM/SIM_Selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include <CustomPy.h>
#include <SurrogateGP.h>
#include <Femora.h>
#include <SSI_Simulation.h>


#include <QApplication>
Expand Down Expand Up @@ -103,6 +104,10 @@ SIM_Selection::SIM_Selection(bool includeC,
this->addComponent(QString("CustomPy"), QString("CustomPyInput"), custom_py);

if (appName == "EE-UQ") {

SimCenterAppWidget *ssi_simulation = new SSI_Simulation();
this->addComponent(QString("SSI"), QString("SSISimulation"), ssi_simulation);

SimCenterAppWidget *femora = new Femora();
this->addComponent(QString("Femora"), QString("FemoraInput"), femora);
}
Expand Down
37 changes: 37 additions & 0 deletions Workflow/SIM/SSI/SSI_BuildingWidgetBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* *****************************************************************************
Copyright (c) 2016-2025, The Regents of the University of California (Regents).
All rights reserved.
*************************************************************************** */

#ifndef SSI_BUILDING_WIDGET_BASE_H
#define SSI_BUILDING_WIDGET_BASE_H

#include <QWidget>
#include <QJsonObject>
#include <QStringList>
class QString;

class SSI_BuildingWidgetBase : public QWidget {
Q_OBJECT
public:
explicit SSI_BuildingWidgetBase(QWidget* parent = nullptr) : QWidget(parent) {}
~SSI_BuildingWidgetBase() override = default;

virtual QString typeId() const = 0;

virtual bool validate(QStringList& errors, bool interactiveIfModelMissing = false) const = 0;
virtual bool outputToJSON(QJsonObject& structureInfo) const = 0;
virtual bool inputFromJSON(const QJsonObject& structureInfo) = 0;
virtual void plot() const = 0;
virtual int getNumberOfCores() const = 0;

// Copy any external files required for this building configuration into destDir
virtual bool copyFiles(QString &destDir) = 0;

// Return the list of random variable names used by this building widget
virtual QStringList getRandomVariableNames() const = 0;
};

#endif // SSI_BUILDING_WIDGET_BASE_H


Loading