1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "MEDMEM_DriversDef.hxx"
29 // Returns the (string) name of the geometry of
30 // an element given by a med_geometrie_element value
31 GEO_NAME::GEO_NAME() : map<int,string>()
33 map<int,string> &table = (map<int,string>&)*this ;
34 table[(int)0 ] = "MED_NONE" ;
35 table[(int)MED_POINT1 ] = "MED_POINT1" ;
36 table[(int)MED_SEG2 ] = "MED_SEG2" ;
37 table[(int)MED_SEG3 ] = "MED_SEG3" ;
38 table[(int)MED_TRIA3 ] = "MED_TRIA3" ;
39 table[(int)MED_TRIA6 ] = "MED_TRIA6" ;
40 table[(int)MED_QUAD4 ] = "MED_QUAD4" ;
41 table[(int)MED_QUAD8 ] = "MED_QUAD8" ;
42 table[(int)MED_TETRA4 ] = "MED_TETRA4" ;
43 table[(int)MED_TETRA10] = "MED_TETRA10";
44 table[(int)MED_HEXA8 ] = "MED_HEXA8" ;
45 table[(int)MED_HEXA20 ] = "MED_HEXA20" ;
46 table[(int)MED_PENTA6 ] = "MED_PENTA6" ;
47 table[(int)MED_PENTA15] = "MED_PENTA15";
48 table[(int)MED_PYRA5 ] = "MED_PYRA5" ;
49 table[(int)MED_PYRA13 ] = "MED_PYRA13" ;
50 table[(int)MED_POLYGON] = "MED_POLYGON";
51 table[(int)MED_POLYHEDRA] = "MED_POLYHEDRA";
52 assert( table.find( (int)MED_POLYHEDRA ) != table.end() ) ;
57 // MESSAGE_MED(" destructor GEO_NAME::~GEO_NAME() "<< size() );
59 // MESSAGE_MED(" end of destructor GEO_NAME::~GEO_NAME() "<< size() );
62 string & GEO_NAME::operator[]( const MED_EN::medGeometryElement &c ) const
64 map<int,string> &table = (map<int,string>&)*this ;
65 assert( table.find( (int)c ) != table.end() ) ;
66 return table[ (int)c ] ;
70 // Returns the (string) name of the type of
71 // an entity given by a med_entite_maillage value
73 ENT_NAME::ENT_NAME() : map<int,string>()
75 map<int,string> &table = (map<int,string>&)*this ;
76 table[(int)MED_CELL ] = "MED_MAILLE";
77 table[(int)MED_FACE ] = "MED_FACE";
78 table[(int)MED_EDGE ] = "MED_ARETE";
79 table[(int)MED_NODE ] = "MED_NOEUD";
84 // MESSAGE_MED(" destructor ENT_NAME::~ENT_NAME() "<< size() );
86 // MESSAGE_MED(" end of destructor ENT_NAME::~ENT_NAME() "<< size() );
89 string & ENT_NAME::operator[]( const MED_EN::medEntityMesh &c ) const
91 map<int,string> &table = (map<int,string>&)*this ;
92 assert( table.find( (int)c ) != table.end() ) ;
93 return table[ (int)c ] ;
96 MESH_ENTITIES::MESH_ENTITIES () : map<int, const list<MED_EN::medGeometryElement> >()
98 // Override the const declaration in order to used the find method below
99 // map<int, const list<med_geometrie_element> > &table = (map<int, const list<med_geometrie_element> >&)*this ; unused local variable
101 // Initialize the value associated with the ROUGE_ key ( use the private operator = )
103 const MED_EN::medGeometryElement T[] = {
122 list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));
123 (*this)[MED_CELL] = geomList;
127 const MED_EN::medGeometryElement T[] = {
134 list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));
135 (*this)[MED_FACE] = geomList;
139 const MED_EN::medGeometryElement T[] = {
143 list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));
144 (*this)[MED_EDGE] = geomList;
148 // const med_geometrie_element T[] = { MED_NONE };
149 const MED_EN::medGeometryElement T[] = { (MED_EN::medGeometryElement)0 };
150 list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));
151 (*this)[MED_NODE] = geomList;
156 MESH_ENTITIES::~MESH_ENTITIES()
158 // MESSAGE_MED(" destructor MESH_ENTITIES::~MESH_ENTITIES() "<< size() );
160 // MESSAGE_MED(" end of destructor MESH_ENTITIES::~MESH_ENTITIES() "<< size() );
163 const list<MED_EN::medGeometryElement> & MESH_ENTITIES::operator[]( const MED_EN::medEntityMesh &c ) const
165 map<int,const list<MED_EN::medGeometryElement> > &table = (map<int,const list<MED_EN::medGeometryElement> >&)*this ;
166 // Verify the object already exists in the map
167 assert( table.find( (int)c ) != table.end() ) ;
168 return table[ (int)c ] ;
171 // This operator is used to initialize class objects of type const list<med_geometrie_element>
172 list<MED_EN::medGeometryElement> & MESH_ENTITIES::operator[]( const MED_EN::medEntityMesh &c )
174 return (list<MED_EN::medGeometryElement> &) this->map<int,const list<MED_EN::medGeometryElement> >::operator[]( (int)c) ;
177 } // End Of NampeSpace MED_EN