|
|
|
|
/**********************************************************************
|
|
|
|
|
* @file FITKCGNSReader.h
|
|
|
|
|
* @brief CGNS 格式读取接口
|
|
|
|
|
* @author liuzhonghua (liuzhonghuaszch@163.com)
|
|
|
|
|
* @date 2024-09-19
|
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "FITKCGNSIOAPI.h"
|
|
|
|
|
#include "FITK_Interface/FITKInterfaceIO/FITKAbstractIO.h"
|
|
|
|
|
#include <QVector>
|
|
|
|
|
#include <QMap>
|
|
|
|
|
#include <cgnslib.h>
|
|
|
|
|
|
|
|
|
|
namespace Interface {
|
|
|
|
|
class FITKUnstructuredFluidMeshVTK;
|
|
|
|
|
class FITKBoundaryMeshVTK;
|
|
|
|
|
}
|
|
|
|
|
namespace IO
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @brief 点数据信息结构体
|
|
|
|
|
* @author liuzhonghua (liuzhonghuaszch@163.com)
|
|
|
|
|
* @date 2024-09-19
|
|
|
|
|
*/
|
|
|
|
|
struct VertexDataInfo
|
|
|
|
|
{
|
|
|
|
|
double x = 0;
|
|
|
|
|
double y = 0;
|
|
|
|
|
double z = 0;
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
* @brief CGNS读取
|
|
|
|
|
* @author liuzhonghua (liuzhonghuaszch@163.com)
|
|
|
|
|
* @date 2024-09-19
|
|
|
|
|
*/
|
|
|
|
|
class FITKCGNSIOAPI FITKCGNSReader : public Interface::FITKAbstractIO
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* @brief 构造函数
|
|
|
|
|
* @author YanZhiHui (chanyuantiandao@126.com)
|
|
|
|
|
* @date 2024-07-29
|
|
|
|
|
*/
|
|
|
|
|
FITKCGNSReader() = default;
|
|
|
|
|
/**
|
|
|
|
|
* @brief 析构函数
|
|
|
|
|
* @author YanZhiHui (chanyuantiandao@126.com)
|
|
|
|
|
* @date 2024-07-29
|
|
|
|
|
*/
|
|
|
|
|
~FITKCGNSReader() = default;
|
|
|
|
|
/**
|
|
|
|
|
* @brief 重写run函数
|
|
|
|
|
* @author fulipeng (fulipengqd@yeah.net)
|
|
|
|
|
* @date 2024-03-11
|
|
|
|
|
*/
|
|
|
|
|
void run() override;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 打印控制台消息
|
|
|
|
|
* @param[i] level 打印级别 1 normal 2 warning 3error
|
|
|
|
|
* @param[i] str 数据
|
|
|
|
|
* @author fulipeng (fulipengqd@yeah.net)
|
|
|
|
|
* @date 2024-04-07
|
|
|
|
|
*/
|
|
|
|
|
void consoleMessage(int level, const QString& str) override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool read();
|
|
|
|
|
bool readZone();
|
|
|
|
|
bool readCoordinate(int vertext_num, /*int*/cgsize_t range_from[3], /*int*/cgsize_t range_to[3]);
|
|
|
|
|
bool readBC(int zonei, int zonej, int zonek);
|
|
|
|
|
bool readZoneFlowSolution(int pointLen, int cellLen, cgsize_t* rmax_pt, cgsize_t* rmax_cell);
|
|
|
|
|
|
|
|
|
|
bool readBoundaryCond(int index_bc);
|
|
|
|
|
bool readZoneBCs(int index_bc, int cellCount);
|
|
|
|
|
bool readUnstructZoneBCs(int index_bc);
|
|
|
|
|
bool readStructZoneBCs(int index_bc);
|
|
|
|
|
bool readSections();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void readCells(int start_index, int end_index, int type, cgsize_t* elements /*int* elements*/, int element_data_size);
|
|
|
|
|
private:
|
|
|
|
|
/**
|
|
|
|
|
* @brief 网格数据对象
|
|
|
|
|
* @author liuzhonghua (liuzhonghuaszch@163.com)
|
|
|
|
|
* @date 2024-09-19
|
|
|
|
|
*/
|
|
|
|
|
Interface::FITKUnstructuredFluidMeshVTK* m_Mesh{};
|
|
|
|
|
int m_index_file{ -1 };
|
|
|
|
|
int m_index_base{ -1 };
|
|
|
|
|
int m_index_zone{ -1 };
|
|
|
|
|
QVector<VertexDataInfo> m_verlist{};
|
|
|
|
|
Interface::FITKBoundaryMeshVTK* m_boundaryMesh{};
|
|
|
|
|
|
|
|
|
|
QMap<QString, QVector<double>> m_pointScalars;
|
|
|
|
|
QMap<QString, QVector<double>> m_cellScalars;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|