MED fichier
MEDgetGeometryTypeFromName.cxx
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2  *
3  * COPYRIGHT (C) 1999 - 2016 EDF R&D, CEA/DEN
4  * MED is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * MED is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with MED. If not, see <http://www.gnu.org/licenses/>.
16  */
18 
19 #include "med_config.h"
20 #include "med_outils.h"
21 
22 using namespace std;
23 
25 
27  static MED_GET_GEOTYPE_FROM_NAME obj;
28  return obj;
29 }
30 
32 //
34 {
35  map<string,med_geometry_type > & table = ( map<string, med_geometry_type > & ) *this ;
36 
37  table["PO1"] = MED_POINT1;
38  table["SE2"] = MED_SEG2;
39  table["SE3"] = MED_SEG3;
40  table["SE4"] = MED_SEG4;
41  table["TR3"] = MED_TRIA3;
42  table["TR6"] = MED_TRIA6;
43  table["TR7"] = MED_TRIA7;
44  table["QU4"] = MED_QUAD4;
45  table["QU8"] = MED_QUAD8;
46  table["QU9"] = MED_QUAD9;
47  table["TE4"] = MED_TETRA4;
48  table["T10"] = MED_TETRA10;
49  table["O12"] = MED_OCTA12;
50  table["HE8"] = MED_HEXA8;
51  table["H20"] = MED_HEXA20;
52  table["H27"] = MED_HEXA27;
53  table["PE6"] = MED_PENTA6;
54  table["P15"] = MED_PENTA15;
55  table["PY5"] = MED_PYRA5;
56  table["P13"] = MED_PYRA13;
57  table["POG"] = MED_POLYGON;
58  table["PO2"] = MED_POLYGON2;
59  table["POE"] = MED_POLYHEDRON;
60 
61 }
62 
63 
65 {
66  map<string,med_geometry_type > &table = (map<string, med_geometry_type >&)*this ;
67 
68  map<string,med_geometry_type >::iterator it = table.find( c );
69 
70  if ( it == table.end() ) return (med_geometry_type) 0;
71  return (*it).second;
72 }
73 
74 
75 extern "C" {
76  med_geometry_type MEDgetGeometryTypeFromName(const char * const keycharpart) {
77  return MEDgetGeotypeFromName[string(keycharpart)];
78  }
79 }
#define MED_TRIA3
Definition: med.h:186
#define MED_QUAD4
Definition: med.h:187
#define MED_TRIA6
Definition: med.h:188
#define MED_POLYGON
Definition: med.h:204
#define MED_PENTA6
Definition: med.h:195
#define MED_POLYGON2
Definition: med.h:205
#define MED_TETRA4
Definition: med.h:193
#define MED_SEG4
Definition: med.h:185
#define MED_TRIA7
Definition: med.h:189
med_geometry_type MEDgetGeometryTypeFromName(const char *const keycharpart)
static MED_GET_GEOTYPE_FROM_NAME & Instance()
#define MED_SEG2
Definition: med.h:183
med_geometry_type operator[](const std::string &c) const
#define MED_QUAD9
Definition: med.h:191
#define MED_OCTA12
Definition: med.h:198
#define MED_PYRA5
Definition: med.h:194
#define MED_POLYHEDRON
Definition: med.h:206
STL namespace.
#define MED_HEXA20
Definition: med.h:201
#define MED_PENTA15
Definition: med.h:200
#define MED_PYRA13
Definition: med.h:199
static MED_GET_GEOTYPE_FROM_NAME & MEDgetGeotypeFromName
#define MED_POINT1
Definition: med.h:181
#define MED_HEXA27
Definition: med.h:202
#define MED_SEG3
Definition: med.h:184
#define MED_QUAD8
Definition: med.h:190
#define MED_HEXA8
Definition: med.h:196
#define MED_TETRA10
Definition: med.h:197
int med_geometry_type
Definition: med.h:179