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.
AppFlow/FITK_Component/FITKCGNSIO/FITKCGNSReader.cpp

826 lines
30 KiB
C++

#include "FITKCGNSReader.h"
#include "FITK_Interface/FITKInterfaceMesh/FITKUnstructuredFluidMeshVTK.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "FITK_Interface/FITKInterfaceMesh/FITKUnstructuredMeshVTK.h"
#include "FITK_Interface/FITKInterfaceModel/FITKElementFactory.h"
#include "FITK_Interface/FITKInterfaceModel/FITKAbstractElement.h"
#include <QDebug>
namespace IO
{
void FITKCGNSReader::run()
{
*_resultMark = false;
m_Mesh = dynamic_cast<Interface::FITKUnstructuredFluidMeshVTK*>(_data);
if (!m_Mesh)return;
*_resultMark = read();
if (m_index_file != -1)
cg_close(m_index_file);
}
void FITKCGNSReader::consoleMessage(int level, const QString& str)
{
}
bool FITKCGNSReader::read()
{
//检查有效的 CGNS 文件 2:hdf5
int file_type = 0;
if (CG_OK != cg_is_cgns(_fileName.toStdString().c_str(), &file_type))return false;
//打开 CGNS 文件
if (CG_OK != cg_open(_fileName.toStdString().c_str(), CG_MODE_READ, &m_index_file))return false;
//获取 文件的CGNS 版本
float fileVersion = -1;
if (CG_OK != cg_version(m_index_file, &fileVersion))return false;
//获取 CGNS文件精度
int precision = -1;
if (CG_OK != cg_precision(m_index_file, &precision))return false;
// 获取文件中的 CGNS 基节点数
int nbases = 0;
if (CG_OK != cg_nbases(m_index_file, &nbases))return false;
for (int iBase = 0; iBase < nbases; ++iBase)
{
//获取基本信息标识
m_index_base = iBase + 1;
//读取族
int nfamily = 0;
cg_nfamilies(m_index_file, m_index_base, &nfamily);
for (int i = 1; i <= nfamily; ++i)
{
int nBoco = 0, nGeos = 0;
char name[64] = { 0 };
cg_family_read(m_index_file, m_index_base, i, name, &nBoco, &nGeos);
}
//获取基本信息
char base_name[33];
int cell_dim = -1, phys_dim = -1;
if (CG_OK != cg_base_read(m_index_file, m_index_base, base_name, &cell_dim, &phys_dim))return false;
//获取 base 中的区域数
int nzones = 0;
if (CG_OK != cg_nzones(m_index_file, m_index_base, &nzones))return false;
//获取区域数据
for (int iZone = 0; iZone < nzones; ++iZone)
{
m_index_zone = iZone + 1;
if (!readZone())
return false;
//获取单元数据
if (!this->readSections())
return false;
}
}
return true;
}
bool FITKCGNSReader::readZone()
{
//获取区域名称
char zone_name[33] = { 0 };
/*int*/ cgsize_t zone_ijk[3][3] = { 0 };
///< MG get Zone_t node 's name and every direction vertex cell number
if (CG_OK != cg_zone_read(m_index_file, m_index_base, m_index_zone, zone_name, zone_ijk[0]))
return false;
//获取 CGNS 区域的索引维度
int dim = 3;
if (CG_OK != cg_index_dim(m_index_file, m_index_base, m_index_zone, &dim))
return false;
//获取节点数量
int vertex_number = 0;
/*int*/ cgsize_t read_range[2][3] = { 0 };
cgsize_t rmax_cell[3]{};
//获取区域类型(结构化或非结构化)
CGNS_ENUMT(ZoneType_t) zonetype;
if (CG_OK != cg_zone_type(m_index_file, m_index_base, m_index_zone, &zonetype)) return false;
if (zonetype == CGNS_ENUMV(Structured))
{
//结构
vertex_number = zone_ijk[0][0] * zone_ijk[0][1] * zone_ijk[0][2];
for (int n = 0; n < 3; n++)
{
read_range[0][n] = 1;
read_range[1][n] = zone_ijk[0][n];
rmax_cell[n] = zone_ijk[1][n];
}
}
else if (zonetype == CGNS_ENUMV(Unstructured))
{
//非结构
vertex_number = zone_ijk[0][0];
for (int ijk = 0; ijk < 3; ++ijk)
{
read_range[0][ijk] = 1;
read_range[1][ijk] = vertex_number;
rmax_cell[ijk] = zone_ijk[0][1];
}
}
else
return false;
//读取节点数据
if (!this->readCoordinate(vertex_number, read_range[0], read_range[1]) || m_verlist.size() != vertex_number)
return false;
if (!readZoneFlowSolution(vertex_number, 0, read_range[1], rmax_cell))
return false;
// Read Boundary Condition Count
int bcCount = 0;
if (CG_OK != cg_nbocos(m_index_file, m_index_base, m_index_zone, &bcCount)) return false;
// Read Boundary Conditions' Info
for (int iBc = 1; iBc <= bcCount; ++iBc)
{
if (!readBoundaryCond(iBc))
return false;
}
//this->readBC(zone_ijk[0][0], zone_ijk[0][1], zone_ijk[0][2]);
return true;
}
bool FITKCGNSReader::readCoordinate(int vertext_num, /*int*/ cgsize_t range_from[3], /*int*/ cgsize_t range_to[3])
{
//清理点的数据链表
m_verlist.clear();
//开辟数据空间
m_verlist.fill(VertexDataInfo(), vertext_num);
//获取方向轴数量
int coordinate_number = 0;
if (CG_OK != cg_ncoords(m_index_file, m_index_base, m_index_zone, &coordinate_number))
return false;
//获取节点坐标
for (int coor_index = 1; coor_index <= coordinate_number; ++coor_index)
{
//获取方向轴信息
char coordinate_name[33] = { 0 };
CGNS_ENUMV(DataType_t) datatype;
if (CG_OK != cg_coord_info(m_index_file, m_index_base, m_index_zone, coor_index, &datatype, coordinate_name))
return false;
//获取坐标轴参数
double *xyz = new double[vertext_num];
if (CG_OK != cg_coord_read(m_index_file, m_index_base, m_index_zone, coordinate_name, CGNS_ENUMV(RealDouble), range_from, range_to, xyz))
{
delete[] xyz;
return false;
}
if (!strcmp(coordinate_name, "CoordinateX"))
{
for (int ipt = 0; ipt < vertext_num; ++ipt)
{
m_verlist[ipt].x = xyz[ipt];
}
}
else if (!strcmp(coordinate_name, "CoordinateY"))
{
for (int ipt = 0; ipt < vertext_num; ++ipt)
{
m_verlist[ipt].y = xyz[ipt];
}
}
else if (!strcmp(coordinate_name, "CoordinateZ"))
{
for (int ipt = 0; ipt < vertext_num; ++ipt)
{
m_verlist[ipt].z = xyz[ipt];
}
}
delete[] xyz;
}
//插入节点数据
Interface::FITKUnstructuredMeshVTK* fieldMesh = m_Mesh->getFieldMesh();
for (int i = 0; i < vertext_num; ++i)
{
VertexDataInfo v = m_verlist[i];
fieldMesh->addNode(v.x, v.y, v.z);
}
return true;
}
bool FITKCGNSReader::readBC(int zonei, int zonej, int zonek)
{
//#ifdef Q_OS_WIN
int nbocos = 0;
if (cg_nbocos(m_index_file, m_index_base, m_index_zone, &nbocos))
return false;
for (int bc_index = 1; bc_index <= nbocos; ++bc_index)
{
CGNS_ENUMT(BCType_t)
bctype;
CGNS_ENUMT(PointSetType_t)
ptype;
CGNS_ENUMT(GridLocation_t)
location;
CGNS_ENUMT(DataType_t)
datatype;
char bc_name[33] = { 0 };
// int np = 0;
int nrmlindex[3] = { 0 };
// int is = 0, ib = 0;
cgsize_t np = 0, is = 0;
int ib = 0;
if (cg_boco_info(m_index_file, m_index_base, m_index_zone, bc_index, bc_name, &bctype, &ptype, &np, nrmlindex, &is, &datatype, &ib))
return false;
cg_goto(m_index_file, m_index_base, "Zone_t", m_index_zone, "ZoneBC_t", 1, "BC_t", bc_index, "end");
char cName[64] = { 0 };
cg_famname_read(cName);
int indexDeimension = 0;
cg_index_dim(m_index_file, m_index_base, m_index_zone, &indexDeimension);
int npnts = np * indexDeimension;
assert(6 == npnts);
cgsize_t *pnpnts = new cgsize_t[npnts];
cgsize_t *plist = NULL;
if (is)
plist = new cgsize_t[is];
if (cg_boco_read(m_index_file, m_index_base, m_index_zone, bc_index, pnpnts, plist))
return false;
int rang[6];
for (int iCnt = 0; iCnt < 6; ++iCnt)
rang[iCnt] = pnpnts[iCnt];
int i_range[2] = { 0 }, j_range[2] = { 0 }, k_range[2] = { 0 };
i_range[0] = pnpnts[0] - 1, i_range[1] = pnpnts[3] - 1, j_range[0] = pnpnts[1] - 1;
j_range[1] = pnpnts[4] - 1, k_range[0] = pnpnts[2] - 1, k_range[1] = pnpnts[5] - 1;
delete[] pnpnts;
int xd = i_range[1] - i_range[0] + 1;
int yd = j_range[1] - j_range[0] + 1;
int zd = k_range[1] - k_range[0] + 1;
for (int k = k_range[0]; k <= k_range[1]; ++k)
{
for (int j = j_range[0]; j <= j_range[1]; ++j)
{
for (int i = i_range[0]; i <= i_range[1]; ++i)
{
int index = i + (j * zonei) + (k * zonei * zonej);
VertexDataInfo v = m_verlist.at(index);
/* points->InsertNextPoint(v.x, v.y, v.z);*/
}
}
}
}
return true;
}
bool FITKCGNSReader::readZoneFlowSolution(int pointLen, int cellLen, cgsize_t* rmax_pt, cgsize_t* rmax_cell)
{
int solCount = 0;
if (CG_OK != cg_nsols(m_index_file, m_index_base, m_index_zone, &solCount))
return false;
for (int iSol = 1; iSol <= solCount; ++iSol)
{
char solName[33]{};
CGNS_ENUMT(GridLocation_t) location;
if (CG_OK != cg_sol_info(m_index_file, m_index_base, m_index_zone, iSol, solName, &location))
return false;
int fieldCount = 0;
if (CG_OK != cg_nfields(m_index_file, m_index_base, m_index_zone, iSol, &fieldCount))
return false;
for (int iField = 1; iField <= fieldCount; ++iField)
{
DataType_t dataType;
char varName[33]{};
if (CG_OK != cg_field_info(m_index_file, m_index_base, m_index_zone, iSol, iField, &dataType, varName))
return false;
cgsize_t rmin[3]{ 1, 1, 1 };
cgsize_t rmax[3]{};
int len = 0;
if (location == CGNS_ENUMV(Vertex))
{
len = pointLen;
rmax[0] = rmax_pt[0];
rmax[1] = rmax_pt[1];
rmax[2] = rmax_pt[2];
}
else if (location == CGNS_ENUMV(CellCenter))
{
len = cellLen;
rmax[0] = rmax_cell[0];
rmax[1] = rmax_cell[1];
rmax[2] = rmax_cell[2];
}
else
return false;
void* var{ nullptr };
if (dataType == RealSingle)
{
var = new float[len];
}
else if (dataType == RealDouble)
{
var = new double[len];
}
else
return false;
if (CG_OK != cg_field_read(m_index_file, m_index_base, m_index_zone, iSol, varName, dataType, rmin, rmax, var))
{
delete[] var;
return false;
}
QVector<double> valueVec;
if (dataType == RealSingle)
{
float* fVar = static_cast<float*>(var);
for (int k = 0; k < len; k++)
{
valueVec.push_back(fVar[k]);
}
delete[] fVar;
}
else if (dataType == RealDouble)
{
double* dVar = static_cast<double*>(var);
for (int k = 0; k < len; k++)
{
valueVec.push_back(dVar[k]);
}
delete[] dVar;
}
switch (location)
{
case Vertex:
{
m_pointScalars.insert(varName, valueVec);
break;
}
case CellCenter:
{
m_cellScalars.insert(varName, valueVec);
break;
}
default:
return false;
}
}
}
return true;
}
bool FITKCGNSReader::readBoundaryCond(int index_bc)
{
//获取boundary信息
char bcName[33]{};
BCType_t type;
CGNS_ENUMT(PointSetType_t) ptType;
cgsize_t eleCount;
int NormalIndex;
cgsize_t NormalListSize;
DataType_t dataType;
int dataSetCount;
if (CG_OK != cg_boco_info(m_index_file, m_index_base, m_index_zone, index_bc, bcName, &type,
&ptType, &eleCount, &NormalIndex, &NormalListSize, &dataType, &dataSetCount))
return false;
//获取区域类型
CGNS_ENUMT(ZoneType_t) zonetype;
if (CG_OK != cg_zone_type(m_index_file, m_index_base, m_index_zone, &zonetype)) return false;
bool flag = false;
if (ptType == CGNS_ENUMV(PointList))
{
flag = readZoneBCs(index_bc, eleCount);
}
else if (ptType == CGNS_ENUMV(PointRange))
{
if (zonetype == CGNS_ENUMV(Structured))
{
flag = readUnstructZoneBCs(index_bc);
}
else if (zonetype == CGNS_ENUMV(Unstructured))
{
flag = readStructZoneBCs(index_bc);
}
}
if (flag)
{
//zone.BCs.push_back(bc);
}
return flag;
}
bool FITKCGNSReader::readZoneBCs(int index_bc, int cellCount)
{
cgsize_t *pnts = new cgsize_t[cellCount];
if (CG_OK != cg_boco_read(m_index_file, m_index_base, m_index_zone, index_bc, pnts, nullptr))
{
delete[] pnts;
return false;
}
CGNS_ENUMT(GridLocation_t) gridType;
if (CG_OK != cg_boco_gridlocation_read(m_index_file, m_index_base, m_index_zone, index_bc, &gridType))
{
delete[] pnts;
return false;
}
if (gridType == CGNS_ENUMV(Vertex))
{
}
else if (gridType == CGNS_ENUMV(CellCenter))
{
}
else
{
for (int i = 0; i < cellCount; i++)
{
qDebug() << i << pnts[i] - 1;
}
delete[] pnts;
return true;
}
//边界id
//for (int i = 0; i < cellCount; i++)
//{
// qDebug() << pnts[i] - 1;
//}
delete[] pnts;
return true;
}
bool FITKCGNSReader::readUnstructZoneBCs(int index_bc)
{
cgsize_t *pnts = new cgsize_t[2];
if (CG_OK != cg_boco_read(m_index_file, m_index_base, m_index_zone, index_bc, pnts, nullptr))
{
delete[] pnts;
return false;
}
int min = pnts[0];
int max = pnts[1];
CGNS_ENUMT(GridLocation_t) gridType;
if (CG_OK != cg_boco_gridlocation_read(m_index_file, m_index_base, m_index_zone, index_bc, &gridType))
{
delete[] pnts;
return false;
}
if (gridType == Vertex)
{
}
else if (gridType == CellCenter || gridType == FaceCenter || gridType == IFaceCenter ||
gridType == JFaceCenter || gridType == KFaceCenter)
{
}
else
{
qDebug() << "---Invalid gridType!---" << gridType;
for (int i = 0; i < 2; i++)
{
qDebug() << i << pnts[i] - 1;
}
delete[] pnts;
return true;
}
//for (int i = min; i <= max; i++)
//{
// bc.Ids.push_back(i - 1);
//}
delete[] pnts;
return true;
}
bool FITKCGNSReader::readStructZoneBCs(int index_bc)
{
cgsize_t range[2][3];
if (CG_OK != cg_boco_read(m_index_file, m_index_base, m_index_zone, index_bc, range[0], range[1]))
{
return false;
}
CGNS_ENUMT(GridLocation_t) gridType;
if (CG_OK != cg_boco_gridlocation_read(m_index_file, m_index_base, m_index_zone, index_bc, &gridType))
{
return false;
}
//bc.Start.I = range[0][0];
//bc.Start.J = range[0][1];
//bc.Start.K = range[0][2];
//bc.End.I = range[1][0];
//bc.End.J = range[1][1];
//bc.End.K = range[1][2];
if (gridType == Vertex)
{
}
else if (gridType == CellCenter || gridType == FaceCenter || gridType == IFaceCenter ||
gridType == JFaceCenter || gridType == KFaceCenter)
{
}
else
{
qDebug() << "---Invalid gridType!---" << gridType;
// for(int i = 0 ; i < 2 ; i ++)
// {
// qDebug() << i << pnts[i] - 1;
// }
return true;
}
return true;
}
bool FITKCGNSReader::readSections()
{
Interface::FITKBoundaryMeshVTKManager* boundaryMeshMgr = m_Mesh->getBoundaryMeshManager();
if (!boundaryMeshMgr)return false;
//获取元素集数量
int nsections = 0;
cg_nsections(m_index_file, m_index_base, m_index_zone, &nsections);
//获取元素
for (int section_index = 1; section_index <= nsections; section_index++)
{
//获取元素信息
char section_name[33] = { 0 };
/*int*/ cgsize_t istart = 0, iend = 0;
int nbndry = 0, iparent_flag = 0;
CGNS_ENUMT(ElementType_t)
itype;
if (cg_section_read(m_index_file, m_index_base, m_index_zone, section_index, section_name, &itype, &istart, &iend, &nbndry, &iparent_flag))
return false;
//获取元素数量
/*int*/ cgsize_t element_data_size = 0;
if (cg_ElementDataSize(m_index_file, m_index_base, m_index_zone, section_index, &element_data_size))
return false;
if (element_data_size == 0) continue;
int size = 4 * (iend - istart + 1);
cgsize_t *elements = new cgsize_t[element_data_size];
cgsize_t *element_parent = nullptr;
if (iparent_flag)
{
element_parent = new cgsize_t[size];
}
if (cg_elements_read(m_index_file, m_index_base, m_index_zone, section_index, elements, element_parent))
{
delete[] elements;
if (element_parent) delete[] element_parent;
return false;
}
if (cg_poly_elements_read(m_index_file, m_index_base, m_index_zone, section_index, elements, 0, element_parent))
{
delete[] elements;
if (element_parent) delete[] element_parent;
return false;
}
//创建边界网格
m_boundaryMesh = new Interface::FITKBoundaryMeshVTK(m_Mesh->getFieldMesh());
m_boundaryMesh->setDataObjectName(section_name);
//读取单元数据
this->readCells(istart, iend, itype, elements, element_data_size);
//插入边界网格
boundaryMeshMgr->appendDataObj(m_boundaryMesh);
m_boundaryMesh = nullptr;
delete[] elements;
if (element_parent)delete[] element_parent;
}
return true;
}
void FITKCGNSReader::readCells(int start_index, int end_index, int type, cgsize_t *elements /*int* elements*/, int element_data_size)
{
if (CGNS_ENUMT(TRI_3) == type) //三角形
{
int cell_number = element_data_size / 3;
assert(0 == element_data_size % 3);
assert(end_index - start_index + 1 == cell_number);
for (int iCnt = 0; iCnt < cell_number; ++iCnt)
{
QList<int> nodes;
nodes.append(elements[iCnt * 3 + 0]);
nodes.append(elements[iCnt * 3 + 1]);
nodes.append(elements[iCnt * 3 + 2]);
Interface::FITKAbstractElement* element = Interface::FITKElementFactory::createElement(Interface::FITKModelEnum::FITKEleType::Tri3);
element->setNodeID(nodes);
m_boundaryMesh->appendElement(element);
}
}
else if (CGNS_ENUMT(BAR_2) == type) //二节点梁单元
{
Interface::FITKBoundaryMeshVTK* boundary = new Interface::FITKBoundaryMeshVTK(m_Mesh->getFieldMesh());
int cell_number = element_data_size / 2;
assert(0 == element_data_size % 2);
assert(end_index - start_index + 1 == cell_number);
for (int iCnt = 0; iCnt < cell_number; ++iCnt)
{
QList<int> nodes;
nodes.append(elements[iCnt * 2 + 0]);
nodes.append(elements[iCnt * 2 + 1]);
Interface::FITKAbstractElement* element = Interface::FITKElementFactory::createElement(Interface::FITKModelEnum::FITKEleType::Line2);
element->setNodeID(nodes);
m_boundaryMesh->appendElement(element);
}
}
else if (CGNS_ENUMT(TETRA_4) == type) //四节点四面体
{
int cell_number = element_data_size / 4;
assert(0 == element_data_size % 4);
assert(end_index - start_index + 1 == cell_number);
for (int iCnt = 0; iCnt < cell_number; ++iCnt)
{
QList<int> nodes;
nodes.append(elements[iCnt * 4 + 0]);
nodes.append(elements[iCnt * 4 + 1]);
nodes.append(elements[iCnt * 4 + 2]);
nodes.append(elements[iCnt * 4 + 3]);
Interface::FITKAbstractElement* element = Interface::FITKElementFactory::createElement(Interface::FITKModelEnum::FITKEleType::Tet4);
element->setNodeID(nodes);
m_boundaryMesh->appendElement(element);
}
}
else if (CGNS_ENUMT(QUAD_4) == type) //四节点四边形
{
int cell_number = element_data_size / 4;
assert(0 == element_data_size % 4);
assert(end_index - start_index + 1 == cell_number);
for (int iCnt = 0; iCnt < cell_number; ++iCnt)
{
QList<int> nodes;
nodes.append(elements[iCnt * 4 + 0]);
nodes.append(elements[iCnt * 4 + 1]);
nodes.append(elements[iCnt * 4 + 2]);
nodes.append(elements[iCnt * 4 + 3]);
Interface::FITKAbstractElement* element = Interface::FITKElementFactory::createElement(Interface::FITKModelEnum::FITKEleType::Quad4);
element->setNodeID(nodes);
m_boundaryMesh->appendElement(element);
}
}
else if (CGNS_ENUMT(HEXA_8) == type) //八节点六面体
{
int cell_number = element_data_size / 8;
assert(0 == element_data_size % 8);
assert(end_index - start_index + 1 == cell_number);
for (int iCnt = 0; iCnt < cell_number; ++iCnt)
{
QList<int> nodes;
nodes.append(elements[iCnt * 8 + 0]);
nodes.append(elements[iCnt * 8 + 1]);
nodes.append(elements[iCnt * 8 + 2]);
nodes.append(elements[iCnt * 8 + 3]);
nodes.append(elements[iCnt * 8 + 4]);
nodes.append(elements[iCnt * 8 + 5]);
nodes.append(elements[iCnt * 8 + 6]);
nodes.append(elements[iCnt * 8 + 7]);
Interface::FITKAbstractElement* element = Interface::FITKElementFactory::createElement(Interface::FITKModelEnum::FITKEleType::Hex8);
element->setNodeID(nodes);
m_boundaryMesh->appendElement(element);
}
}
else if (CGNS_ENUMT(PENTA_6) == type) //六节点三棱柱
{
int cell_number = element_data_size / 6;
assert(0 == element_data_size % 6);
assert(end_index - start_index + 1 == cell_number);
for (int iCnt = 0; iCnt < cell_number; ++iCnt)
{
QList<int> nodes;
nodes.append(elements[iCnt * 6 + 0]);
nodes.append(elements[iCnt * 6 + 1]);
nodes.append(elements[iCnt * 6 + 2]);
nodes.append(elements[iCnt * 6 + 3]);
nodes.append(elements[iCnt * 6 + 4]);
nodes.append(elements[iCnt * 6 + 5]);
Interface::FITKAbstractElement* element = Interface::FITKElementFactory::createElement(Interface::FITKModelEnum::FITKEleType::Wedge6);
element->setNodeID(nodes);
m_boundaryMesh->appendElement(element);
}
}
else if (CGNS_ENUMV(PYRA_5) == type) //金字塔类型
{
int cell_number = element_data_size / 5;
assert(0 == element_data_size % 5);
assert(end_index - start_index + 1 == cell_number);
for (int iCnt = 0; iCnt < cell_number; ++iCnt)
{
//QList<int> nodes;
//nodes.append(elements[iCnt * 5 + 0]);
//nodes.append(elements[iCnt * 5 + 1]);
//nodes.append(elements[iCnt * 5 + 2]);
//nodes.append(elements[iCnt * 5 + 3]);
//nodes.append(elements[iCnt * 5 + 4]);
//Interface::FITKAbstractElement* element = Interface::FITKElementFactory::createElement(Interface::FITKModelEnum::FITKEleType::Polygon);
//element->setNodeID(nodes);
//m_boundaryMesh->appendElement(element);
}
}
else if (CGNS_ENUMV(MIXED) == type)
{
// qDebug() << "mix";
int index = 0;
while (index < element_data_size)
{
int eleType = elements[index];
if (eleType == CGNS_ENUMT(PENTA_6))
{
/*vtkSmartPointer<vtkIdList> idlist = vtkSmartPointer<vtkIdList>::New();
idlist->InsertNextId(elements[index + 1] - 1);
idlist->InsertNextId(elements[index + 2] - 1);
idlist->InsertNextId(elements[index + 3] - 1);
idlist->InsertNextId(elements[index + 4] - 1);
idlist->InsertNextId(elements[index + 5] - 1);
idlist->InsertNextId(elements[index + 6] - 1);
ungird->InsertNextCell(VTK_WEDGE, idlist);*/
index += 7;
}
else if (eleType == CGNS_ENUMT(HEXA_8))
{
/*vtkSmartPointer<vtkIdList> idlist = vtkSmartPointer<vtkIdList>::New();
idlist->InsertNextId(elements[index + 1] - 1);
idlist->InsertNextId(elements[index + 2] - 1);
idlist->InsertNextId(elements[index + 3] - 1);
idlist->InsertNextId(elements[index + 4] - 1);
idlist->InsertNextId(elements[index + 5] - 1);
idlist->InsertNextId(elements[index + 6] - 1);
idlist->InsertNextId(elements[index + 7] - 1);
idlist->InsertNextId(elements[index + 8] - 1);
ungird->InsertNextCell(VTK_HEXAHEDRON, idlist);*/
index += 9;
}
else if (eleType == CGNS_ENUMT(TRI_3))
{
/* vtkSmartPointer<vtkIdList> idlist = vtkSmartPointer<vtkIdList>::New();
idlist->InsertNextId(elements[index + 1] - 1);
idlist->InsertNextId(elements[index + 2] - 1);
idlist->InsertNextId(elements[index + 3] - 1);
ungird->InsertNextCell(VTK_TRIANGLE, idlist);*/
index += 4;
}
else if (eleType == CGNS_ENUMT(QUAD_4))
{
/* vtkSmartPointer<vtkIdList> idlist = vtkSmartPointer<vtkIdList>::New();
idlist->InsertNextId(elements[index + 1] - 1);
idlist->InsertNextId(elements[index + 2] - 1);
idlist->InsertNextId(elements[index + 3] - 1);
idlist->InsertNextId(elements[index + 4] - 1);
ungird->InsertNextCell(VTK_QUAD, idlist);*/
index += 5;
}
else if (eleType == CGNS_ENUMT(TETRA_4))
{
/*vtkSmartPointer<vtkIdList> idlist = vtkSmartPointer<vtkIdList>::New();
idlist->InsertNextId(elements[index + 1] - 1);
idlist->InsertNextId(elements[index + 2] - 1);
idlist->InsertNextId(elements[index + 3] - 1);
idlist->InsertNextId(elements[index + 4] - 1);
ungird->InsertNextCell(VTK_TETRA, idlist);*/
index += 5;
}
else if (eleType == CGNS_ENUMT(BAR_2)) //二节点梁单元
{
/* vtkSmartPointer<vtkIdList> idlist = vtkSmartPointer<vtkIdList>::New();
idlist->InsertNextId(elements[index + 1] - 1);
idlist->InsertNextId(elements[index + 2] - 1);
ungird->InsertNextCell(VTK_LINE, idlist);*/
index += 3;
}
else
index += element_data_size;
}
}
//#endif
}
}