]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/MEDMEM_DriverFactory.cxx
Salome HOME
80b7f80f00fbb5bce0cc35f0b3b63101efe6e79e
[modules/med.git] / src / MEDMEM / MEDMEM_DriverFactory.cxx
1 #include "MEDMEM_DriverFactory.hxx"
2
3 #include "MEDMEM_Mesh.hxx"
4 #include "MEDMEM_MedMeshDriver.hxx"
5 #include "MEDMEM_GibiMeshDriver.hxx"
6 #include "MEDMEM_PorflowMeshDriver.hxx"
7 #include "MEDMEM_VtkMeshDriver.hxx"
8
9 #include "MEDMEM_Med.hxx"
10 #include "MEDMEM_MedMedDriver.hxx"
11 #include "MEDMEM_VtkMedDriver.hxx"
12
13 //#include "MEDMEM_Field.hxx"
14
15 #include "MEDMEM_Exception.hxx"
16 //#include "MEDMEM_STRING.hxx"
17 //#include "utilities.h"
18
19 using namespace MEDMEM;
20
21 GENDRIVER *DRIVERFACTORY::buildDriverForMesh(driverTypes driverType, const std::string & fileName, MESH *mesh,const string &  driverName)
22 {
23   GENDRIVER *ret;
24   switch(driverType)
25     {
26     case MED_DRIVER : {
27       MED_MESH_RDWR_DRIVER *retmed=new MED_MESH_RDWR_DRIVER(fileName,mesh);
28       retmed->setMeshName(driverName);
29       return retmed;
30     }
31
32     case GIBI_DRIVER : {
33       ret=new GIBI_MESH_RDWR_DRIVER(fileName,mesh);
34       return ret;
35     }
36
37     case PORFLOW_DRIVER : {
38       ret=new PORFLOW_MESH_RDWR_DRIVER(fileName,mesh);
39       return ret;
40     }
41
42     case VTK_DRIVER : {
43       ret=new VTK_MESH_DRIVER(fileName,mesh);
44       return ret;
45     }
46
47     case NO_DRIVER : {
48       throw MED_EXCEPTION ("NO_DRIVER has been specified to the method which is not allowed");
49     }
50     default:
51       throw MED_EXCEPTION ("other driver than MED_DRIVER GIBI_DRIVER PORFLOW_DRIVER and VT_DRIVER has been specified to the method which is not allowed");
52     }
53 }
54
55 GENDRIVER *DRIVERFACTORY::buildDriverForMed(driverTypes driverType, const std::string & fileName, MED *med)
56 {
57   GENDRIVER *ret;
58   switch(driverType)
59     {
60     case MED_DRIVER : {
61       ret=new MED_MED_RDWR_DRIVER(fileName,med);
62       break ;
63     }
64
65     case VTK_DRIVER : {
66       ret=new VTK_MED_DRIVER(fileName,med);
67       break ;
68     }
69
70     case GIBI_DRIVER : {
71       throw MED_EXCEPTION ("GIBI_DRIVER has been specified to the method which is not allowed because there is no GIBI driver for the MED object");
72       break;
73     }
74
75     case PORFLOW_DRIVER : {
76       throw MED_EXCEPTION ("PORFLOW_DRIVER has been specified to the method which is not allowed because there is no PORFLOW driver for the MED object");
77       break;
78     }
79
80     case NO_DRIVER : {
81       throw MED_EXCEPTION ("NO_DRIVER has been specified to the method which is not allowed");
82       break;
83     }
84     default:
85       throw MED_EXCEPTION ("NO_DRIVER has been specified to the method which is not allowed");
86     }
87   return ret;
88 }
89