Salome HOME
Fix to store groups of meshes also
[modules/smesh.git] / src / SMESH_I / SMESH_Gen_i.cxx
index e901455925c92869c121275528aa043c4b94720e..86186c093fe78e8028cd355d43e59c28d2a7a8f9 100644 (file)
@@ -5056,8 +5056,8 @@ Engines::ListOfData* SMESH_Gen_i::getModifiedData(CORBA::Long studyId)
 {
   Engines::ListOfData_var aResult = new Engines::ListOfData;
   
-  if (myImportStudyId == 0 || !myImportedStudyChanged) {
-    MESSAGE("Study is not changed")
+  if (!myImportedStudyChanged) {
+    INFOS("SMESH module data was not changed")
     return aResult._retn();
   }
 
@@ -5072,8 +5072,6 @@ Engines::ListOfData* SMESH_Gen_i::getModifiedData(CORBA::Long studyId)
 
   std::string aFullPath(Kernel_Utils::GetTmpFileName());
   aFullPath += ".med";
-  DriverMED_W_SMESHDS_Mesh aWriter;
-  aWriter.SetFile(aFullPath.c_str());
   StudyContext* myStudyContext = GetCurrentStudyContext();
 
   SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(aComponent); // check only published meshes
@@ -5086,24 +5084,17 @@ Engines::ListOfData* SMESH_Gen_i::getModifiedData(CORBA::Long studyId)
       if(!aCORBAMesh->_is_nil()) {
         SMESH_Mesh_i* myImpl = dynamic_cast<SMESH_Mesh_i*>(GetServant(aCORBAMesh).in());
         if (myImpl) {
-          CORBA::String_var objStr = GetORB()->object_to_string(anObj);
-          int id = myStudyContext->findId(string(objStr.in()));
-          SMESHDS_Mesh* mySMESHDSMesh = myImpl->GetImpl().GetMeshDS();
-          if (mySMESHDSMesh->NbNodes() > 0) {
-            // write mesh data to med file
-            aWriter.SetMesh(mySMESHDSMesh);
-            aWriter.SetMeshId(id);
-            aNumMeshes++;
-          } else {
-            MESSAGE("Mesh has zero nodes and can not be exported");
-          }
+          myImpl->Load();
+          SMESH_Mesh& aMesh = myImpl->GetImpl();
+          CORBA::String_var objName = aSO->GetName();
+          aMesh.ExportMED(aFullPath.c_str(), objName.in(), false, MED::eV2_2, 0);
+          aNumMeshes++;
         }
       }
     }
   }
-  if (aNumMeshes > 0) { // compund is correct, write it to the temporary file
-    MESSAGE("Write "<<aNumMeshes<<" meshes to "<<aFullPath.c_str());
-    aWriter.Perform();
+  if (aNumMeshes > 0) { // prepare a container to store files
+    INFOS("Write "<<aNumMeshes<<" meshes to "<<aFullPath.c_str());
     aResult->length(1);
     Engines::DataContainer_var aData = (new Engines_DataContainer_i(
                     aFullPath.c_str(), "", "", true))->_this();