Salome HOME
0022107: EDF 2502 SMESH: Publish the result of show bad mesh in a group
[modules/smesh.git] / src / SMESH_I / SMESH_Gen_i.cxx
index e01f4a48a52e5ba997bb0cdebd690b6259c245be..82428ef94a977277cb7c1fdfe646eedbac8e9078 100644 (file)
 #include <map>
 #include <fstream>
 #include <cstdio>
-#include <stdlib.h>
+#include <cstdlib>
 
 using namespace std;
 using SMESH::TPythonDump;
@@ -1441,7 +1441,6 @@ SMESH::compute_error_array* SMESH_Gen_i::GetComputeErrors( SMESH::SMESH_Mesh_ptr
   return error_array._retn();
 }
 
-//
 //================================================================================
 /*!
  * \brief Return mesh elements preventing computation of a subshape
@@ -1527,6 +1526,40 @@ SMESH_Gen_i::GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
   return result._retn();
 }
 
+//================================================================================
+/*!
+ * \brief Create a group of elements preventing computation of a sub-shape
+ */
+//================================================================================
+
+SMESH::ListOfGroups*
+SMESH_Gen_i::MakeGroupsOfBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
+                                           CORBA::Short          theSubShapeID,
+                                           const char*           theGroupName )
+  throw ( SALOME::SALOME_Exception )
+{
+  Unexpect aCatch(SALOME_SalomeException);
+
+  SMESH::ListOfGroups_var groups;
+
+  if ( CORBA::is_nil( theMesh ) )
+    THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference",SALOME::BAD_PARAM );
+
+  try {
+    if ( SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh ))
+    {
+      groups = meshServant->MakeGroupsOfBadInputElements( theSubShapeID, theGroupName );
+      TPythonDump() << groups << " = " << this
+                    << ".MakeGroupsOfBadInputElements( "
+                    << theMesh << ", " << theSubShapeID << ", '" << theGroupName << "' )";
+    }
+  }
+  catch ( SALOME_Exception& S_ex ) {
+    INFOS( "catch exception "<< S_ex.what() );
+  }
+  return groups._retn();
+}
+
 //================================================================================
 /*!
  * \brief Returns errors of hypotheses definintion