1 // Copyright (C) 2007-2012 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 # ifndef MEDFILEBROWSER_HXX
24 # define MEDFILEBROWSER_HXX
27 #include "MEDMEM_define.hxx"
28 #include "MEDMEM_Exception.hxx"
36 typedef struct { int dt; int it; } DT_IT_; //!< { numero du pas de temps, numero d'ordre }
37 struct MEDMEM_EXPORT LT_DT_IT_
39 bool operator() (const DT_IT_ &p1, const DT_IT_ &p2) const
42 return p1.it < p2.it ;
44 return p1.dt < p2.dt ;
47 typedef std::vector<DT_IT_> VEC_DT_IT_;
50 * \brief Class giving access to names of meshes and fields contained in the med file
52 class MEDMEM_EXPORT MEDFILEBROWSER
54 std::string _fileName;
56 std::map< std::string, bool > _meshes; //!< mesh name and isStructured flag
60 MED_EN::med_type_champ _type;
61 std::string _meshName;
65 std::map< std::string, FIELD_DATA_ > _fields; //!< field name and its type and "dtit"
70 MEDFILEBROWSER (const std::string & fileName) throw (MEDEXCEPTION);
71 void readFileStruct(const std::string & fileName) throw (MEDEXCEPTION);
73 std::string getFileName() const;
75 int getNumberOfMeshes ( void ) const;
76 int getNumberOfFields ( void ) const;
78 void getMeshNames ( std::string * meshNames ) const;
79 void getFieldNames ( std::string * fieldNames ) const;
81 std::vector< std::string > getMeshNames () const;
82 std::vector< std::string > getFieldNames() const;
84 bool isStructuredMesh(const std::string & meshName) const throw (MEDEXCEPTION);
86 MED_EN::med_type_champ getFieldType (const std::string & fieldName) const throw (MEDEXCEPTION) ;
87 std::string getMeshName (const std::string & fieldName) const throw (MEDEXCEPTION) ;
88 VEC_DT_IT_ getFieldIteration (const std::string & fieldName) const throw (MEDEXCEPTION) ;