|
|
@ -24,11 +24,11 @@
|
|
|
|
#include "ZxDataProject.h"
|
|
|
|
#include "ZxDataProject.h"
|
|
|
|
#include "ZxRstJobWnd.h"
|
|
|
|
#include "ZxRstJobWnd.h"
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
#include "ZxDataGaugeP.h"
|
|
|
|
#include "ZxDataGaugeP.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
#include "nmXmlHelper.h"
|
|
|
|
#include "nmXmlHelper.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include "nmSubWndGrid.h"
|
|
|
|
#include "nmSubWndGrid.h"
|
|
|
@ -41,6 +41,7 @@
|
|
|
|
#include "nmGuiPlot.h"
|
|
|
|
#include "nmGuiPlot.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "nmWxGridVTKContainerWidget.h"
|
|
|
|
#include "nmWxGridVTKContainerWidget.h"
|
|
|
|
|
|
|
|
#include "nmWxGridDlg.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <QVector>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QProcess>
|
|
|
|
#include <QProcess>
|
|
|
@ -62,14 +63,12 @@ nmSubWndGrid::~nmSubWndGrid()
|
|
|
|
void nmSubWndGrid::configWnd()
|
|
|
|
void nmSubWndGrid::configWnd()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
iSubWndBaseAF::configWnd();
|
|
|
|
iSubWndBaseAF::configWnd();
|
|
|
|
|
|
|
|
|
|
|
|
if(NULL != m_pMainWindow) {
|
|
|
|
if(NULL != m_pMainWindow) {
|
|
|
|
disconnect(this, SIGNAL(sigAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)), \
|
|
|
|
disconnect(this, SIGNAL(sigAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)), \
|
|
|
|
m_pMainWindow, SLOT(slotAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)));
|
|
|
|
m_pMainWindow, SLOT(slotAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)));
|
|
|
|
connect(this, SIGNAL(sigAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)), \
|
|
|
|
connect(this, SIGNAL(sigAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)), \
|
|
|
|
m_pMainWindow, SLOT(slotAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)));
|
|
|
|
m_pMainWindow, SLOT(slotAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
initUI();
|
|
|
|
initUI();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -82,9 +81,7 @@ void nmSubWndGrid::initUI()
|
|
|
|
// initUiDockWxs();
|
|
|
|
// initUiDockWxs();
|
|
|
|
// initUiDockPtys();
|
|
|
|
// initUiDockPtys();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
|
|
|
|
|
|
|
|
// 示例:如何加载xml文件
|
|
|
|
// 示例:如何加载xml文件
|
|
|
|
if(_nmXmlHelper->loadXmlDefines()) {
|
|
|
|
if(_nmXmlHelper->loadXmlDefines()) {
|
|
|
|
foreach(nmXmlData* pData, *(_nmXmlHelper->getVecNmXmlDataPtrs())) {
|
|
|
|
foreach(nmXmlData* pData, *(_nmXmlHelper->getVecNmXmlDataPtrs())) {
|
|
|
@ -92,22 +89,21 @@ void nmSubWndGrid::initUI()
|
|
|
|
zxLogRunD(QString("%1: %2").arg(pData->m_sName).arg(pData->m_sAlias));
|
|
|
|
zxLogRunD(QString("%1: %2").arg(pData->m_sName).arg(pData->m_sAlias));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QWidget* nmSubWndGrid::initUiMainWx()
|
|
|
|
QWidget* nmSubWndGrid::initUiMainWx()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// TODO拿到网格设置参数
|
|
|
|
|
|
|
|
// 类型:三角形、四边形和六边形
|
|
|
|
// 拿到多边形的边界和井的数据
|
|
|
|
// 拿到多边形的边界和井的数据
|
|
|
|
nmGuiPlot* pPlot = (nmGuiPlot*)m_pAnalyzeData->getWxPlot();
|
|
|
|
nmGuiPlot* pPlot = (nmGuiPlot*)m_pAnalyzeData->getWxPlot();
|
|
|
|
QVector<QPointF> outlineInformation = pPlot->getOutlinePoints();
|
|
|
|
QVector<QPointF> outlineInformation = pPlot->getOutlinePoints();
|
|
|
|
nmDataLogFile::getInstance()->writeLog("==== outline start ====");
|
|
|
|
nmDataLogFile::getInstance()->writeLog("==== outline start ====");
|
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < outlineInformation.count(); i++) {
|
|
|
|
for(int i = 0; i < outlineInformation.count(); i++) {
|
|
|
|
QPointF p = outlineInformation[i];
|
|
|
|
QPointF p = outlineInformation[i];
|
|
|
|
nmDataLogFile::getInstance()->writeLog(QString("%1 %2").arg(p.x()).arg(p.y()));
|
|
|
|
nmDataLogFile::getInstance()->writeLog(QString("%1 %2").arg(p.x()).arg(p.y()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nmDataLogFile::getInstance()->writeLog("==== outline end ====");
|
|
|
|
nmDataLogFile::getInstance()->writeLog("==== outline end ====");
|
|
|
|
QVector<QVector<double >> wellList = pPlot->getWellsInformation();
|
|
|
|
QVector<QVector<double >> wellList = pPlot->getWellsInformation();
|
|
|
|
nmDataLogFile::getInstance()->writeLog("==== " + QString::number(outlineInformation.count()) + " ====");
|
|
|
|
nmDataLogFile::getInstance()->writeLog("==== " + QString::number(outlineInformation.count()) + " ====");
|
|
|
@ -132,7 +128,6 @@ bool nmSubWndGrid::runCmdBy(QString sName, QString sID)
|
|
|
|
if(sID.toInt() == 5401) {
|
|
|
|
if(sID.toInt() == 5401) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -140,7 +135,6 @@ void nmSubWndGrid::genGeo(QVector<QPointF> outlinePoints, QVector<QVector<double
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 井数据结构
|
|
|
|
// 井数据结构
|
|
|
|
QVector<CircleWell> circles;
|
|
|
|
QVector<CircleWell> circles;
|
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < vWellsInfo.count(); i++) {
|
|
|
|
for(int i = 0; i < vWellsInfo.count(); i++) {
|
|
|
|
QVector<double> vWellInfo = vWellsInfo[i];
|
|
|
|
QVector<double> vWellInfo = vWellsInfo[i];
|
|
|
|
QPointF center(vWellInfo[0], vWellInfo[1]);
|
|
|
|
QPointF center(vWellInfo[0], vWellInfo[1]);
|
|
|
@ -148,7 +142,6 @@ void nmSubWndGrid::genGeo(QVector<QPointF> outlinePoints, QVector<QVector<double
|
|
|
|
int wellGridNum = 13;
|
|
|
|
int wellGridNum = 13;
|
|
|
|
circles.append(CircleWell(center, radius, wellGridNum));
|
|
|
|
circles.append(CircleWell(center, radius, wellGridNum));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 面网格设置
|
|
|
|
// 面网格设置
|
|
|
|
double gridSize = 0.5;
|
|
|
|
double gridSize = 0.5;
|
|
|
|
nmDataGeo geo(outlinePoints, circles, gridSize);
|
|
|
|
nmDataGeo geo(outlinePoints, circles, gridSize);
|
|
|
@ -171,25 +164,20 @@ void nmSubWndGrid::genGrid(bool is3D)
|
|
|
|
// gmsh.exe -2 oil.geo -o oil.vtk
|
|
|
|
// gmsh.exe -2 oil.geo -o oil.vtk
|
|
|
|
// gmsh.exe -2 oil-2d.geo -o oil-2d.vtk
|
|
|
|
// gmsh.exe -2 oil-2d.geo -o oil-2d.vtk
|
|
|
|
QString geoName = "oil.geo";
|
|
|
|
QString geoName = "oil.geo";
|
|
|
|
|
|
|
|
|
|
|
|
if(!is3D) {
|
|
|
|
if(!is3D) {
|
|
|
|
geoName = "oil-2d.geo";
|
|
|
|
geoName = "oil-2d.geo";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
process.start("gmsh.exe", QStringList() << "-2" << geoName << "-o" << QString(geoName).replace("geo", "vtk") << " -saveall");
|
|
|
|
process.start("gmsh.exe", QStringList() << "-2" << geoName << "-o" << QString(geoName).replace("geo", "vtk") << " -saveall");
|
|
|
|
|
|
|
|
|
|
|
|
// 等待命令启动
|
|
|
|
// 等待命令启动
|
|
|
|
if(!process.waitForStarted()) {
|
|
|
|
if(!process.waitForStarted()) {
|
|
|
|
nmDataLogFile::getInstance()->writeLog("Command failed to start.");
|
|
|
|
nmDataLogFile::getInstance()->writeLog("Command failed to start.");
|
|
|
|
return ;
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 等待命令执行结束
|
|
|
|
// 等待命令执行结束
|
|
|
|
if(!process.waitForFinished()) {
|
|
|
|
if(!process.waitForFinished()) {
|
|
|
|
nmDataLogFile::getInstance()->writeLog("Command failed to finish.");
|
|
|
|
nmDataLogFile::getInstance()->writeLog("Command failed to finish.");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 读取命令的输出
|
|
|
|
// 读取命令的输出
|
|
|
|
QByteArray output = process.readAllStandardOutput();
|
|
|
|
QByteArray output = process.readAllStandardOutput();
|
|
|
|
nmDataLogFile::getInstance()->writeLog("Gen grid command output: " + output);
|
|
|
|
nmDataLogFile::getInstance()->writeLog("Gen grid command output: " + output);
|
|
|
@ -209,21 +197,17 @@ void nmSubWndGrid::genWellFile(QVector<QVector<double >> vWellsInfo)
|
|
|
|
double gridNum = 12;
|
|
|
|
double gridNum = 12;
|
|
|
|
QString sDir = ZxBaseUtil::getDirOf(s_Dir_Temp, "Nm/PreProcessing");
|
|
|
|
QString sDir = ZxBaseUtil::getDirOf(s_Dir_Temp, "Nm/PreProcessing");
|
|
|
|
QString sFile = sDir + "oil-2d-wells.txt";
|
|
|
|
QString sFile = sDir + "oil-2d-wells.txt";
|
|
|
|
|
|
|
|
|
|
|
|
QFile file(sFile);
|
|
|
|
QFile file(sFile);
|
|
|
|
|
|
|
|
|
|
|
|
//检查
|
|
|
|
//检查
|
|
|
|
if(!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|
|
|
if(!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|
|
|
qWarning("Cannot open file for writing: %s", qPrintable(file.errorString()));
|
|
|
|
qWarning("Cannot open file for writing: %s", qPrintable(file.errorString()));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QTextStream out(&file);
|
|
|
|
QTextStream out(&file);
|
|
|
|
out << vWellsInfo.size() << "\n";
|
|
|
|
out << vWellsInfo.size() << "\n";
|
|
|
|
for(int i = 0; i < vWellsInfo.size(); i++) {
|
|
|
|
for(int i = 0; i < vWellsInfo.size(); i++) {
|
|
|
|
QVector<double> wellInfo = vWellsInfo[i];
|
|
|
|
QVector<double> wellInfo = vWellsInfo[i];
|
|
|
|
out << wellInfo[0] << " " << wellInfo[1] << " " << wellInfo[2] << " " << gridNum << "\n";
|
|
|
|
out << wellInfo[0] << " " << wellInfo[1] << " " << wellInfo[2] << " " << gridNum << "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
file.close();
|
|
|
|
file.close();
|
|
|
|
}
|
|
|
|
}
|