]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Implement Cancel Compute (begin)
authoradam <adam>
Thu, 17 Mar 2011 08:40:57 +0000 (08:40 +0000)
committeradam <adam>
Thu, 17 Mar 2011 08:40:57 +0000 (08:40 +0000)
idl/SMESH_Gen.idl
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i.hxx

index eec7b76237109c0cfe0f12dbe0583ed316943480..06f31944564f9848dc1b40475666575f9b4fe21b 100644 (file)
@@ -269,6 +269,12 @@ module SMESH
                      in GEOM::GEOM_Object theSubObject )
       raises ( SALOME::SALOME_Exception );
 
+    /*!
+     * Cancel a computation.
+     */
+    void CancelCompute( in SMESH_Mesh        theMesh,
+                       in GEOM::GEOM_Object theSubObject );
+
     /*!
      * Return true if hypotheses are defined well
      */
index 1494d200d9e364feaefa806635330e80b43c2010..0840d7b109ab658c5b7c405bc4a0688b7e15c2fa 100644 (file)
@@ -1433,6 +1433,9 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
         myLocShape = SMESH_Mesh::PseudoShape();
       // call implementation compute
       ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+      myGen.PrepareCompute( myLocMesh, myLocShape);
+#endif
       bool ok = myGen.Compute( myLocMesh, myLocShape);
       meshServant->CreateGroupServants(); // algos can create groups (issue 0020918)
       myLocMesh.GetMeshDS()->Modified();
@@ -1451,6 +1454,29 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
   return false;
 }
 
+//=============================================================================
+/*!
+ *  SMESH_Gen_i::CancelCompute
+ *
+ *  Cancel Compute mesh on a shape
+ */
+//=============================================================================
+
+void SMESH_Gen_i::CancelCompute( SMESH::SMESH_Mesh_ptr theMesh,
+                                 GEOM::GEOM_Object_ptr theShapeObject )
+{
+#ifdef WITH_SMESH_CANCEL_COMPUTE
+  SMESH_Mesh_i* meshServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( theMesh ).in() );
+  ::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
+  TopoDS_Shape myLocShape;
+  if(theMesh->HasShapeToMesh())
+    myLocShape = GeomObjectToShape( theShapeObject );
+  else
+    myLocShape = SMESH_Mesh::PseudoShape();
+  myGen.CancelCompute( myLocMesh, myLocShape);
+#endif
+}
+
 //=============================================================================
 /*!
  *  SMESH_Gen_i::Precompute
index f3b0354ad99651c71095a4f317b3f32379c6f4d0..dbe358b5e9f3a3bebe22dd804732c9a63818e059 100644 (file)
@@ -245,6 +245,11 @@ public:
   CORBA::Boolean Compute( SMESH::SMESH_Mesh_ptr theMesh,
                           GEOM::GEOM_Object_ptr theShapeObject )
     throw ( SALOME::SALOME_Exception );
+
+  // Cancel Compute mesh on a shape
+  void CancelCompute( SMESH::SMESH_Mesh_ptr theMesh,
+                      GEOM::GEOM_Object_ptr theShapeObject );
+
   /*!
    * \brief Return errors of mesh computation
    */