Salome HOME
NRI : Merge from V1_2.
[modules/visu.git] / src / VISU_I / VISU_Convertor_impl.hxx
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : VISU_Convertor_impl.hxx
6 //  Author : Alexey PETROV
7 //  Module : VISU
8
9 #ifndef VISU_Convertor_impl_HeaderFile
10 #define VISU_Convertor_impl_HeaderFile
11
12 #include "VISU_Convertor.hxx"
13
14 extern "C"{
15 #include <med.h>
16 }  
17
18 #include <qstring.h>
19 #include <qfileinfo.h>
20
21 #include <fstream>      
22 #include <strstream>    
23 using namespace std;
24
25 class VISU_Convertor_impl: public VISU_Convertor{
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 OutputType* GetMeshOnEntity(const string& theMeshName, 
41                                       const VISU::TEntity& theEntity,
42                                       const string& theFamilyName = "")
43     throw(std::runtime_error&);
44   virtual OutputType* GetMeshOnGroup(const string& theMeshName, 
45                                      const string& theGroupName)
46     throw(std::runtime_error&);
47   virtual OutputType* GetFieldOnMesh(const string& theMeshName, 
48                                      const VISU::TEntity& theEntity,
49                                      const string& theFieldName,
50                                      int theStampsNum)
51     throw(std::runtime_error&);
52
53  protected:
54   virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
55                                const string& theFamilyName = "")
56     throw (std::runtime_error&) = 0;
57   virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
58                               const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
59     throw (std::runtime_error&) = 0;
60   virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
61                               VISU::TMeshOnEntity& theMeshOnEntity, 
62                               VISU::TField& theField, 
63                               VISU::TField::TValForTime& theValForTime)
64     throw (std::runtime_error&) = 0;
65 };
66
67 extern "C"{
68   int getNbMedConnect(int theMedType, int theMedEntity, int theMeshDim);
69   int getNbMedNodes(int theMedType);
70   int med2vtkCellType(int theMedType);
71   int vtk2medCellType(int theVtkType);
72   int getIdMedType(int medType);
73 }
74
75 struct Med2vtk {
76   med_geometrie_element medType;
77   const char *medName;
78   int medNbNodes;
79   int vtkType;
80   const char *vtkName;
81   int vtkNbNodes;
82 };
83 extern Med2vtk med2vtk[MED_NBR_GEOMETRIE_MAILLE];
84 #endif