Salome HOME
NRI : Remove dependence with KERNEL.
[modules/visu.git] / src / VISU_I / VISU_Convertor_impl.hxx
1 // File:        VISU_Convertor_impl.hxx
2 // Created:     Fri Jan 10 11:36:46 2003
3 // Author:      Alexey PETROV
4 //              <apo@ivanox.nnov.matra-dtv.fr>
5
6
7 #ifndef VISU_Convertor_impl_HeaderFile
8 #define VISU_Convertor_impl_HeaderFile
9
10 #include "VISU_Convertor.hxx"
11
12 extern "C"{
13 #include <med.h>
14 }  
15
16 #include <qstring.h>
17 #include <qfileinfo.h>
18
19 #include <fstream>      
20 #include <strstream>    
21 using namespace std;
22
23 class VISU_Convertor_impl: public VISU_Convertor{
24  protected:
25   bool myIsDone;
26  private:
27   string GetHead(const string& theMeshName) const throw (std::runtime_error&);
28   string GetPoints(const VISU::TMesh& theMesh) const throw (std::runtime_error&);
29   int GetCells(ostrstream& strCellsOut, ostrstream& strTypesOut,
30                const VISU::TMeshOnEntity& theMeshOnEntity, 
31                const string& theFamilyName = "") const throw (std::runtime_error&);
32   string GetField(const VISU::TField& theField, 
33                   const VISU::TField::TValForTime& theValForTime,
34                   int theDim, int theNbPoints, int theNbCells) const 
35                     throw (std::runtime_error&);
36  public:
37   VISU_Convertor_impl();
38   virtual ~VISU_Convertor_impl();
39   virtual VISU_Convertor* Build() throw (std::runtime_error&) { return this;};
40   virtual int ToMedFile(const string& theFileName) throw(std::runtime_error&);
41   virtual int ToDatFile(const string& theFileName) throw(std::runtime_error&);
42   virtual int ToFile(const string& theFileName) throw(std::runtime_error&);
43
44   virtual OutputType* GetMeshOnEntity(const string& theMeshName, 
45                                       const VISU::TEntity& theEntity,
46                                       const string& theFamilyName = "")
47     throw(std::runtime_error&);
48   virtual OutputType* GetMeshOnGroup(const string& theMeshName, 
49                                      const string& theGroupName)
50     throw(std::runtime_error&);
51   virtual OutputType* GetFieldOnMesh(const string& theMeshName, 
52                                      const VISU::TEntity& theEntity,
53                                      const string& theFieldName,
54                                      int theStampsNum)
55     throw(std::runtime_error&);
56
57  protected:
58   virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
59                                const string& theFamilyName = "")
60     throw (std::runtime_error&) = 0;
61   virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
62                               const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
63     throw (std::runtime_error&) = 0;
64   virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
65                               VISU::TMeshOnEntity& theMeshOnEntity, 
66                               VISU::TField& theField, 
67                               VISU::TField::TValForTime& theValForTime)
68     throw (std::runtime_error&) = 0;
69 };
70
71 extern "C"{
72   int getNbMedConnect(int theMedType, int theMedEntity, int theMeshDim);
73   int getNbMedNodes(int theMedType);
74   int med2vtkCellType(int theMedType);
75   int vtk2medCellType(int theVtkType);
76   int getIdMedType(int medType);
77 }
78
79 struct Med2vtk {
80   med_geometrie_element medType;
81   const char *medName;
82   int medNbNodes;
83   int vtkType;
84   const char *vtkName;
85   int vtkNbNodes;
86 };
87 extern Med2vtk med2vtk[MED_NBR_GEOMETRIE_MAILLE];
88 #endif