You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Include/nmNum/nmCalculation/nmCalculationDllPebiSolverT...

72 lines
2.6 KiB
C

#ifndef NMCALCULATIONDLLPEBISOLVERTASK_H
#define NMCALCULATIONDLLPEBISOLVERTASK_H
#include <QThread>
#include <QString>
#include <QVector>
#include <iostream>
#include <vector>
#include <Windows.h>
#include "nmCalculationDefine.h"
#include "nmCalculation_global.h"
#include "pch.h"
// 主窗口现在直接创建DLL求解线程任务因此类需要导出供nmSubWnd模块跨DLL使用。
class NMCALCULATION_EXPORT nmCalculationDllPebiSolverTask : public QThread {
Q_OBJECT
public:
nmCalculationDllPebiSolverTask(QString sPostprocessingDir,
QObject *parent = nullptr);
~nmCalculationDllPebiSolverTask();
void run();
// PSO 等待线程结束后通过该接口判断本次结果是否可以继续参与误差计算.
// 返回 false 时调用方会丢弃本次结果, 防止复用上一粒子留下的旧曲线.
bool wasSuccessful() const;
/** @brief 获取本次DLL内部求解耗时单位为毫秒。 */
int getSolveTimeMs() const;
/** @brief 获取本次求解的PEBI网格数量。 */
int getPebiCount() const;
// 自动拟合粒子评价只提取目标井曲线,不写回共享数据和网格压力场。
// 井名为空时保持原有完整结果保存模式。
void setAutoFitTargetWell(const QString& wellName);
QVector<QVector<double> > getAutoFitResultPressure() const;
QVector<QVector<double> > getAutoFitResultLogLog() const;
QVector<QVector<double> > getAutoFitResultSemiLog() const;
private:
bool execute();
// 执行PEBI求解流程。
bool execPebiMode();
// 将PEBI求解结果保存回数据对象。
bool savePebiModeResult(HX_NWTM_MODEL_OUTPUT& p1, int modelType);
void logHX_NWTM_MODEL_INPUT_Simplified(const HX_NWTM_MODEL_INPUT& p0);
bool saveHX_NWTM_MODEL_INPUT_ToTxt(const HX_NWTM_MODEL_INPUT& p0, const QString& filePath);
private:
QString m_sPostprocessingDir;
// run() 在线程内保存 execute() 结果, 等待线程结束的调用方只读取该状态.
bool m_lastRunSucceeded;
/** @brief 本次DLL内部求解耗时单位为毫秒。 */
int m_nSolveTimeMs;
/** @brief 本次求解的PEBI网格数量。 */
int m_nPebiCount;
QString m_autoFitTargetWellName;
QVector<QVector<double> > m_autoFitResultPressure;
QVector<QVector<double> > m_autoFitResultLogLog;
QVector<QVector<double> > m_autoFitResultSemiLog;
private slots:
//void slotTaskUpdateProgress();
signals:
void sig_calculateDone(bool isSuccessed);
//void sigTaskProgressUpdated(int progress);
//void sigResSolverProgressUpdated(int progress);
};
#endif // NMCALCULATIONDLLPEBISOLVERTASK_H