Salome HOME
Merge from V5_1_3_BR branch (07/12/09)
[modules/smesh.git] / src / SMESH_I / SMESH_MeshEditor_i.cxx
index f4e1d4420f4826a251f782476403eaa46240a8db..000bc95e84c79b38ceecd757025d65c5e847562e 100644 (file)
@@ -2568,6 +2568,7 @@ ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr  Object,
                 << ( HasRefPoint ? RefPoint.x : 0 ) << ", "
                 << ( HasRefPoint ? RefPoint.y : 0 ) << ", "
                 << ( HasRefPoint ? RefPoint.z : 0 ) << " ), "
+                << MakeGroups << ", "
                 << ElemType << " )";
   }
   return aGroups;
@@ -4213,6 +4214,142 @@ void SMESH_MeshEditor_i::DumpGroupsList(TPythonDump &               theDumpPytho
   }
 }
 
+//================================================================================
+/*!
+  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+  \param theNodes - identifiers of nodes to be doubled
+  \param theModifiedElems - identifiers of elements to be updated by the new (doubled) 
+         nodes. If list of element identifiers is empty then nodes are doubled but 
+         they not assigned to elements
+  \return TRUE if operation has been completed successfully, FALSE otherwise
+  \sa DoubleNode(), DoubleNodeGroup(), DoubleNodeGroups()
+*/
+//================================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theNodes, 
+                                                const SMESH::long_array& theModifiedElems )
+{
+  initData();
+
+  ::SMESH_MeshEditor aMeshEditor( myMesh );
+  list< int > aListOfNodes;
+  int i, n;
+  for ( i = 0, n = theNodes.length(); i < n; i++ )
+    aListOfNodes.push_back( theNodes[ i ] );
+
+  list< int > aListOfElems;
+  for ( i = 0, n = theModifiedElems.length(); i < n; i++ )
+    aListOfElems.push_back( theModifiedElems[ i ] );
+
+  bool aResult = aMeshEditor.DoubleNodes( aListOfNodes, aListOfElems );
+
+  storeResult( aMeshEditor) ;
+
+  return aResult;
+}
+
+//================================================================================
+/*!
+  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+  This method provided for convenience works as DoubleNodes() described above.
+  \param theNodeId - identifier of node to be doubled.
+  \param theModifiedElems - identifiers of elements to be updated.
+  \return TRUE if operation has been completed successfully, FALSE otherwise
+  \sa DoubleNodes(), DoubleNodeGroup(), DoubleNodeGroups()
+*/
+//================================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNode( CORBA::Long              theNodeId, 
+                                               const SMESH::long_array& theModifiedElems )
+{
+  SMESH::long_array_var aNodes = new SMESH::long_array;
+  aNodes->length( 1 );
+  aNodes[ 0 ] = theNodeId;
+  return DoubleNodes( aNodes, theModifiedElems );
+}
+
+//================================================================================
+/*!
+  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+  This method provided for convenience works as DoubleNodes() described above.
+  \param theNodes - group of nodes to be doubled.
+  \param theModifiedElems - group of elements to be updated.
+  \return TRUE if operation has been completed successfully, FALSE otherwise
+  \sa DoubleNode(), DoubleNodes(), DoubleNodeGroups()
+*/
+//================================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup( 
+  SMESH::SMESH_GroupBase_ptr theNodes,
+  SMESH::SMESH_GroupBase_ptr theModifiedElems )
+{
+  if ( CORBA::is_nil( theNodes ) && theNodes->GetType() != SMESH::NODE )
+    return false;
+
+  SMESH::long_array_var aNodes = theNodes->GetListOfID();
+  SMESH::long_array_var aModifiedElems;
+  if ( !CORBA::is_nil( theModifiedElems ) )
+    aModifiedElems = theModifiedElems->GetListOfID();
+  else 
+  {
+    aModifiedElems = new SMESH::long_array;
+    aModifiedElems->length( 0 );
+  }
+
+  return DoubleNodes( aNodes, aModifiedElems );
+}
+
+//================================================================================
+/*!
+  \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+  This method provided for convenience works as DoubleNodes() described above.
+  \param theNodes - list of groups of nodes to be doubled
+  \param theModifiedElems - list of groups of elements to be updated.
+  \return TRUE if operation has been completed successfully, FALSE otherwise
+  \sa DoubleNode(), DoubleNodeGroup(), DoubleNodes()
+*/
+//================================================================================
+
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups( 
+  const SMESH::ListOfGroups& theNodes,
+  const SMESH::ListOfGroups& theModifiedElems )
+{
+  initData();
+
+  ::SMESH_MeshEditor aMeshEditor( myMesh );
+
+  std::list< int > aNodes;
+  int i, n, j, m;
+  for ( i = 0, n = theNodes.length(); i < n; i++ )
+  {
+    SMESH::SMESH_GroupBase_var aGrp = theNodes[ i ];
+    if ( !CORBA::is_nil( aGrp ) && aGrp->GetType() == SMESH::NODE )
+    {
+      SMESH::long_array_var aCurr = aGrp->GetListOfID();
+      for ( j = 0, m = aCurr->length(); j < m; j++ )
+        aNodes.push_back( aCurr[ j ] );
+    }
+  }
+
+  std::list< int > anElems;
+  for ( i = 0, n = theModifiedElems.length(); i < n; i++ )
+  {
+    SMESH::SMESH_GroupBase_var aGrp = theModifiedElems[ i ];
+    if ( !CORBA::is_nil( aGrp ) && aGrp->GetType() != SMESH::NODE )
+    {
+      SMESH::long_array_var aCurr = aGrp->GetListOfID();
+      for ( j = 0, m = aCurr->length(); j < m; j++ )
+        anElems.push_back( aCurr[ j ] );
+    }
+  }
+
+  bool aResult = aMeshEditor.DoubleNodes( aNodes, anElems );
+
+  storeResult( aMeshEditor) ;
+
+  return aResult;
+}
+
 //================================================================================
 /*!
   \brief Creates a hole in a mesh by doubling the nodes of some particular elements
@@ -4226,9 +4363,9 @@ void SMESH_MeshEditor_i::DumpGroupsList(TPythonDump &               theDumpPytho
 */
 //================================================================================
 
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theElems, 
-                                                const SMESH::long_array& theNodesNot,
-                                                const SMESH::long_array& theAffectedElems )
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElem( const SMESH::long_array& theElems, 
+                                                   const SMESH::long_array& theNodesNot,
+                                                   const SMESH::long_array& theAffectedElems )
 
 {
   initData();
@@ -4265,7 +4402,7 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodes( const SMESH::long_array& theElem
 */
 //================================================================================
 
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodesInRegion
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemInRegion
 ( const SMESH::long_array& theElems, 
   const SMESH::long_array& theNodesNot,
   GEOM::GEOM_Object_ptr    theShape )
@@ -4315,10 +4452,10 @@ static void groupToSet(SMESH::SMESH_GroupBase_ptr theGrp,
   arrayToSet( anIDs, theMeshDS, theElemSet, theType);
 }
 
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup( 
-                                                   SMESH::SMESH_GroupBase_ptr theElems,
-                                                   SMESH::SMESH_GroupBase_ptr theNodesNot,
-                                                   SMESH::SMESH_GroupBase_ptr theAffectedElems )
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroup( 
+                                                       SMESH::SMESH_GroupBase_ptr theElems,
+                                                       SMESH::SMESH_GroupBase_ptr theNodesNot,
+                                                       SMESH::SMESH_GroupBase_ptr theAffectedElems )
 
 {
   if ( CORBA::is_nil( theElems ) && theElems->GetType() == SMESH::NODE )
@@ -4357,10 +4494,10 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroup(
 */
 //================================================================================
 
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupInRegion( 
-                                                           SMESH::SMESH_GroupBase_ptr theElems,
-                                                           SMESH::SMESH_GroupBase_ptr theNodesNot,
-                                                           GEOM::GEOM_Object_ptr      theShape )
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroupInRegion( 
+                                                               SMESH::SMESH_GroupBase_ptr theElems,
+                                                               SMESH::SMESH_GroupBase_ptr theNodesNot,
+                                                               GEOM::GEOM_Object_ptr      theShape )
 
 {
   if ( CORBA::is_nil( theElems ) && theElems->GetType() == SMESH::NODE )
@@ -4416,10 +4553,10 @@ static void listOfGroupToSet(const SMESH::ListOfGroups& theGrpList,
   }
 }
 
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups( 
-                                                    const SMESH::ListOfGroups& theElems,
-                                                    const SMESH::ListOfGroups& theNodesNot,
-                                                    const SMESH::ListOfGroups& theAffectedElems )
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroups( 
+                                                        const SMESH::ListOfGroups& theElems,
+                                                        const SMESH::ListOfGroups& theNodesNot,
+                                                        const SMESH::ListOfGroups& theAffectedElems )
 {
   initData();
 
@@ -4455,10 +4592,10 @@ CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroups(
 */
 //================================================================================
 
-CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeGroupsInRegion( 
-                                                            const SMESH::ListOfGroups& theElems,
-                                                            const SMESH::ListOfGroups& theNodesNot,
-                                                            GEOM::GEOM_Object_ptr      theShape )
+CORBA::Boolean SMESH_MeshEditor_i::DoubleNodeElemGroupsInRegion( 
+                                                                const SMESH::ListOfGroups& theElems,
+                                                                const SMESH::ListOfGroups& theNodesNot,
+                                                                GEOM::GEOM_Object_ptr      theShape )
 {
   initData();