1、独立计算模块;
parent
5ceefee4a8
commit
70b7bdd7c1
Binary file not shown.
@ -0,0 +1,12 @@
|
|||||||
|
#ifndef NMCALCULATION_H
|
||||||
|
#define NMCALCULATION_H
|
||||||
|
|
||||||
|
#include "nmCalculation_global.h"
|
||||||
|
|
||||||
|
class NMCALCULATION_EXPORT NmCalculation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NmCalculation();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NMCALCULATION_H
|
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef NMCALCULATIONDEFINE_H
|
||||||
|
#define NMCALCULATIONDEFINE_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // NMCALCULATIONDEFINE_H
|
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef NMCALCULATIONGEO_H
|
||||||
|
#define NMCALCULATIONGEO_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QPointF>
|
||||||
|
#include "nmCalculationGeoDataOutline.h"
|
||||||
|
#include "nmCalculationGeoDataWell.h"
|
||||||
|
|
||||||
|
class nmCalculationGeo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// nmCalculationGeo();
|
||||||
|
// 构造函数
|
||||||
|
nmCalculationGeo(const nmCalculationGeoDataOutline &outline, const QVector<nmCalculationGeoDataWell>& wellList, double lc);
|
||||||
|
void generate2DFile(const QString& outputFileName);
|
||||||
|
void generate3DFile(const QString& outputFileName);
|
||||||
|
private:
|
||||||
|
QString generateOCCGeoCodes(bool is3D = true);
|
||||||
|
|
||||||
|
//基础网格大小设置
|
||||||
|
nmCalculationGeoDataOutline m_outline;//存储多边形的点
|
||||||
|
QVector<nmCalculationGeoDataWell> m_vWellList; // 存储圆心数据
|
||||||
|
double m_dGridSize;// 基础网格大小设置
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NMCALCULATIONGEO_H
|
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef NMCALCULATIONGEODATAOUTLINE_H
|
||||||
|
#define NMCALCULATIONGEODATAOUTLINE_H
|
||||||
|
|
||||||
|
#include <QPointF>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
class nmCalculationGeoDataOutline
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nmCalculationGeoDataOutline(const QVector<QPointF> points);
|
||||||
|
const QVector<QPointF> &points() const;
|
||||||
|
void setPoints(const QVector<QPointF> &newVPoints);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QVector<QPointF> m_vPoints;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NMCALCULATIONGEODATAOUTLINE_H
|
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef NMCALCULATIONGEODATAWELL_H
|
||||||
|
#define NMCALCULATIONGEODATAWELL_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QVector>
|
||||||
|
#include <QPointF>
|
||||||
|
|
||||||
|
class nmCalculationGeoDataWell
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// 默认构造函数
|
||||||
|
nmCalculationGeoDataWell();
|
||||||
|
// 带参数构造函数
|
||||||
|
nmCalculationGeoDataWell(const QPointF& center, double radius, int roundPointCount);
|
||||||
|
// 拷贝构造函数
|
||||||
|
nmCalculationGeoDataWell(const nmCalculationGeoDataWell& other);
|
||||||
|
// 重载赋值运算符
|
||||||
|
nmCalculationGeoDataWell& operator=(const nmCalculationGeoDataWell& other);
|
||||||
|
|
||||||
|
QPointF center() const;
|
||||||
|
void setCenter(QPointF newCenter);
|
||||||
|
double radius() const;
|
||||||
|
void setRadius(double newDRadius);
|
||||||
|
int roundPointCount() const;
|
||||||
|
void setRoundPointCount(int newIRoundPointCount);
|
||||||
|
public:
|
||||||
|
QPointF m_center; // 圆心位置
|
||||||
|
double m_dRadius; // 半径
|
||||||
|
int m_iRoundPointCount; // 圆周网格数量,用于加密
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NMCALCULATIONGEODATAWELL_H
|
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef NMCALCULATIONGEOSURFACE_H
|
||||||
|
#define NMCALCULATIONGEOSURFACE_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include "nmCalculationGeoDataOutline.h"
|
||||||
|
|
||||||
|
class nmCalculationGeoSurface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nmCalculationGeoSurface(const nmCalculationGeoDataOutline& outline, const double& gridSize = 0.1);
|
||||||
|
|
||||||
|
QString generateSurfaceGeoCodes();
|
||||||
|
private:
|
||||||
|
nmCalculationGeoDataOutline m_outline;
|
||||||
|
double m_dGridSize;// 基础网格大小设置
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NMCALCULATIONGEOSURFACE_H
|
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef NMCALCULATIONGEOWELL_H
|
||||||
|
#define NMCALCULATIONGEOWELL_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QVector>
|
||||||
|
#include "nmCalculationGeoDataWell.h"
|
||||||
|
|
||||||
|
class nmCalculationGeoWell
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nmCalculationGeoWell(const QVector<nmCalculationGeoDataWell>& wellList);
|
||||||
|
|
||||||
|
//创建井的方法
|
||||||
|
QString generateWellGeoCodes(int index);
|
||||||
|
private:
|
||||||
|
QVector<nmCalculationGeoDataWell> m_vWellList;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NMCALCULATIONGEOWELL_H
|
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef NMCALCULATIONGRID_H
|
||||||
|
#define NMCALCULATIONGRID_H
|
||||||
|
|
||||||
|
|
||||||
|
class nmCalculationGrid
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nmCalculationGrid();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NMCALCULATIONGRID_H
|
@ -0,0 +1,12 @@
|
|||||||
|
#ifndef NMCALCULATION_GLOBAL_H
|
||||||
|
#define NMCALCULATION_GLOBAL_H
|
||||||
|
|
||||||
|
#include <QtCore/qglobal.h>
|
||||||
|
|
||||||
|
#if defined(NM_CALCULATION_LIBRARY)
|
||||||
|
#define NMCALCULATION_EXPORT Q_DECL_EXPORT
|
||||||
|
#else
|
||||||
|
#define NMCALCULATION_EXPORT Q_DECL_IMPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // NMCALCULATION_GLOBAL_H
|
@ -0,0 +1,5 @@
|
|||||||
|
#include "nmCalculation.h"
|
||||||
|
|
||||||
|
NmCalculation::NmCalculation()
|
||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
#include "nmCalculationGeo.h"
|
||||||
|
#include <QFile>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
#include "nmCalculationGeoSurface.h"
|
||||||
|
#include "nmCalculationGeoWell.h"
|
||||||
|
|
||||||
|
nmCalculationGeo::nmCalculationGeo(const nmCalculationGeoDataOutline &outline, const QVector<nmCalculationGeoDataWell>& wellList, double lc): m_outline(outline),
|
||||||
|
m_vWellList(wellList), m_dGridSize(lc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QString nmCalculationGeo::generateOCCGeoCodes(bool is3D)
|
||||||
|
{
|
||||||
|
int flag = 0;
|
||||||
|
QStringList geoLines;
|
||||||
|
// 生成线、面
|
||||||
|
nmCalculationGeoSurface surface(m_outline, m_dGridSize);
|
||||||
|
geoLines.append(surface.generateSurfaceGeoCodes());
|
||||||
|
// 对于井做处理
|
||||||
|
flag = flag + m_vWellList.size();
|
||||||
|
nmCalculationGeoWell wells(m_vWellList);
|
||||||
|
geoLines.append(wells.generateWellGeoCodes(flag));
|
||||||
|
geoLines.append("Transfinite Surface(1) = {1}; ");
|
||||||
|
|
||||||
|
if (is3D) {
|
||||||
|
// 设置网格厚度,目前只支持单层网格
|
||||||
|
double gridThickness = 0.2;
|
||||||
|
geoLines.append(QString("Extrude {0, 0, %1} {Surface{1};Layers{1};Recombine;}").arg(gridThickness));
|
||||||
|
}
|
||||||
|
|
||||||
|
return geoLines.join("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void nmCalculationGeo::generate2DFile(const QString& fileName)
|
||||||
|
{
|
||||||
|
QFile file(fileName);
|
||||||
|
|
||||||
|
//检查
|
||||||
|
if(!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
qWarning("Cannot open file for writing: %s", qPrintable(file.errorString()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream out(&file);
|
||||||
|
out << generateOCCGeoCodes(false);
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nmCalculationGeo::generate3DFile(const QString& fileName)
|
||||||
|
{
|
||||||
|
QFile file(fileName);
|
||||||
|
|
||||||
|
//检查
|
||||||
|
if(!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
|
qWarning("Cannot open file for writing: %s", qPrintable(file.errorString()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream out(&file);
|
||||||
|
out << generateOCCGeoCodes();
|
||||||
|
file.close();
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
#include "nmCalculationGeoDataOutline.h"
|
||||||
|
|
||||||
|
nmCalculationGeoDataOutline::nmCalculationGeoDataOutline(const QVector<QPointF> points): m_vPoints(points)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const QVector<QPointF> &nmCalculationGeoDataOutline::points() const
|
||||||
|
{
|
||||||
|
return m_vPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nmCalculationGeoDataOutline::setPoints(const QVector<QPointF> &newVPoints)
|
||||||
|
{
|
||||||
|
m_vPoints = newVPoints;
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
#include "nmCalculationGeoDataWell.h"
|
||||||
|
|
||||||
|
nmCalculationGeoDataWell::nmCalculationGeoDataWell()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
nmCalculationGeoDataWell::nmCalculationGeoDataWell(const QPointF& center, double radius, int roundPointCount)
|
||||||
|
: m_center(center), m_dRadius(radius), m_iRoundPointCount(roundPointCount) {}
|
||||||
|
|
||||||
|
nmCalculationGeoDataWell::nmCalculationGeoDataWell(const nmCalculationGeoDataWell& other)
|
||||||
|
{
|
||||||
|
m_center = other.m_center;
|
||||||
|
m_dRadius = other.m_dRadius;
|
||||||
|
m_iRoundPointCount = other.m_iRoundPointCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
nmCalculationGeoDataWell& nmCalculationGeoDataWell::operator=(const nmCalculationGeoDataWell& other)
|
||||||
|
{
|
||||||
|
if (this != &other) {
|
||||||
|
m_center = other.m_center;
|
||||||
|
m_dRadius = other.m_dRadius;
|
||||||
|
m_iRoundPointCount = other.m_iRoundPointCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nmCalculationGeoDataWell::roundPointCount() const
|
||||||
|
{
|
||||||
|
return m_iRoundPointCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nmCalculationGeoDataWell::setRoundPointCount(int newIRoundPointCount)
|
||||||
|
{
|
||||||
|
m_iRoundPointCount = newIRoundPointCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
double nmCalculationGeoDataWell::radius() const
|
||||||
|
{
|
||||||
|
return m_dRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nmCalculationGeoDataWell::setRadius(double newDRadius)
|
||||||
|
{
|
||||||
|
m_dRadius = newDRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF nmCalculationGeoDataWell::center() const
|
||||||
|
{
|
||||||
|
return m_center;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nmCalculationGeoDataWell::setCenter(QPointF newCenter)
|
||||||
|
{
|
||||||
|
m_center = newCenter;
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
#include "nmCalculationGrid.h"
|
||||||
|
|
||||||
|
nmCalculationGrid::nmCalculationGrid()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
QT -= gui
|
||||||
|
|
||||||
|
TARGET = nmCalculation
|
||||||
|
TEMPLATE = lib
|
||||||
|
DEFINES += NM_CALCULATION_LIBRARY
|
||||||
|
|
||||||
|
include(../../setting.pri)
|
||||||
|
|
||||||
|
# You can make your code fail to compile if it uses deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
SOURCES += $${wtSrc}/nmNum/nmCalculation/*.cpp
|
||||||
|
HEADERS += $${wtInclude}/nmNum/nmCalculation/*.h
|
||||||
|
|
||||||
|
|
||||||
|
INCLUDEPATH += $${wtInclude}/nmNum/nmCalculation \
|
||||||
|
$${geoHome}/3rd/SinglePhaseSolver/include
|
Loading…
Reference in New Issue