00001 // Copyright (C) 2007-2011 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 # ifndef MEDFILEBROWSER_HXX 00024 # define MEDFILEBROWSER_HXX 00025 00026 #include "MEDMEM.hxx" 00027 #include "MEDMEM_define.hxx" 00028 #include "MEDMEM_Exception.hxx" 00029 00030 #include <string> 00031 #include <map> 00032 #include <vector> 00033 00034 namespace MEDMEM { 00035 00036 typedef struct { int dt; int it; } DT_IT_; 00037 struct MEDMEM_EXPORT LT_DT_IT_ 00038 { 00039 bool operator() (const DT_IT_ &p1, const DT_IT_ &p2) const 00040 { 00041 if ( p1.dt == p2.dt) 00042 return p1.it < p2.it ; 00043 else 00044 return p1.dt < p2.dt ; 00045 } 00046 }; 00047 typedef std::vector<DT_IT_> VEC_DT_IT_; 00048 00052 class MEDMEM_EXPORT MEDFILEBROWSER 00053 { 00054 std::string _fileName; 00055 00056 std::map< std::string, bool > _meshes; 00057 00058 typedef struct 00059 { 00060 MED_EN::med_type_champ _type; 00061 std::string _meshName; 00062 VEC_DT_IT_ _vec_dtit; 00063 } FIELD_DATA_; 00064 00065 std::map< std::string, FIELD_DATA_ > _fields; 00066 00067 public: 00068 00069 MEDFILEBROWSER(); 00070 MEDFILEBROWSER (const std::string & fileName) throw (MEDEXCEPTION); 00071 void readFileStruct(const std::string & fileName) throw (MEDEXCEPTION); 00072 00073 std::string getFileName() const; 00074 00075 int getNumberOfMeshes ( void ) const; 00076 int getNumberOfFields ( void ) const; 00077 00078 void getMeshNames ( std::string * meshNames ) const; 00079 void getFieldNames ( std::string * fieldNames ) const; 00080 00081 std::vector< std::string > getMeshNames () const; 00082 std::vector< std::string > getFieldNames() const; 00083 00084 bool isStructuredMesh(const std::string & meshName) const throw (MEDEXCEPTION); 00085 00086 MED_EN::med_type_champ getFieldType (const std::string & fieldName) const throw (MEDEXCEPTION) ; 00087 std::string getMeshName (const std::string & fieldName) const throw (MEDEXCEPTION) ; 00088 VEC_DT_IT_ getFieldIteration (const std::string & fieldName) const throw (MEDEXCEPTION) ; 00089 }; 00090 00091 } 00092 00093 #endif