Select Git revision
GModelIO_MED.cpp 24.33 KiB
// Gmsh - Copyright (C) 1997-2015 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <gmsh@geuz.org>.
#include <string>
#include "GmshConfig.h"
#include "GmshMessage.h"
#include "GModel.h"
#if defined(HAVE_MED)
#include <string.h>
#include <map>
#include <sstream>
#include <vector>
#include "MVertex.h"
#include "MPoint.h"
#include "MLine.h"
#include "MTriangle.h"
#include "MQuadrangle.h"
#include "MTetrahedron.h"
#include "MHexahedron.h"
#include "MPrism.h"
#include "MPyramid.h"
#include "discreteVertex.h"
extern "C" {
#include <med.h>
}
#if (MED_MAJOR_NUM == 3)
// To avoid too many ifdefs below we use defines for the bits of the
// API that did not change too much between MED2 and MED3. If we remove
// MED2 support at some point, please remove these defines and replace
// the symbols accordingly.
#define med_geometrie_element med_geometry_type
#define med_maillage med_mesh_type
#define MED_TAILLE_NOM MED_NAME_SIZE
#define MED_TAILLE_LNOM MED_LNAME_SIZE
#define MED_TAILLE_DESC MED_COMMENT_SIZE
#define MED_NON_STRUCTURE MED_UNSTRUCTURED_MESH
#define MED_LECTURE MED_ACC_RDONLY
#define MED_CREATION MED_ACC_CREAT
#define MEDouvrir MEDfileOpen
#define MEDversionDonner MEDlibraryNumVersion
#define MEDversionLire MEDfileNumVersionRd
#define MEDnMaa MEDnMesh
#define MEDfermer MEDfileClose
#define MEDnFam MEDnFamily
#define MEDfichDesEcr MEDfileCommentWr
#endif
med_geometrie_element msh2medElementType(int msh)
{
switch(msh) {
case MSH_LIN_2: return MED_SEG2;
case MSH_TRI_3: return MED_TRIA3;
case MSH_QUA_4: return MED_QUAD4;
case MSH_TET_4: return MED_TETRA4;
case MSH_HEX_8: return MED_HEXA8;
case MSH_PRI_6: return MED_PENTA6;
case MSH_PYR_5: return MED_PYRA5;
case MSH_LIN_3: return MED_SEG3;
case MSH_TRI_6: return MED_TRIA6;
case MSH_TET_10: return MED_TETRA10;
case MSH_PNT: return MED_POINT1;
case MSH_QUA_8: return MED_QUAD8;
case MSH_HEX_20: return MED_HEXA20;
case MSH_PRI_15: return MED_PENTA15;