#ifdef WIN32
#include "stdafx.h"
#endif
#define MEDFILE "C:\\med.med"
#define ENSIGHTCASE "C:\\star.case"
#define ENSIGHTGEOM "C:\\star00000.geo"

#include<string>
#include<deque>
#include<vector>

#include "MEDMEM_Exception.hxx"
#include "MEDMEM_define.hxx"

#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_Family.hxx"
#include "MEDMEM_Support.hxx"
#include "MEDMEM_EnsightMedDriver.hxx"
#include "MEDMEM_EnsightMeshDriver.hxx"

#include <numeric>
#include <iostream>

using namespace std;
using namespace MED_EN;
using namespace MEDMEM_ENSIGHT;

int main(){

   const string& filenameIN = ENSIGHTCASE ;
   const string& filenameOUT = MEDFILE ;

   vector< FIELD_* > fields;
   vector< const GMESH* > meshes;
   
   // Read
    ENSIGHT_MED_RDONLY_DRIVER medDriver(filenameIN, fields);
    medDriver.open();
    medDriver.read();
    medDriver.close();

      // no fields but only meshes in the file
      MESH* mesh = 0;
      int meshIndex = 1;
      do
      {
        mesh = new MESH;
        meshes.push_back( mesh );
        ENSIGHT_MESH_RDONLY_DRIVER meshDriver( filenameIN, mesh, meshIndex++ );
        meshDriver.open();
        meshDriver.read();
        meshDriver.close();
      } while ( mesh->getNumberOfNodes() > 0 );
      meshes.back()->removeReference();
      meshes.pop_back();
    

return 0;
}

