Salome HOME
updating or adding when merging in the main trunk with the version in the
[modules/smesh.git] / src / SMESH_I / SMESH_Gen_i.cxx
index b6cc5826573ccf86949bd3ef5fbed5fc63e0fb5c..d9c404cd93a4b90b4425cbecf6cb4fc7b82a0e42 100644 (file)
@@ -26,7 +26,6 @@
 //  Module : SMESH
 //  $Header$
 
-using namespace std;
 using namespace std;
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
@@ -54,6 +53,7 @@ using namespace std;
 #include "SMESH_LocalLength_i.hxx"
 #include "SMESH_NumberOfSegments_i.hxx"
 #include "SMESH_MaxElementArea_i.hxx"
+#include "SMESH_MaxElementVolume_i.hxx"
 
 #include "SMESHDS_Document.hxx"
 
@@ -466,7 +466,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
 //************branch 1 : hypothesis
     if (gotBranch->Tag()==Tag_HypothesisRoot) { //hypothesis = tag 1
 
-      double length,maxElementsArea;
+      double length,maxElementsArea,maxElementsVolume;
       int numberOfSegments;
 
       destFile = fopen( hypofile.ToCString() ,"w");
@@ -496,6 +496,11 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
             maxElementsArea = MEA->GetMaxElementArea();
             fprintf(destFile,"%f\n",maxElementsArea);
           }
+          else if (strcmp(myHyp->GetName(),"MaxElementVolume")==0) {
+            SMESH::SMESH_MaxElementVolume_var MEV = SMESH::SMESH_MaxElementVolume::_narrow( myHyp );
+            maxElementsVolume = MEV->GetMaxElementVolume();
+            fprintf(destFile,"%f\n",maxElementsVolume);
+          }
         }
       }
       fclose(destFile);
@@ -572,7 +577,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
        int meshId = myMesh->GetId();
        SMESH_Mesh_i* meshServant = myStudyContext->mapMesh_i[meshId];
        ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
-       Handle(SMESHDS_Mesh) mySMESHDSMesh = myLocMesh.GetMeshDS();
+       SMESHDS_Mesh* mySMESHDSMesh = myLocMesh.GetMeshDS();
        
        SCRUTE(mySMESHDSMesh->NbNodes());
        if (mySMESHDSMesh->NbNodes()>0) {//checks if the mesh is not empty
@@ -903,7 +908,7 @@ bool SMESH_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
   _NS->init_orb( _orb ) ;
   SALOME_LifeCycleCORBA* myEnginesLifeCycle = new SALOME_LifeCycleCORBA(_NS);
   Engines::Component_var geomEngine =
-    myEnginesLifeCycle->FindOrLoad_Component("FactoryServer","Geometry");
+    myEnginesLifeCycle->FindOrLoad_Component("FactoryServer","GEOM");
   GEOM::GEOM_Gen_var myGeomEngine = GEOM::GEOM_Gen::_narrow(geomEngine);
 
 
@@ -946,7 +951,7 @@ bool SMESH_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
 //***************
       if (strcmp(name,"Hypothesis")==0) {
         
-        double length,maxElementsArea;
+        double length,maxElementsArea,maxElementsVolume;
         int numberOfSegments;
 
         hdf_group[Tag_HypothesisRoot] = new HDFgroup(name,hdf_file); 
@@ -1001,6 +1006,16 @@ bool SMESH_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
             sprintf(objectId,"%d",MEA->GetId());
             _SMESHCorbaObj[string("Hypo_")+string(objectId)] = iorString;
           }
+          else if (strcmp(aLine,"MaxElementVolume")==0) {
+            SMESH::SMESH_Hypothesis_var myHyp  = this->CreateHypothesis(aLine,studyId);
+            SMESH::SMESH_MaxElementVolume_var MEV = SMESH::SMESH_MaxElementVolume::_narrow( myHyp );
+            fscanf(loadedFile,"%s",aLine);
+            maxElementsVolume = atof(aLine);
+            MEV->SetMaxElementVolume(maxElementsVolume);
+            string iorString = _orb->object_to_string(MEV);
+            sprintf(objectId,"%d",MEV->GetId());
+            _SMESHCorbaObj[string("Hypo_")+string(objectId)] = iorString;
+          }
           
 
         }
@@ -1137,7 +1152,7 @@ bool SMESH_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
              int meshId = myNewMesh->GetId();
              SMESH_Mesh_i* meshServant = myStudyContext->mapMesh_i[meshId];
              ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
-             Handle(SMESHDS_Mesh) mySMESHDSMesh = myLocMesh.GetMeshDS();
+             SMESHDS_Mesh* mySMESHDSMesh = myLocMesh.GetMeshDS();
                    
              DriverMED_R_SMESHDS_Mesh* myReader = new DriverMED_R_SMESHDS_Mesh;