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/nmCalculationPebiGrid.h

84 lines
3.5 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef NMCALCULATIONPEBIGRID_H
#define NMCALCULATIONPEBIGRID_H
#include "nmCalculation_global.h"
#include <QVector>
#include <QPointF>
#include "pch.h"
#include <vtkUnstructuredGrid.h>
#include <vtkSmartPointer.h>
class nmDataAnalyzeManager;
class NMCALCULATION_EXPORT nmCalculationPebiGrid
{
public:
/** @brief 返回进程内唯一的 PEBI 网格服务实例。 */
static nmCalculationPebiGrid* getInstance();
nmCalculationPebiGrid();
~nmCalculationPebiGrid();
/** @brief 为指定数据管理器生成 PEBI 网格并登记输入版本。 */
bool meshGenPebi(nmDataAnalyzeManager* pDataManager = nullptr);
/** @brief 设置 PEBI 网格控制值,并同步到指定分析方案。 */
void setGridControl(double dGridControl,
nmDataAnalyzeManager* pDataManager = nullptr);
/** @brief 仅在缓存属于指定管理器时清理;空参数强制清理当前缓存。 */
void clearGridData(const nmDataAnalyzeManager* pDataManager = nullptr);
private:
/** @brief 从绑定数据管理器构造边界输入。 */
bool meshGenPebiBoundary(HX_NWTM_GRID_INPUT& inputObj);
/** @brief 按有效计算井集合构造井几何并记录 DLL 井顺序。 */
bool meshGenPebiWells(HX_NWTM_GRID_INPUT& inputObj);
/** @brief 从 Map 构造断层输入。 */
bool meshGenPebiFault(HX_NWTM_GRID_INPUT& inputObj);
/** @brief 从 Map 构造手工裂缝输入和求解器占位条目。 */
bool meshGenPebiCrack(HX_NWTM_GRID_INPUT& inputObj);
// 生成vtk数据
void genPebiVTK(const HX_NWTM_GRID_OUTPUT1& P1, QString vtkDir);
// 根据网格输出结构体创建 vtkUnstructuredGrid 对象
vtkSmartPointer<vtkUnstructuredGrid> createPebiUnstructuredGrid(const HX_NWTM_GRID_OUTPUT1& P1);
// 日志输出
void logCurrentState();
void logInputParameters(const HX_NWTM_GRID_INPUT& input);
public:
/** @brief 调用网格 DLL 生成 p1、p2并校验有效井与求解器顺序一致。 */
bool generateOutputPara(nmDataAnalyzeManager* pDataManager = nullptr);
/** @brief 判断单例缓存是否确实属于指定分析窗口且输入版本仍然有效。 */
bool isGridCurrentFor(const nmDataAnalyzeManager* pDataManager) const;
/** @brief 在同一把锁内校验所属分析并复制完整网格快照。 */
bool copyCurrentGridFor(const nmDataAnalyzeManager* pDataManager,
HX_NWTM_GRID_OUTPUT1& oGridOutput1,
HX_NWTM_GRID_OUTPUT2& oGridOutput2,
int& nPebiCount) const;
public:
/** @brief 在线程锁保护下返回最近一次网格输出 p1 的副本。 */
HX_NWTM_GRID_OUTPUT1 getGridOutput1();
/** @brief 在线程锁保护下返回最近一次网格输出 p2 的副本。 */
HX_NWTM_GRID_OUTPUT2 getGridOutput2();
/** @brief 返回最近一次网格划分生成的 PEBI 单元数量。 */
int getPebiCount() const;
private:
static nmCalculationPebiGrid* m_instance; ///< 进程内共享的 PEBI 网格服务实例。
HX_NWTM_GRID_INPUT p0; ///< 最近一次提交给网格 DLL 的输入快照。
HX_NWTM_GRID_OUTPUT1 p1; ///< 最近一次网格 DLL 主输出。
HX_NWTM_GRID_OUTPUT2 p2; ///< 最近一次网格 DLL 辅助输出。
double m_dGridControl; ///< 对应 HX_NWTM_GRID_INPUT::GridControl。
int m_nPebiCount; ///< 最近一次成功网格的单元数量,未生成时为 -1。
/** @brief 当前单例缓存所属的数据管理器,不拥有对象。 */
nmDataAnalyzeManager* m_pDataManager;
};
#endif // NMCALCULATIONPEBIGRID_H