1 #ifndef DRIVERFACTORY_HXX
2 #define DRIVERFACTORY_HXX
4 #include "MEDMEM_GenDriver.hxx"
5 #include "MEDMEM_VtkFieldDriver.hxx"
6 #include "MEDMEM_MedFieldDriver.hxx"
12 template<class T> class FIELD;
15 namespace DRIVERFACTORY {
16 GENDRIVER *buildDriverForMesh(driverTypes driverType,
17 const std::string & fileName,
18 MESH *mesh,const string & driverName,
19 MED_EN::med_mode_acces access);
21 GENDRIVER *buildDriverForField(driverTypes driverType,
22 const std::string & fileName,
24 MED_EN::med_mode_acces access);
25 GENDRIVER *buildDriverForMed(driverTypes driverType,
26 const std::string & fileName,
28 MED_EN::med_mode_acces access);
32 GENDRIVER *DRIVERFACTORY::buildDriverForField(driverTypes driverType,
33 const std::string & fileName,
35 MED_EN::med_mode_acces access)
43 case MED_EN::MED_LECT : {
44 ret=new MED_FIELD_RDONLY_DRIVER<T>(fileName,field);
47 case MED_EN::MED_ECRI : {
48 ret=new MED_FIELD_WRONLY_DRIVER<T>(fileName,field);
51 case MED_EN::MED_REMP : {
52 ret=new MED_FIELD_RDWR_DRIVER<T>(fileName,field);
56 throw MED_EXCEPTION ("access type has not been properly specified to the method");
64 case MED_EN::MED_LECT : {
65 throw MED_EXCEPTION ("access mode other than MED_ECRI and MED_REMP has been specified with the VTK_DRIVER type which is not allowed because VTK_DRIVER is only a write access driver");
68 case MED_EN::MED_ECRI : {
69 ret=new VTK_FIELD_DRIVER<T>(fileName,field);
72 case MED_EN::MED_REMP : {
73 ret=new VTK_FIELD_DRIVER<T>(fileName,field);
77 throw MED_EXCEPTION ("access type has not been properly specified to the method");
83 throw MED_EXCEPTION ("driverType other than MED_DRIVER and VTK_DRIVER has been specified to the method which is not allowed for the object FIELD");
87 case PORFLOW_DRIVER : {
88 throw MED_EXCEPTION ("driverType other than MED_DRIVER and VTK_DRIVER has been specified to the method which is not allowed for the object FIELD");
93 throw MED_EXCEPTION ("driverType other than MED_DRIVER and VTK_DRIVER has been specified to the method which is not allowed for the object FIELD");
97 MED_EXCEPTION ("driverType other than MED_DRIVER and VTK_DRIVER has been specified to the method which is not allowed for the object FIELD");