2 #include "DriverMED_R_SMESHDS_Document.h"
3 #include "DriverMED_R_SMESHDS_Mesh.h"
7 Document_Reader* maker() {
8 return new DriverMED_R_SMESHDS_Document;
12 DriverMED_R_SMESHDS_Document::DriverMED_R_SMESHDS_Document() {
16 DriverMED_R_SMESHDS_Document::~DriverMED_R_SMESHDS_Document() {
20 //void DriverMED_R_SMESHDS_Document::SetFile(string aFile) {
24 void DriverMED_R_SMESHDS_Document::Read() {
30 Standard_Integer myMeshId;
32 //string myFile = string("/home/home_users/cai/projects/salome_prev04/SALOME_ROOT/data/fra1.med");
34 /****************************************************************************
35 * OUVERTURE DU FICHIER EN LECTURE *
36 ****************************************************************************/
37 char* file2Read = (char*)myFile.c_str();
38 fid = MEDouvrir(file2Read,MED_LECT);
41 fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read);
45 /****************************************************************************
46 * COMBIEN DE MAILLAGES ? *
47 ****************************************************************************/
51 fprintf(stderr,">> ERREUR : lecture du nombre de maillages \n");
54 printf("Nombre de maillages = %d\n",nmaa);
56 string myClass = string("SMESHDS_Mesh");
57 string myExtension = string("MED");
60 for (int meshIt=1;meshIt<=nmaa;meshIt++) {
61 myMeshId = myDocument->NewMesh();
62 printf("MeshId = %d\n",myMeshId);
64 Handle(SMDS_Mesh) myMesh = myDocument->GetMesh(myMeshId);
67 // Handle (SMDS_Mesh) MMM =.........
68 //ex Handle(SMESHDS_Mesh) myMesh2 =Handle(SMESHDS_Mesh)::DownCast(MMM);
70 DriverMED_R_SMESHDS_Mesh* myReader = new DriverMED_R_SMESHDS_Mesh;
72 myReader->SetMesh(myMesh);
73 myReader->SetMeshId(myMeshId);
75 //myReader->SetFile(myFile);
77 myReader->SetFileId(fid);
83 /****************************************************************************
84 * FERMETURE DU FICHIER *
85 ****************************************************************************/
89 fprintf(stderr,">> ERREUR : erreur a la fermeture du fichier %s\n",file2Read);