Back to index

salome-med  6.5.0
Functions | Variables
MEDMEM::DRIVERFACTORY Namespace Reference

Functions

MEDMEM_EXPORT bool getVtkBinaryFormatForWriting ()
MEDMEM_EXPORT void setVtkBinaryFormatForWriting (bool isBinary)
MEDMEM_EXPORT driverTypes deduceDriverTypeFromFileName (const std::string &fileName)
MEDMEM_EXPORT GENDRIVER * buildDriverForMesh (driverTypes driverType, const std::string &fileName, GMESH *mesh, const string &driverName, MED_EN::med_mode_acces access)
template<class T , class INTERLACING_TAG >
GENDRIVER * buildDriverForField (driverTypes driverType, const std::string &fileName, FIELD< T, INTERLACING_TAG > *fielde, MED_EN::med_mode_acces access)
MEDMEM_EXPORT GENDRIVER * buildMeshDriverFromFile (const string &fileName, GMESH *ptrMesh, MED_EN::med_mode_acces access)
template<class T , class INTERLACING_TAG >
GENDRIVER * buildFieldDriverFromFile (const string &fileName, FIELD< T, INTERLACING_TAG > *ptrField, MED_EN::med_mode_acces access)
MEDMEM_EXPORT GENDRIVER * buildConcreteMedDriverForMesh (const std::string &fileName, GMESH *mesh, const string &driverName, MED_EN::med_mode_acces access, MED_EN::medFileVersion version)
template<class T , class INTERLACING_TAG >
GENDRIVER * buildConcreteMedDriverForField (const std::string &fileName, FIELD< T, INTERLACING_TAG > *fielde, MED_EN::med_mode_acces access, MED_EN::medFileVersion version)

Variables

MEDMEM_EXPORT bool globalVtkBinaryFormatForWriting = false

Function Documentation

template<class T , class INTERLACING_TAG >
GENDRIVER * MEDMEM::DRIVERFACTORY::buildConcreteMedDriverForField ( const std::string &  fileName,
FIELD< T, INTERLACING_TAG > *  fielde,
MED_EN::med_mode_acces  access,
MED_EN::medFileVersion  version 
)

Definition at line 186 of file MEDMEM_DriverFactory.ixx.

  {

    MESSAGE_MED("buildConcreteMedDriverForField version of the file " << version);

    if (version == MED_EN::V21)
      throw MED_EXCEPTION ("med-2.1 files are no more supported");

    GENDRIVER * driver=0;

    switch(access)
      {
      case MED_EN::RDONLY : {
        driver = new MED_FIELD_RDONLY_DRIVER<T>(fileName,ptrField);
        return driver;
      }
      case MED_EN::WRONLY : {
        driver = new MED_FIELD_WRONLY_DRIVER<T>(fileName,ptrField);
        return driver;
      }
      case MED_EN::RDWR : {
        driver = new MED_FIELD_RDWR_DRIVER<T>(fileName,ptrField);
        return driver;
      }
      default:
        throw MED_EXCEPTION ("access type has not been properly specified to the method");
      }
    return driver;
  }
GENDRIVER * MEDMEM::DRIVERFACTORY::buildConcreteMedDriverForMesh ( const std::string &  fileName,
GMESH *  mesh,
const string &  driverName,
MED_EN::med_mode_acces  access,
MED_EN::medFileVersion  version 
)

Definition at line 249 of file MEDMEM_DriverFactory.cxx.

{
  GENDRIVER * driver=0;

  MESSAGE_MED("buildConcreteMedDriverForMesh version of the file " << version);

  if (version == MED_EN::V21)
    throw MED_EXCEPTION ("med-2.1 files are no more supported");

  switch(access)
    {
    case RDONLY : {
      driver = new MED_MESH_RDONLY_DRIVER(fileName,ptrMesh);
      driver->setMeshName(driverName);
      return driver;
    }
    case WRONLY : {
      driver = new MED_MESH_WRONLY_DRIVER(fileName,ptrMesh);
      driver->setMeshName(driverName);
      return driver;
    }
    case RDWR : {
      driver = new MED_MESH_RDWR_DRIVER(fileName,ptrMesh);
      driver->setMeshName(driverName);
      return driver;
    }
    default:
      throw MED_EXCEPTION ("access type has not been properly specified to the method");
    }
  return driver;
}
template<class T , class INTERLACING_TAG >
GENDRIVER * MEDMEM::DRIVERFACTORY::buildDriverForField ( driverTypes  driverType,
const std::string &  fileName,
FIELD< T, INTERLACING_TAG > *  fielde,
MED_EN::med_mode_acces  access 
)

