| 1 |
#include "mpsolveworker.h" |
| 2 |
#include <mps/mps.h> |
| 3 |
#include <QDebug> |
| 4 |
|
| 5 |
using namespace xmpsolve; |
| 6 |
|
| 7 |
MPSolveWorker::MPSolveWorker(mps_context * s, QObject *parent) : |
| 8 |
QThread(parent) |
| 9 |
{ |
| 10 |
/* Set the status in the worker */ |
| 11 |
m_context = s; |
| 12 |
m_time = 0; |
| 13 |
m_timer = NULL; |
| 14 |
} |
| 15 |
|
| 16 |
void |
| 17 |
MPSolveWorker::run() |
| 18 |
{ |
| 19 |
/* Actually solve the polynomial that should have been set in here... */ |
| 20 |
m_timer = mps_start_timer(); |
| 21 |
mps_mpsolve(m_context); |
| 22 |
} |
| 23 |
|
| 24 |
void |
| 25 |
MPSolveWorker::abortComputation() |
| 26 |
{ |
| 27 |
mps_context_abort(m_context); |
| 28 |
} |
| 29 |
|
| 30 |
unsigned long int |
| 31 |
MPSolveWorker::CPUTime() |
| 32 |
{ |
| 33 |
return m_time; |
| 34 |
} |
| 35 |
|
| 36 |
void |
| 37 |
MPSolveWorker::setMpsContext(mps_context *ctx) |
| 38 |
{ |
| 39 |
m_context = ctx; |
| 40 |
} |