179 lines
4.6 KiB
C++
179 lines
4.6 KiB
C++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
// PPPPP H H EEEEE N N GGGGG L EEEEE III +
|
||
// P P H H E NN N G L E I +
|
||
// PPPPP HHHHH EEEEE N N N G GG L EEEEE I +
|
||
// P H H E N N N G G L E I +
|
||
// P H H EEEEE N N GGGGG LLLLL EEEEE III +
|
||
//------------------------------------------------------------------------+
|
||
// Platform for Hybrid Engineering Simulation of Flows +
|
||
// China Aerodynamics Research and Development Center +
|
||
// (C) Copyright, Since 2010 +
|
||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||
//! @file Gmesh.h
|
||
//! @brief Convert gmsh grid to fts grid.
|
||
//! @author He Xin.
|
||
|
||
#pragma once
|
||
#include "Precision.h"
|
||
#include <vector>
|
||
#include <set>
|
||
#include <string>
|
||
using namespace std;
|
||
|
||
namespace PHSPACE
|
||
{
|
||
#include "GmshDefines.h"
|
||
|
||
typedef enum
|
||
{
|
||
PH_MSH_LIN_2 = MSH_LIN_2,
|
||
PH_MSH_TRI_3 ,
|
||
PH_MSH_QUA_4 ,
|
||
PH_MSH_TET_4 ,
|
||
PH_MSH_HEX_8 ,
|
||
PH_MSH_PRI_6 ,
|
||
PH_MSH_PYR_5 ,
|
||
PH_MSH_LIN_3 ,
|
||
PH_MSH_TRI_6 ,
|
||
PH_MSH_QUA_9 ,
|
||
PH_MSH_TET_10 ,
|
||
PH_MSH_HEX_27 ,
|
||
PH_MSH_PRI_18 ,
|
||
PH_MSH_PYR_14 ,
|
||
PH_MSH_PNT ,
|
||
PH_MSH_QUA_8 ,
|
||
PH_MSH_HEX_20 ,
|
||
PH_MSH_PRI_15 ,
|
||
PH_MSH_PYR_13 ,
|
||
PH_MSH_TRI_9 ,
|
||
PH_MSH_TRI_10 ,
|
||
PH_MSH_TRI_12 ,
|
||
PH_MSH_TRI_15 ,
|
||
PH_MSH_TRI_15I ,
|
||
PH_MSH_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SH_HEX_125 ,
|
||
PH_MSH_HEX_196 ,
|
||
PH_MSH_TET_74 ,
|
||
PH_MSH_TET_100 ,
|
||
PH_MSH_TET_130 ,
|
||
PH_MSH_TET_164 ,
|
||
PH_MSH_TET_202 ,
|
||
PH_MSH_NUM_TYPE
|
||
} GmshElemEnum;
|
||
|
||
class CGNSFactory;
|
||
|
||
class GmeshElem
|
||
{
|
||
public:
|
||
int ntype; //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ֲ<EFBFBD>ͬ<EFBFBD>ĵ<EFBFBD>Ԫ<EFBFBD><D4AA>
|
||
int **conn_list; //<2F><><EFBFBD>ӱ<EFBFBD>
|
||
int *type; //ÿ<>ֵ<EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
int *istart; //ÿ<>ֵ<EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
||
int *iend; //ÿ<>ֵ<EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
||
int *number; //ÿ<>ֵ<EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
int nTotalCell;
|
||
public:
|
||
GmeshElem();
|
||
~GmeshElem();
|
||
public:
|
||
void Create(int ntype);
|
||
int GetNTotalCell() const { return nTotalCell; };
|
||
void SetNTotalCell(int nTotalCell) { this->nTotalCell = nTotalCell; };
|
||
void TreatElements(CGNSFactory *factory_cgns, vector<int> &type_container, vector<int> &number_container, vector<int> &index_container, vector<int> &bctype_container, int *e_nvertex);
|
||
};
|
||
|
||
class Gmesh
|
||
{
|
||
public:
|
||
Gmesh();
|
||
~Gmesh();
|
||
public:
|
||
void Read(fstream &file, CGNSFactory *factory_cgns);
|
||
private:
|
||
void ReadMeshFormat(fstream &file);
|
||
void ReadNodes(fstream &file, CGNSFactory *factory_cgns);
|
||
void ReadElements(fstream &file, CGNSFactory *factory_cgns);
|
||
public:
|
||
int NofValidElementTypesGmsh;
|
||
int *TypeGmsh2CGNS;
|
||
int *gmesh_nvertex;
|
||
int *cgns_nvertex;
|
||
void InitGmshNVertex();
|
||
void InitCGNSNVertex();
|
||
void InitGmsh2CGNSMap();
|
||
private:
|
||
int *elem_pt;
|
||
//version-number is a real number equal to 2.2
|
||
RDouble version_number;
|
||
//
|
||
//file-type is an integer equal to 0 in the ASCII file format.
|
||
int file_type;
|
||
|
||
//data-size is an integer equal to the size of the floating point numbers used in the file
|
||
//(currently only data-size = sizeof(RDouble) is supported).
|
||
int data_size;
|
||
|
||
//number-of-nodes
|
||
//is the number of nodes in the mesh.
|
||
int nTotalNode, nTotalCell;
|
||
|
||
vector<string> keyword;
|
||
};
|
||
|
||
void CreateValueSet(vector<int> &value_container, set<int> &value_set);
|
||
|
||
}
|
||
|