Definition at line 33 of file MEDMEM_DriverFactory.ixx.

  {
    GENDRIVER *ret;
    switch(driverType)
      {
      case MED_DRIVER : {
        switch(access)
          {
          case MED_EN::RDONLY : {
            ret = new MED_FIELD_RDONLY_DRIVER<T>(fileName,field);
            break;
          }
          case MED_EN::WRONLY : {
            ret= new MED_FIELD_WRONLY_DRIVER<T>(fileName,field);
            break;
          }
          case MED_EN::RDWR : {
            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 ENSIGHT_DRIVER : {
        switch(access)
          {
          case MED_EN::RDONLY : {
            ret = new ENSIGHT_FIELD_RDONLY_DRIVER(fileName,field);
            break;
          }
          case MED_EN::WRONLY : {
            ret=new ENSIGHT_FIELD_WRONLY_DRIVER(fileName,field);
            break;
          }
          case MED_EN::RDWR : {
            throw MED_EXCEPTION ("not yet implemented");
            break ;
          }
          default:
            throw MED_EXCEPTION ("access type has not been properly specified to the method");
          }
        break;
      }

      case VTK_DRIVER : {
        switch(access)
          {
          case MED_EN::RDONLY : {
            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::WRONLY : {
            ret=new VTK_FIELD_DRIVER<T>(fileName,field);
            break;
          }
          case MED_EN::RDWR : {
            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 : {
        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");
        break;
      }

      case PORFLOW_DRIVER : {
        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");
        break;
      }

      case ASCII_DRIVER : {
        switch(access)
          {
          case MED_EN::WRONLY : {
            ret=new ASCII_FIELD_DRIVER<T>(fileName,field);
            break;
          }
          default:
            throw MED_EXCEPTION ("driver ASCII_DRIVER on FIELD only in write mod");
          }
        break;
      }

      case NO_DRIVER : {
        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");
        break;
      }
      default:
        MED_EXCEPTION ("driverType other than MED_DRIVER and VTK_DRIVER has been specified to the method which is not allowed for the object FIELD");
      }
    return ret;
  }

Here is the caller graph for this function:

GENDRIVER * MEDMEM::DRIVERFACTORY::buildDriverForMesh ( driverTypes  driverType,
const std::string &  fileName,
GMESH *  mesh,
const string &  driverName,
MED_EN::med_mode_acces  access 
)

Definition at line 84 of file MEDMEM_DriverFactory.cxx.

{
  GENDRIVER *ret;
  switch(driverType)
    {
    case MED_DRIVER : {
      switch(access)
        {
        case RDONLY : {
          ret = new MED_MESH_RDONLY_DRIVER(fileName, mesh);
          ret->setMeshName(driverName);
          return ret;
        }
        case WRONLY : {
          ret = new MED_MESH_WRONLY_DRIVER(fileName, mesh, access);
          ret->setMeshName(driverName);
          return ret;
        }
        case RDWR : {
          ret = new MED_MESH_RDWR_DRIVER(fileName, mesh);
          ret->setMeshName(driverName);
          return ret;
        }
        default:
          throw MED_EXCEPTION ("access type has not been properly specified to the method");
        }
      break;
    }

    case GIBI_DRIVER : {
      if ( mesh->getIsAGrid() )
        throw MED_EXCEPTION("GIBI file can contain unstructured mesh only, not a GRID");
      switch(access)
        {
        case RDONLY : {
          ret=new GIBI_MESH_RDONLY_DRIVER(fileName,(MESH*)mesh);
          return ret;
        }
        case RDWR :
          ret=new GIBI_MESH_RDWR_DRIVER(fileName,(MESH*)mesh);
          return ret;
          
        case WRONLY :{
          ret=new GIBI_MESH_WRONLY_DRIVER(fileName,(MESH*)mesh);
          return ret;
        }
        default:
          throw MED_EXCEPTION ("access type has not been properly specified to the method");
        }
      break;
    }

    case PORFLOW_DRIVER : {
      if ( mesh->getIsAGrid() )
        throw MED_EXCEPTION("PORFLOW file can contain unstructured mesh only, not a GRID");
      switch(access)
        {
        case RDONLY : {
          ret=new PORFLOW_MESH_RDONLY_DRIVER(fileName,(MESH*)mesh);
          return ret;
        }
        case RDWR :
        case WRONLY : {
          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 ENSIGHT_DRIVER : {
      if ( mesh->getIsAGrid() )
        throw MED_EXCEPTION("EnSight driver reads unstructured mesh, not a GRID");
      switch(access)
        {
        case RDONLY : {
          ret=new ENSIGHT_MESH_RDONLY_DRIVER(fileName,(MESH*)mesh);
          return ret;
        }
        case WRONLY : {
          ret=new ENSIGHT_MESH_WRONLY_DRIVER(fileName,(MESH*)mesh);
          return ret;
        }
        case RDWR : {
          throw MED_EXCEPTION ("not yet implemented");
          return ret;
        }
        default:
          throw MED_EXCEPTION ("access type has not been properly specified to the method");
        }
      break;
    }

    case VTK_DRIVER : {
      switch(access)
        {
        case RDONLY : {
          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 RDWR :
        case WRONLY : {
          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 : {
      throw MED_EXCEPTION ("NO_DRIVER has been specified to the method 1 which is not allowed");
    }
    default:
      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");
    }
}
template<class T , class INTERLACING_TAG >
GENDRIVER * MEDMEM::DRIVERFACTORY::buildFieldDriverFromFile ( const string &  fileName,
FIELD< T, INTERLACING_TAG > *  ptrField,
MED_EN::med_mode_acces  access 
)

Definition at line 138 of file MEDMEM_DriverFactory.ixx.

  {
    MED_EN::medFileVersion version = MED_EN::V22;

    try
      {
        version = getMedFileVersion(fileName);
      }
    catch (MEDEXCEPTION & )
      {
      }

    MESSAGE_MED("buildFieldDriverFromFile version of the file " << version);

    GENDRIVER * driver=0;

    switch(access)
      {
      case MED_EN::RDONLY : {
        if (version == MED_EN::V21)
          throw MED_EXCEPTION ("med-2.1 files are no more supported");
        else if (version == MED_EN::V22)
          driver = new MED_FIELD_RDONLY_DRIVER<T>(fileName,ptrField);
        return driver;
      }
      case MED_EN::WRONLY : {
        if (version == MED_EN::V21)
          throw MED_EXCEPTION ("med-2.1 files are no more supported");
        else if (version == MED_EN::V22)
          driver = new MED_FIELD_WRONLY_DRIVER<T>(fileName,ptrField);
        return driver;
      }
      case MED_EN::RDWR : {
        if (version == MED_EN::V21)
          throw MED_EXCEPTION ("med-2.1 files are no more supported");
        else if (version == MED_EN::V22)
          driver = new MED_FIELD_RDWR_DRIVER<T>(fileName,ptrField);
        return driver;
      }
      default:
        throw MED_EXCEPTION ("access type has not been properly specified to the method");
      }
    return driver;
  }

Here is the call graph for this function:

GENDRIVER * MEDMEM::DRIVERFACTORY::buildMeshDriverFromFile ( const string &  fileName,
GMESH *  ptrMesh,
MED_EN::med_mode_acces  access 
)

Definition at line 208 of file MEDMEM_DriverFactory.cxx.

{
  medFileVersion version = MED_EN::V22;

  try
    {
      version = getMedFileVersion(fileName);
    }
  catch (MEDEXCEPTION & ex)
    {
    }

  MESSAGE_MED("buildMeshDriverFromFile version of the file " << version);

  if (version == MED_EN::V21)
    throw MED_EXCEPTION ("med-2.1 files are no more supported");

  GENDRIVER * driver=0;

  switch(access)
    {
    case RDONLY : {
      driver = new MED_MESH_RDONLY_DRIVER(fileName,ptrMesh);
      return driver;
    }
    case WRONLY : {
      driver = new MED_MESH_WRONLY_DRIVER(fileName,ptrMesh,access);
      return driver;
    }
    case RDWR : {
      driver = new MED_MESH_RDWR_DRIVER(fileName,ptrMesh);
      return driver;
    }
    default:
      throw MED_EXCEPTION ("access type has not been properly specified to the method");
    }
  return driver;
}

Here is the call graph for this function:

Definition at line 64 of file MEDMEM_DriverFactory.cxx.

{
  string extension(fileName);
  string::size_type pos=extension.rfind('.');
  if(pos==string::npos)
    return NO_DRIVER;
  extension.erase(0,pos+1);
  if(extension=="med")
    return MED_DRIVER;
  if(extension=="sauve" || extension=="sauv")
    return GIBI_DRIVER;
  if(extension=="cnc" || extension=="inp" || extension=="xyz")
    return PORFLOW_DRIVER;
  if(extension=="vtk")
    return VTK_DRIVER;
  if(extension=="case")
    return ENSIGHT_DRIVER;
  return NO_DRIVER;
}

Here is the caller graph for this function:

Definition at line 54 of file MEDMEM_DriverFactory.cxx.

Here is the caller graph for this function:

Definition at line 59 of file MEDMEM_DriverFactory.cxx.


Variable Documentation

Definition at line 52 of file MEDMEM_DriverFactory.cxx.