1 #include "MEDMEM_DriverFactory.hxx"
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"
9 #include "MEDMEM_Med.hxx"
10 #include "MEDMEM_MedMedDriver.hxx"
11 #include "MEDMEM_VtkMedDriver.hxx"
13 //#include "MEDMEM_Field.hxx"
15 #include "MEDMEM_Exception.hxx"
16 //#include "MEDMEM_STRING.hxx"
17 //#include "utilities.h"
19 using namespace MEDMEM;
20 using namespace MED_EN;
22 GENDRIVER *DRIVERFACTORY::buildDriverForMesh(driverTypes driverType,
23 const std::string & fileName,
25 const string & driverName,
26 med_mode_acces access)
35 MED_MESH_RDONLY_DRIVER *retmed=new MED_MESH_RDONLY_DRIVER(fileName,
37 retmed->setMeshName(driverName);
41 MED_MESH_WRONLY_DRIVER *retmed=new MED_MESH_WRONLY_DRIVER(fileName,
43 retmed->setMeshName(driverName);
47 MED_MESH_RDWR_DRIVER *retmed=new MED_MESH_RDWR_DRIVER(fileName,mesh);
48 retmed->setMeshName(driverName);
52 throw MED_EXCEPTION ("access type has not been properly specified to the method");
61 ret=new GIBI_MESH_RDONLY_DRIVER(fileName,mesh);
65 throw MED_EXCEPTION ("access mode other than MED_LECT has been specified with the GIBI_DRIVER type which is not allowed because GIBI_DRIVER is only a read access driver");
68 throw MED_EXCEPTION ("access mode other than MED_LECT has been specified with the GIBI_DRIVER type which is not allowed because GIBI_DRIVER is only a read access driver");
71 throw MED_EXCEPTION ("access type has not been properly specified to the method");
76 case PORFLOW_DRIVER : {
80 ret=new PORFLOW_MESH_RDONLY_DRIVER(fileName,mesh);
84 throw MED_EXCEPTION ("access mode other than MED_LECT has been specified with the PORFLOW_DRIVER type which is not allowed because PORFLOW_DRIVER is only a read access driver");
87 throw MED_EXCEPTION ("access mode other than MED_LECT has been specified with the PORFLOW_DRIVER type which is not allowed because PORFLOW_DRIVER is only a read access driver");
90 throw MED_EXCEPTION ("access type has not been properly specified to the method");
99 throw MED_EXCEPTION ("access mode other than MED_ECRI or MED_REMPT has been specified with the VTK_DRIVER type which is not allowed because VTK_DRIVER is only a write access driver");
102 ret=new VTK_MESH_DRIVER(fileName,mesh);
106 ret=new VTK_MESH_DRIVER(fileName,mesh);
110 throw MED_EXCEPTION ("access type has not been properly specified to the method");
116 throw MED_EXCEPTION ("NO_DRIVER has been specified to the method which is not allowed");
119 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");
123 GENDRIVER *DRIVERFACTORY::buildDriverForMed(driverTypes driverType,
124 const std::string & fileName,
125 MED *med, med_mode_acces access)
135 ret=new MED_MED_RDONLY_DRIVER(fileName,med);
139 ret=new MED_MED_WRONLY_DRIVER(fileName,med);
143 ret=new MED_MED_RDONLY_DRIVER(fileName,med);
147 throw MED_EXCEPTION ("access type has not been properly specified to the method");
156 throw MED_EXCEPTION ("access mode other than MED_ECRI or MED_REMPT has been specified with the VTK_DRIVER type which is not allowed because VTK_DRIVER is only a write access driver");
159 ret=new VTK_MED_DRIVER(fileName,med);
163 ret=new VTK_MED_DRIVER(fileName,med);
167 throw MED_EXCEPTION ("access type has not been properly specified to the method");
173 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");
177 case PORFLOW_DRIVER : {
178 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");
183 throw MED_EXCEPTION ("NO_DRIVER has been specified to the method which is not allowed");
187 throw MED_EXCEPTION ("NO_DRIVER has been specified to the method which is not allowed");