Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / MEDSPLITTER / MEDSPLITTER_MESHCollectionDriver.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
2 //
3 //  This library is free software; you can redistribute it and/or
4 //  modify it under the terms of the GNU Lesser General Public
5 //  License as published by the Free Software Foundation; either
6 //  version 2.1 of the License.
7 //
8 //  This library is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 //  Lesser General Public License for more details.
12 //
13 //  You should have received a copy of the GNU Lesser General Public
14 //  License along with this library; if not, write to the Free Software
15 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef MESHCOLLECTIONDRIVER_HXX_
20 #define MESHCOLLECTIONDRIVER_HXX_
21
22 #include "MEDSPLITTER.hxx"
23
24 namespace MEDSPLITTER{
25         
26 class MESHCollection;
27
28 class MEDSPLITTER_EXPORT MESHCollectionDriver
29 {
30 public:
31   
32   MESHCollectionDriver(MESHCollection*);
33   virtual ~MESHCollectionDriver(){}
34
35   virtual int read(char*)=0;
36   int readSeq(char*,char*);
37   
38   virtual void write(char*)=0;
39         virtual void readFields (vector <MEDMEM::FIELD<int> *>& filenames, char* fieldname,
40                                                                                                                         int itnumber, int ordernumber) =0;
41         virtual void readFields (vector <MEDMEM::FIELD<double> *>& filenames, char* fieldname,
42                                                                                                                         int itnumber, int ordernumber) =0;
43         virtual void writeFields(vector <MEDMEM::FIELD<int> *>& filenames, char* fieldname)=0;
44         virtual void writeFields(vector <MEDMEM::FIELD<double> *>& filenames, char* fieldname)=0;
45
46   void readFileStruct(vector <string>&  field_names,vector<int>& iternumber,vector <int>&  ordernumber,vector <int> & types);
47   
48   int getFieldType(const std::string& fieldname);
49   //    void exportFamily(vector<int*>,MED_EN::medEntityMesh, const string& name);
50
51 protected:
52
53  void readSubdomain(const string& meshname, vector<int*>& cellglobal,
54 vector<int*>& faceglobal,
55 vector<int*>& nodeglobal, int idomain);
56  void writeSubdomain(int idomain,int nbdomain, char*filename);
57  
58 void writeElementJoint(medEntityMesh entity ,
59                        int icz, 
60                        int idomain, 
61                        int idistant, 
62                        char* mesh_name, 
63                        char* joint_name,  
64                        med_2_3::med_idt fid );
65 void jointSort(int* elems, int nbelems, bool is_first);
66
67
68
69   MESHCollection* m_collection;
70   
71   std::vector <std::string> m_filename;
72
73 };
74
75 }
76
77
78 #endif /*MESHCOLLECTIONDRIVER_HXX_*/