Back to index

salome-med  6.5.0
MEDMEM_DriversDef.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #include "MEDMEM_DriversDef.hxx"
00024 
00025 using namespace std;
00026 
00027 namespace MED_EN {
00028 
00029 // Returns the (string) name of the geometry of 
00030 // an element given by a med_geometrie_element value
00031 GEO_NAME::GEO_NAME() : map<int,string>()
00032 {
00033   map<int,string> &table  = (map<int,string>&)*this ;
00034   table[(int)0 ] = "MED_NONE" ;
00035   table[(int)MED_POINT1 ] = "MED_POINT1" ;
00036   table[(int)MED_SEG2   ] = "MED_SEG2"   ;
00037   table[(int)MED_SEG3   ] = "MED_SEG3"   ;
00038   table[(int)MED_TRIA3  ] = "MED_TRIA3"  ;
00039   table[(int)MED_TRIA6  ] = "MED_TRIA6"  ;
00040   table[(int)MED_QUAD4  ] = "MED_QUAD4"  ;
00041   table[(int)MED_QUAD8  ] = "MED_QUAD8"  ;
00042   table[(int)MED_TETRA4 ] = "MED_TETRA4" ;
00043   table[(int)MED_TETRA10] = "MED_TETRA10";
00044   table[(int)MED_HEXA8  ] = "MED_HEXA8"  ;
00045   table[(int)MED_HEXA20 ] = "MED_HEXA20" ;
00046   table[(int)MED_PENTA6 ] = "MED_PENTA6" ;
00047   table[(int)MED_PENTA15] = "MED_PENTA15";
00048   table[(int)MED_PYRA5  ] = "MED_PYRA5"  ;
00049   table[(int)MED_PYRA13 ] = "MED_PYRA13" ;
00050   table[(int)MED_POLYGON] = "MED_POLYGON";
00051   table[(int)MED_POLYHEDRA] = "MED_POLYHEDRA";
00052   assert( table.find( (int)MED_POLYHEDRA ) != table.end() ) ;
00053 }
00054  
00055 GEO_NAME::~GEO_NAME()
00056 {
00057 //   MESSAGE_MED(" destructor GEO_NAME::~GEO_NAME() "<< size() );
00058 //   clear();
00059 //   MESSAGE_MED(" end of destructor GEO_NAME::~GEO_NAME() "<< size() );
00060 }
00061  
00062 string & GEO_NAME::operator[]( const MED_EN::medGeometryElement &c ) const
00063 {
00064   map<int,string> &table = (map<int,string>&)*this ;
00065   assert( table.find( (int)c ) != table.end() ) ;
00066   return table[ (int)c ] ;
00067 }
00068 
00069 
00070 // Returns the (string) name of the type of 
00071 // an entity given by a med_entite_maillage value
00072 
00073 ENT_NAME::ENT_NAME() : map<int,string>()
00074 {
00075   map<int,string> &table = (map<int,string>&)*this ;
00076   table[(int)MED_CELL ] = "MED_MAILLE";
00077   table[(int)MED_FACE   ] = "MED_FACE"; 
00078   table[(int)MED_EDGE  ] = "MED_ARETE";
00079   table[(int)MED_NODE  ] = "MED_NOEUD";
00080 }
00081 
00082 ENT_NAME::~ENT_NAME()
00083 {
00084 //   MESSAGE_MED(" destructor ENT_NAME::~ENT_NAME() "<< size() );
00085 //   clear();
00086 //   MESSAGE_MED(" end of destructor ENT_NAME::~ENT_NAME() "<< size() );
00087 }
00088 
00089 string & ENT_NAME::operator[]( const MED_EN::medEntityMesh &c ) const
00090 {
00091   map<int,string> &table = (map<int,string>&)*this ;
00092   assert( table.find( (int)c ) != table.end() ) ;
00093   return table[ (int)c ] ;
00094 }
00095 
00096 MESH_ENTITIES::MESH_ENTITIES () : map<int, const list<MED_EN::medGeometryElement> >() 
00097 {
00098   // Override the const declaration in order to used the find method below
00099   //  map<int, const list<med_geometrie_element> > &table = (map<int, const list<med_geometrie_element> >&)*this ; unused local variable
00100   
00101   // Initialize the value associated with the ROUGE_ key ( use the private operator = )
00102   {
00103     const MED_EN::medGeometryElement T[] =  {
00104       MED_POINT1,
00105       MED_SEG2,
00106       MED_SEG3,
00107       MED_TRIA3,
00108       MED_QUAD4,
00109       MED_TRIA6,
00110       MED_QUAD8,
00111       MED_TETRA4,
00112       MED_PYRA5,
00113       MED_PENTA6,
00114       MED_HEXA8,
00115       MED_TETRA10,
00116       MED_PYRA13,
00117       MED_PENTA15,
00118       MED_HEXA20,
00119       MED_POLYGON,
00120       MED_POLYHEDRA};
00121 
00122     list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));   
00123     (*this)[MED_CELL] = geomList;
00124   }
00125   
00126   {
00127     const MED_EN::medGeometryElement T[] =  {
00128       MED_TRIA3,
00129       MED_QUAD4,
00130       MED_TRIA6,
00131       MED_QUAD8,
00132       MED_POLYGON};
00133 
00134     list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));   
00135     (*this)[MED_FACE] = geomList; 
00136   }
00137   
00138   {
00139     const MED_EN::medGeometryElement T[] =  {
00140       MED_SEG2,
00141       MED_SEG3 };
00142 
00143     list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));   
00144     (*this)[MED_EDGE] = geomList; 
00145   }
00146   
00147   {
00148     //    const med_geometrie_element T[] =  { MED_NONE };
00149     const MED_EN::medGeometryElement T[] =  { (MED_EN::medGeometryElement)0 };
00150     list<MED_EN::medGeometryElement> geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement));   
00151     (*this)[MED_NODE] = geomList; 
00152   }
00153   
00154 }
00155 
00156 MESH_ENTITIES::~MESH_ENTITIES()
00157 {
00158 //   MESSAGE_MED(" destructor MESH_ENTITIES::~MESH_ENTITIES() "<< size() );
00159 //   clear();
00160 //   MESSAGE_MED(" end of destructor MESH_ENTITIES::~MESH_ENTITIES() "<< size() );
00161 }
00162 
00163 const list<MED_EN::medGeometryElement> & MESH_ENTITIES::operator[]( const  MED_EN::medEntityMesh &c ) const
00164 {
00165   map<int,const list<MED_EN::medGeometryElement> > &table = (map<int,const list<MED_EN::medGeometryElement> >&)*this ;
00166   // Verify the object already exists in the map
00167   assert( table.find( (int)c ) != table.end() ) ;
00168   return table[ (int)c ] ;
00169 }
00170 
00171 // This operator is used to initialize class objects of type  const list<med_geometrie_element>
00172 list<MED_EN::medGeometryElement> & MESH_ENTITIES::operator[]( const  MED_EN::medEntityMesh &c )
00173 {
00174   return (list<MED_EN::medGeometryElement> &) this->map<int,const list<MED_EN::medGeometryElement> >::operator[]( (int)c) ;
00175 }
00176 
00177 } // End Of NampeSpace MED_EN
00178