1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/
30 # include "MEDMEM_define.hxx"
31 # include "MEDMEM_Exception.hxx"
32 # include "MEDMEM_GenDriver.hxx"
40 typedef string MESH_NAME_;
41 typedef string FIELD_NAME_;
42 typedef struct { int dt; int it; } DT_IT_;
45 bool operator() (const DT_IT_ &p1, const DT_IT_ &p2) const
48 return p1.it < p2.it ;
50 return p1.dt < p2.dt ;
53 typedef map<DT_IT_, FIELD_*, LT_DT_IT_ > MAP_DT_IT_;
55 // - IN THE FIRST CASE THE USER WANTS TO DISCOVER MESHES & FIELD_S
56 // CONTAINNED WITHIN A FILE <fileName> OF TYPE GIVEN BY THE <driverType> PARAMETER
57 // - IN THE SECOND CASE THE USER BEGINS HIS WORK WITH A MESH OR A FIELD,
58 // ?? GET A MED POINTER THEN CAN ADD MESHes OR FIELDs ??
63 This class is use to group together some MESH, SUPPORT and FIELD
70 // Add your personnal driver line (step 2)
71 friend class MED_MED_RDONLY_DRIVER21;
72 friend class MED_MED_WRONLY_DRIVER21;
73 friend class MED_MED_RDWR_DRIVER21;
74 friend class MED_MED_RDONLY_DRIVER22;
75 friend class MED_MED_WRONLY_DRIVER22;
76 friend class MED_MED_RDWR_DRIVER22;
80 map<MESH_NAME_,MESH*> _meshes; // We can't have two MESHes with the same meshName.
81 // The string key is a meshName.
83 map<FIELD_NAME_,MAP_DT_IT_> _fields; // We can't have two FIELD_s with the same fieldName.
85 map<FIELD_ *, MESH_NAME_> _meshName; // Get the meshName associated with a FIELD_ *
86 // in order to get the MESH* from _meshes
88 // POURQUOI MED_FR::med_entite_maillage ? devrait être MED_EN !
89 map < MESH_NAME_, map < MED_EN::medEntityMesh, SUPPORT * > > _support ;
90 // For each MESH, we list support for each entity on all elements.
92 vector<GENDRIVER *> _drivers; // Storage of the MED_MED drivers currently in use
97 MED (driverTypes driverType, const string & fileName); // Analyse the file <fileName> by calling readFileStruct
100 // INUTILE : void addMesh (const string & meshName ); // Read the mesh <meshName> found in the file <_fileName>. <_fileName> must be set.
101 // INUTILE : void addField (const string & fieldName ); // Pensez au cas ou on ajoute un Field/Mesh avec un driver déjà existant.
103 void addField ( FIELD_ * const ptrField ) throw (MED_EXCEPTION) ;
104 void addMesh ( MESH * const ptrMesh ) throw (MED_EXCEPTION) ;
105 int addDriver (driverTypes driverType,
106 const string & fileName,
107 MED_EN::med_mode_acces access=MED_EN::MED_REMP);
108 int addDriver (GENDRIVER & driver);
109 void rmDriver (int index=0) throw (MEDEXCEPTION) ;
111 void readFileStruct(int index=0) throw (MEDEXCEPTION) ;
112 void read (int index=0) throw (MEDEXCEPTION) ;
113 void writeFrom (int index=0) throw (MEDEXCEPTION) ;
114 void write (int index=0) throw (MEDEXCEPTION) ;
116 // ------ End Of Drivers Management Part
118 int getNumberOfMeshes ( void ) const;
119 int getNumberOfFields ( void ) const;
120 void getMeshNames ( string * meshNames ) const throw (MEDEXCEPTION) ;
121 deque<string> getMeshNames () const;
122 MESH * getMesh ( const string & meshName ) const throw (MEDEXCEPTION) ;
123 MESH * getMesh ( const FIELD_ * const field ) const throw (MEDEXCEPTION) ;
124 void getFieldNames ( string * fieldNames ) const throw (MEDEXCEPTION) ;
125 deque<string> getFieldNames () const;
126 // A FAIRE DES ROUTINES QUI DONNENT LES PDT ET ITE
127 deque<DT_IT_> getFieldIteration (const string & fieldName) const throw (MEDEXCEPTION) ;
128 FIELD_ * getField ( const string & fieldName,
129 const int dt, const int it) const throw (MEDEXCEPTION) ;
130 FIELD_ * getField2 ( const string & fieldName,
131 double time, int it=0) const throw (MEDEXCEPTION) ;
133 const map<MED_EN::medEntityMesh,SUPPORT *> & getSupports(const string & meshName) const throw (MEDEXCEPTION) ;
135 SUPPORT * getSupport (const string & meshName,MED_EN::medEntityMesh entity) const throw (MEDEXCEPTION) ;
137 void updateSupport () ;
139 // GERER LE CAS DE L'APPARITION DES MEMES NOMS DS DES FICHIERS <> !!!!!
141 //friend ostream & operator<<(ostream &os,const MED & med);
148 //REM : AJOUTER DS LES DRIVERS des attributes INTERLACE, NO INTERLACE .........
149 // AJOUTER L'OPERATEUR DE RECOPIE