1 // Copyright (C) 2007-2008 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
22 #include "MEDMEM_DriversDef.hxx"
28 // Returns the (string) name of the geometry of
29 // an element given by a med_geometrie_element value
30 GEO_NAME::GEO_NAME() : map<int,string>()
32 map<int,string> &table = (map<int,string>&)*this ;
33 table[(int)0 ] = "MED_NONE" ;
34 table[(int)MED_POINT1 ] = "MED_POINT1" ;
35 table[(int)MED_SEG2 ] = "MED_SEG2" ;
36 table[(int)MED_SEG3 ] = "MED_SEG3" ;
37 table[(int)MED_TRIA3 ] = "MED_TRIA3" ;
38 table[(int)MED_TRIA6 ] = "MED_TRIA6" ;
39 table[(int)MED_QUAD4 ] = "MED_QUAD4" ;
40 table[(int)MED_QUAD8 ] = "MED_QUAD8" ;
41 table[(int)MED_TETRA4 ] = "MED_TETRA4" ;
42 table[(int)MED_TETRA10] = "MED_TETRA10";
43 table[(int)MED_HEXA8 ] = "MED_HEXA8" ;
44 table[(int)MED_HEXA20 ] = "MED_HEXA20" ;
45 table[(int)MED_PENTA6 ] = "MED_PENTA6" ;
46 table[(int)MED_PENTA15] = "MED_PENTA15";
47 table[(int)MED_PYRA5 ] = "MED_PYRA5" ;
48 table[(int)MED_PYRA13 ] = "MED_PYRA13" ;
49 table[(int)MED_POLYGON] = "MED_POLYGON";
50 table[(int)MED_POLYHEDRA] = "MED_POLYHEDRA";
51 assert( table.find( (int)MED_POLYHEDRA ) != table.end() ) ;
56 // MESSAGE_MED(" destructor GEO_NAME::~GEO_NAME() "<< size() );
58 // MESSAGE_MED(" end of destructor GEO_NAME::~GEO_NAME() "<< size() );
61 string & GEO_NAME::operator[]( const MED_EN::medGeometryElement &c ) const
63 map<int,string> &table = (map<int,string>&)*this ;
64 assert( table.find( (int)c ) != table.end() ) ;
65 return table[ (int)c ] ;
69 // Returns the (string) name of the type of
70 // an entity given by a med_entite_maillage value
72 ENT_NAME::ENT_NAME() : map<int,string>()
74 map<int,string> &table = (map<int,string>&)*this ;
75 table[(int)MED_CELL ] = "MED_MAILLE";
76 table[(int)MED_FACE ] = "MED_FACE";
77 table[(int)MED_EDGE ] = "MED_ARETE";
78 table[(int)MED_NODE ] = "MED_NOEUD";
83 // MESSAGE_MED(" destructor ENT_NAME::~ENT_NAME() "<< size() );
85 // MESSAGE_MED(" end of destructor ENT_NAME::~ENT_NAME() "<< size() );
88 string & ENT_NAME::operator[]( const MED_EN::medEntityMesh &c ) const
90 map<int,string> &table = (map<int,string>&)*this ;
91 assert( table.find( (int)c ) != table.end() ) ;
92 return table[ (int)c ] ;
95 MESH_ENTITIES::MESH_ENTITIES () : map<int, const list<MED_EN::medGeometryElement> >()
97 // Override the const declaration in order to used the find method below
98 // map<int, const list<med_geometrie_element> > &table = (map<int, const list<med_geometrie_element> >&)*this ; unused local variable
100 // Initialize the value associated with the ROUGE_ key ( use the private operator = )
102 const MED_EN::medGeometryElement T[] = {
121 static const list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));
122 (*this)[MED_CELL] = geomList;
126 const MED_EN::medGeometryElement T[] = {
133 static const list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));
134 (*this)[MED_FACE] = geomList;
138 const MED_EN::medGeometryElement T[] = {
142 static const list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));
143 (*this)[MED_EDGE] = geomList;
147 // const med_geometrie_element T[] = { MED_NONE };
148 const MED_EN::medGeometryElement T[] = { (MED_EN::medGeometryElement)0 };
149 static const list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));
150 (*this)[MED_NODE] = geomList;
155 MESH_ENTITIES::~MESH_ENTITIES()
157 // MESSAGE_MED(" destructor MESH_ENTITIES::~MESH_ENTITIES() "<< size() );
159 // MESSAGE_MED(" end of destructor MESH_ENTITIES::~MESH_ENTITIES() "<< size() );
162 const list<MED_EN::medGeometryElement> & MESH_ENTITIES::operator[]( const MED_EN::medEntityMesh &c ) const
164 map<int,const list<MED_EN::medGeometryElement> > &table = (map<int,const list<MED_EN::medGeometryElement> >&)*this ;
165 // Verify the object already exists in the map
166 assert( table.find( (int)c ) != table.end() ) ;
167 return table[ (int)c ] ;
170 // This operator is used to initialize class objects of type const list<med_geometrie_element>
171 list<MED_EN::medGeometryElement> & MESH_ENTITIES::operator[]( const MED_EN::medEntityMesh &c )
173 return (list<MED_EN::medGeometryElement> &) this->map<int,const list<MED_EN::medGeometryElement> >::operator[]( (int)c) ;
176 } // End Of NampeSpace MED_EN