//#include "utilities.h"
using namespace MEDMEM;
+using namespace MED_EN;
-GENDRIVER *DRIVERFACTORY::buildDriverForMesh(driverTypes driverType, const std::string & fileName, MESH *mesh,const string & driverName)
+GENDRIVER *DRIVERFACTORY::buildDriverForMesh(driverTypes driverType,
+ const std::string & fileName,
+ MESH *mesh,
+ const string & driverName,
+ med_mode_acces access)
{
GENDRIVER *ret;
switch(driverType)
{
case MED_DRIVER : {
- MED_MESH_RDWR_DRIVER *retmed=new MED_MESH_RDWR_DRIVER(fileName,mesh);
- retmed->setMeshName(driverName);
- return retmed;
+ switch(access)
+ {
+ case MED_LECT : {
+ MED_MESH_RDONLY_DRIVER *retmed=new MED_MESH_RDONLY_DRIVER(fileName,
+ mesh);
+ retmed->setMeshName(driverName);
+ return retmed;
+ }
+ case MED_ECRI : {
+ MED_MESH_WRONLY_DRIVER *retmed=new MED_MESH_WRONLY_DRIVER(fileName,
+ mesh);
+ retmed->setMeshName(driverName);
+ return retmed;
+ }
+ case MED_REMP : {
+ MED_MESH_RDWR_DRIVER *retmed=new MED_MESH_RDWR_DRIVER(fileName,mesh);
+ retmed->setMeshName(driverName);
+ return retmed;
+ }
+ default:
+ throw MED_EXCEPTION ("access type has not been properly specified to the method");
+ }
+ break;
}
case GIBI_DRIVER : {
- ret=new GIBI_MESH_RDWR_DRIVER(fileName,mesh);
- return ret;
+ switch(access)
+ {
+ case MED_LECT : {
+ ret=new GIBI_MESH_RDONLY_DRIVER(fileName,mesh);
+ return ret;
+ }
+ case MED_ECRI : {
+ 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");
+ }
+ case MED_REMP : {
+ 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");
+ }
+ default:
+ throw MED_EXCEPTION ("access type has not been properly specified to the method");
+ }
+ break;
}
case PORFLOW_DRIVER : {
- ret=new PORFLOW_MESH_RDWR_DRIVER(fileName,mesh);
- return ret;
+ switch(access)
+ {
+ case MED_LECT : {
+ ret=new PORFLOW_MESH_RDONLY_DRIVER(fileName,mesh);
+ return ret;
+ }
+ case MED_ECRI : {
+ 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");
+ }
+ case MED_REMP : {
+ 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");
+ }
+ default:
+ throw MED_EXCEPTION ("access type has not been properly specified to the method");
+ }
+ break;
}
case VTK_DRIVER : {
- ret=new VTK_MESH_DRIVER(fileName,mesh);
- return ret;
+ switch(access)
+ {
+ case MED_LECT : {
+ 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");
+ }
+ case MED_ECRI : {
+ ret=new VTK_MESH_DRIVER(fileName,mesh);
+ return ret;
+ }
+ case MED_REMP : {
+ ret=new VTK_MESH_DRIVER(fileName,mesh);
+ return ret;
+ }
+ default:
+ throw MED_EXCEPTION ("access type has not been properly specified to the method");
+ }
+ break;
}
case NO_DRIVER : {
}
}
-GENDRIVER *DRIVERFACTORY::buildDriverForMed(driverTypes driverType, const std::string & fileName, MED *med)
+GENDRIVER *DRIVERFACTORY::buildDriverForMed(driverTypes driverType,
+ const std::string & fileName,
+ MED *med, med_mode_acces access)
{
GENDRIVER *ret;
+
switch(driverType)
{
case MED_DRIVER : {
- ret=new MED_MED_RDWR_DRIVER(fileName,med);
- break ;
+ switch(access)
+ {
+ case MED_LECT : {
+ ret=new MED_MED_RDONLY_DRIVER(fileName,med);
+ break ;
+ }
+ case MED_ECRI : {
+ ret=new MED_MED_WRONLY_DRIVER(fileName,med);
+ break ;
+ }
+ case MED_REMP : {
+ ret=new MED_MED_RDONLY_DRIVER(fileName,med);
+ break ;
+ }
+ default:
+ throw MED_EXCEPTION ("access type has not been properly specified to the method");
+ }
+ break;
}
case VTK_DRIVER : {
- ret=new VTK_MED_DRIVER(fileName,med);
- break ;
+ switch(access)
+ {
+ case MED_LECT : {
+ 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");
+ }
+ case MED_ECRI : {
+ ret=new VTK_MED_DRIVER(fileName,med);
+ break ;
+ }
+ case MED_REMP : {
+ ret=new VTK_MED_DRIVER(fileName,med);
+ break ;
+ }
+ default:
+ throw MED_EXCEPTION ("access type has not been properly specified to the method");
+ }
+ break;
}
case GIBI_DRIVER : {
class MED;
namespace DRIVERFACTORY {
- GENDRIVER *buildDriverForMesh(driverTypes driverType, const std::string & fileName, MESH *mesh,const string & driverName);
+ GENDRIVER *buildDriverForMesh(driverTypes driverType,
+ const std::string & fileName,
+ MESH *mesh,const string & driverName,
+ MED_EN::med_mode_acces access);
template<class T>
- GENDRIVER *buildDriverForField(driverTypes driverType, const std::string & fileName, FIELD<T> *field);
- GENDRIVER *buildDriverForMed(driverTypes driverType, const std::string & fileName, MED *med);
+ GENDRIVER *buildDriverForField(driverTypes driverType,
+ const std::string & fileName,
+ FIELD<T> *fielde,
+ MED_EN::med_mode_acces access);
+ GENDRIVER *buildDriverForMed(driverTypes driverType,
+ const std::string & fileName,
+ MED *mede,
+ MED_EN::med_mode_acces access);
}
template<class T>
-GENDRIVER *DRIVERFACTORY::buildDriverForField(driverTypes driverType, const std::string & fileName, FIELD<T> *field)
+GENDRIVER *DRIVERFACTORY::buildDriverForField(driverTypes driverType,
+ const std::string & fileName,
+ FIELD<T> *field,
+ MED_EN::med_mode_acces access)
{
GENDRIVER *ret;
switch(driverType)
{
case MED_DRIVER : {
- ret=new MED_FIELD_RDWR_DRIVER<T>(fileName,field);
+ switch(access)
+ {
+ case MED_EN::MED_LECT : {
+ ret=new MED_FIELD_RDONLY_DRIVER<T>(fileName,field);
+ break;
+ }
+ case MED_EN::MED_ECRI : {
+ ret=new MED_FIELD_WRONLY_DRIVER<T>(fileName,field);
+ break;
+ }
+ case MED_EN::MED_REMP : {
+ ret=new MED_FIELD_RDWR_DRIVER<T>(fileName,field);
+ break;
+ }
+ default:
+ throw MED_EXCEPTION ("access type has not been properly specified to the method");
+ }
break;
}
case VTK_DRIVER : {
- ret=new VTK_FIELD_DRIVER<T>(fileName,field);
- break ;
+ switch(access)
+ {
+ case MED_EN::MED_LECT : {
+ 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");
+ break;
+ }
+ case MED_EN::MED_ECRI : {
+ ret=new VTK_FIELD_DRIVER<T>(fileName,field);
+ break;
+ }
+ case MED_EN::MED_REMP : {
+ ret=new VTK_FIELD_DRIVER<T>(fileName,field);
+ break ;
+ }
+ default:
+ throw MED_EXCEPTION ("access type has not been properly specified to the method");
+ }
+ break;
}
case GIBI_DRIVER : {
};
int FIELD_::addDriver (driverTypes driverType,
const string & fileName,
- const string & driverFieldName)
+ const string & driverFieldName,
+ med_mode_acces access)
{
MESSAGE("int FIELD_::addDriver(driverTypes driverType, const string & fileName, const string & driverFieldName) : adding the driver " << driverType << " fileName = " << fileName.c_str() << " driverFieldName = " << driverFieldName.c_str());
return 0;
virtual void rmDriver(int index);
virtual int addDriver(driverTypes driverType,
const string & fileName="Default File Name.med",
- const string & driverFieldName="Default Field Nam") ;
+ const string & driverFieldName="Default Field Nam",
+ MED_EN::med_mode_acces access=MED_EN::MED_REMP) ;
+
virtual int addDriver( GENDRIVER & driver);
virtual void read (const GENDRIVER &);
virtual void read(int index=0);
void rmDriver(int index=0);
int addDriver(driverTypes driverType,
const string & fileName="Default File Name.med",
- const string & driverFieldName="Default Field Name") ;
+ const string & driverFieldName="Default Field Name",
+ MED_EN::med_mode_acces access=MED_EN::MED_REMP) ;
+
int addDriver(GENDRIVER & driver);
void allocValue(const int NumberOfComponents);
_time = 0.0;
_orderNumber = orderNumber;
- switch(driverType)
- {
- case MED_DRIVER :
- {
- MED_FIELD_RDONLY_DRIVER<T> myDriver(fileName,this);
- myDriver.setFieldName(fieldDriverName);
- current = addDriver(myDriver);
- break;
- }
+ current = addDriver(driverType,fileName,fieldDriverName,MED_LECT);
+
+// switch(driverType)
+// {
+// case MED_DRIVER :
+// {
+// MED_FIELD_RDONLY_DRIVER<T> myDriver(fileName,this);
+// myDriver.setFieldName(fieldDriverName);
+// current = addDriver(myDriver);
+// break;
+// }
// current = addDriver(driverType,fileName,fieldDriverName);
// switch(_drivers[current]->getAccessMode() ) {
// case MED_WRONLY : {
// default : {
// }
// }
- default :
- {
- throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"Driver type unknown : can't create driver!"));
- break;
- }
- }
+// default :
+// {
+// throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"Driver type unknown : can't create driver!"));
+// break;
+// }
+// }
_drivers[current]->open();
_drivers[current]->read();
template <class T> int FIELD<T>::addDriver(driverTypes driverType,
const string & fileName/*="Default File Name.med"*/,
- const string & driverName/*="Default Field Name"*/)
+ const string & driverName/*="Default Field Name"*/,
+ MED_EN::med_mode_acces access)
{
- const char * LOC = "FIELD<T>::addDriver(driverTypes driverType, const string & fileName=\"Default File Name.med\",const string & driverName=\"Default Field Name\") : ";
+ const char * LOC = "FIELD<T>::addDriver(driverTypes driverType, const string & fileName=\"Default File Name.med\",const string & driverName=\"Default Field Name\,MED_EN::med_mode_acces access) : ";
GENDRIVER * driver;
SCRUTE(driverType);
- driver = DRIVERFACTORY::buildDriverForField(driverType,fileName,this);
+ driver = DRIVERFACTORY::buildDriverForField(driverType,fileName,this,access);
_drivers.push_back(driver);
MESSAGE(LOC << "driverType = " << driverType);
- int current = addDriver(driverType,fileName);
+ int current = addDriver(driverType,fileName,MED_LECT);
_drivers[current]->open();
_drivers[current]->readFileStruct();
Create the specified driver and return its index reference to path to
read or write methods.
*/
-int MED::addDriver(driverTypes driverType, const string & fileName="Default File Name.med") {
+int MED::addDriver(driverTypes driverType,
+ const string & fileName="Default File Name.med",
+ MED_EN::med_mode_acces access) {
const char * LOC = "MED::addDriver(driverTypes driverType, const string & fileName=\"Default File Name.med\") : ";
MESSAGE(LOC << " the file name is " << fileName);
SCRUTE(driverType);
+ SCRUTE(access);
- GENDRIVER *driver = DRIVERFACTORY::buildDriverForMed(driverType,fileName,this);
+ GENDRIVER *driver = DRIVERFACTORY::buildDriverForMed(driverType,fileName,
+ this,access);
_drivers.push_back(driver);
void addField ( FIELD_ * const ptrField ) throw (MED_EXCEPTION) ;
void addMesh ( MESH * const ptrMesh ) throw (MED_EXCEPTION) ;
- int addDriver (driverTypes driverType, const string & fileName);
+ int addDriver (driverTypes driverType,
+ const string & fileName,
+ MED_EN::med_mode_acces access=MED_EN::MED_REMP);
int addDriver (GENDRIVER & driver);
void rmDriver (int index=0) throw (MEDEXCEPTION) ;
Constructor.
*/
MED_FIELD_RDONLY_DRIVER(const string & fileName, FIELD<T> * ptrField):
- MED_FIELD_DRIVER<T>(fileName,ptrField,MED_RDONLY) {
+ MED_FIELD_DRIVER<T>(fileName,ptrField,MED_EN::MED_RDONLY) {
BEGIN_OF("MED_FIELD_RDONLY_DRIVER::MED_FIELD_RDONLY_DRIVER(const string & fileName, const FIELD<T> * ptrField)");
END_OF("MED_FIELD_RDONLY_DRIVER::MED_FIELD_RDONLY_DRIVER(const string & fileName, const FIELD<T> * ptrField)");
}
Constructor.
*/
MED_FIELD_WRONLY_DRIVER(const string & fileName, FIELD<T> * ptrField):
- MED_FIELD_DRIVER<T>(fileName,ptrField,MED_WRONLY)
+ MED_FIELD_DRIVER<T>(fileName,ptrField,MED_EN::MED_WRONLY)
{
BEGIN_OF("MED_FIELD_WRONLY_DRIVER::MED_FIELD_WRONLY_DRIVER(const string & fileName, const FIELD<T> * ptrField)");
END_OF("MED_FIELD_WRONLY_DRIVER::MED_FIELD_WRONLY_DRIVER(const string & fileName, const FIELD<T> * ptrField)");
/*! Add a %MESH driver of type %driverTypes (MED_DRIVER, ....) associated with file fileName. The meshname used in the file
is driverName. addDriver returns an integer handler. */
int MESH::addDriver(driverTypes driverType,
- const string & fileName/*="Default File Name.med"*/,const string & driverName/*="Default Mesh Name"*/) {
+ const string & fileName/*="Default File Name.med"*/,
+ const string & driverName/*="Default Mesh Name"*/,
+ med_mode_acces access) {
- const char * LOC = "MESH::addDriver(driverTypes driverType, const string & fileName=\"Default File Name.med\",const string & driverName=\"Default Mesh Name\") : ";
+ const char * LOC = "MESH::addDriver(driverTypes driverType, const string & fileName=\"Default File Name.med\",const string & driverName=\"Default Mesh Name\",MED_EN::med_mode_acces access) : ";
GENDRIVER * driver;
SCRUTE(driverType);
- driver = DRIVERFACTORY::buildDriverForMesh(driverType,fileName,this,driverName) ;
+ driver = DRIVERFACTORY::buildDriverForMesh(driverType,fileName,this,
+ driverName,access) ;
_drivers.push_back(driver);
BEGIN_OF(LOC);
init();
- GENDRIVER *myDriver=DRIVERFACTORY::buildDriverForMesh(driverType,fileName,this,driverName);
+ GENDRIVER *myDriver=DRIVERFACTORY::buildDriverForMesh(driverType,fileName,this,driverName,MED_LECT);
current = addDriver(*myDriver);
delete myDriver;
_drivers[current]->open();
int addDriver(driverTypes driverType,
const string & fileName ="Default File Name.med",
- const string & driverName="Default Mesh Name");
+ const string & driverName="Default Mesh Name",
+ MED_EN::med_mode_acces access=MED_EN::MED_REMP);
int addDriver(GENDRIVER & driver);
void rmDriver(int index=0);
%extend {
int addDriver(driverTypes driverType,
char * fileName="Default File Name.med",
- char * driverName="Default Field Name")
+ char * driverName="Default Field Name",
+ med_mode_acces access=MED_REMP)
{
return self->addDriver(driverType,string(fileName),
- string(driverName));
+ string(driverName),access);
}
}
int addDriver(driverTypes driverType,
char * fileName="Default File Name.med",
- char * driverName="Default Mesh Name")
+ char * driverName="Default Mesh Name",
+ med_mode_acces access=MED_REMP)
{
return self->addDriver(driverType,string(fileName),
- string(driverName));
+ string(driverName),access);
}
void write(int index=0, char * driverName="")
}
int addDriver(driverTypes driverType,
- char * fileName="Default File Name.med")
+ char * fileName="Default File Name.med",
+ med_mode_acces access=MED_REMP)
{
- return self->addDriver(driverType,string(fileName));
+ return self->addDriver(driverType,string(fileName),access);
}
%newobject getMeshName(int );