Salome HOME
0020749: EDF 1291 SMESH : Create 2D Mesh from 2D improvement
authoreap <eap@opencascade.com>
Wed, 6 Oct 2010 07:31:38 +0000 (07:31 +0000)
committereap <eap@opencascade.com>
Wed, 6 Oct 2010 07:31:38 +0000 (07:31 +0000)
+    SMESH::SMESH_Mesh MakeBoundaryMesh(in SMESH_IDSource elements,
+                                       in Bnd_Dimension  dimension,
+                                       in string         groupName,
+                                       in string         meshName,
+                                       in boolean        toCopyElements,
+                                       in boolean        toCopyExistingBondary,
+                                       out SMESH_Group   group);

idl/SMESH_MeshEditor.idl
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.hxx
src/SMESH_SWIG/smeshDC.py

index 387091de33b13916fdb8ff3578186138d3f0ec65..c010980be7c1d91457cfe57f33a88a64a03fdbd1 100644 (file)
@@ -29,6 +29,8 @@
 
 module SMESH
 {
 
 module SMESH
 {
+  enum Bnd_Dimension { BND_2DFROM3D, BND_1DFROM3D, BND_1DFROM2D };
+  
   /*!
    * This interface makes modifications on the Mesh - removing elements and nodes etc.
    */
   /*!
    * This interface makes modifications on the Mesh - removing elements and nodes etc.
    */
@@ -921,12 +923,34 @@ module SMESH
                                           in GEOM::GEOM_Object theShape );
 
     /*!
                                           in GEOM::GEOM_Object theShape );
 
     /*!
-     * \brief Generated skin mesh (containing 2D cells) from 3D mesh
+     * \brief Generates skin mesh (containing 2D cells) from 3D mesh
      * The created 2D mesh elements based on nodes of free faces of boundary volumes
      * \return TRUE if operation has been completed successfully, FALSE otherwise
      */
     boolean Make2DMeshFrom3D();
 
      * The created 2D mesh elements based on nodes of free faces of boundary volumes
      * \return TRUE if operation has been completed successfully, FALSE otherwise
      */
     boolean Make2DMeshFrom3D();
 
+    /*!
+     * \brief Creates missing boundary elements
+     *  \param elements - elements whose boundary is to be checked
+     *  \param dimension - defines type of boundary elements to create
+     *  \param groupName - a name of group to store created boundary elements in,
+     *                     "" means not to create the group
+     *  \param meshName - a name of new mesh to store created boundary elements in,
+     *                     "" means not to create the new mesh
+     *  \param toCopyElements - if true, the checked elements will be copied into the new mesh
+     *  \param toCopyExistingBondary - if true, not only new but also pre-existing 
+     *                                boundary elements will be copied into the new mesh
+     *  \param group - returns the create group, if any
+     *  \retval SMESH::SMESH_Mesh - the mesh where elements were added to
+     */
+    SMESH::SMESH_Mesh MakeBoundaryMesh(in SMESH_IDSource elements,
+                                       in Bnd_Dimension  dimension, 
+                                       in string         groupName,
+                                       in string         meshName,
+                                       in boolean        toCopyElements,
+                                       in boolean        toCopyExistingBondary,
+                                       out SMESH_Group   group);
+
   };
 };
 
   };
 };
 
index b88de2d3951e42016f5f55ea5b89f7b3a1b3a9e1..1a457eefbaceaf04e1618e233d7d712a51fd79da 100644 (file)
@@ -5182,7 +5182,37 @@ CORBA::Boolean SMESH_MeshEditor_i::Make2DMeshFrom3D()
   ::SMESH_MeshEditor aMeshEditor( myMesh );
   bool aResult = aMeshEditor.Make2DMeshFrom3D();
   storeResult( aMeshEditor) ;
   ::SMESH_MeshEditor aMeshEditor( myMesh );
   bool aResult = aMeshEditor.Make2DMeshFrom3D();
   storeResult( aMeshEditor) ;
-  
+
   TPythonDump() << "isDone = " << this << ".Make2DMeshFrom3D()";
   return aResult;
 }
   TPythonDump() << "isDone = " << this << ".Make2DMeshFrom3D()";
   return aResult;
 }
+
+//================================================================================
+/*!
+ * \brief Creates missing boundary elements
+ *  \param elements - elements whose boundary is to be checked
+ *  \param dimension - defines type of boundary elements to create
+ *  \param groupName - a name of group to store created boundary elements in,
+ *                     "" means not to create the group
+ *  \param meshName - a name of new mesh to store created boundary elements in,
+ *                     "" means not to create the new mesh
+ *  \param toCopyElements - if true, the checked elements will be copied into the new mesh
+ *  \param toCopyExistingBondary - if true, not only new but also pre-existing 
+ *                                boundary elements will be copied into the new mesh
+ *  \param group - returns the create group, if any
+ *  \retval SMESH::SMESH_Mesh - the mesh where elements were added to
+ */
+//================================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
+                                     SMESH::Bnd_Dimension      dimension,
+                                     const char*               groupName,
+                                     const char*               meshName,
+                                     CORBA::Boolean            toCopyElements,
+                                     CORBA::Boolean            toCopyMissingBondary,
+                                     SMESH::SMESH_Group_out    group)
+{
+
+  return SMESH::SMESH_Mesh::_duplicate( myMesh_i->_this() );
+}
index 330a52faf47e20adde886d6a881ac1692e085fbe..3a96b87cdf8056c5afd8cbbe5704cbeed3327d3e 100644 (file)
@@ -671,14 +671,22 @@ public:
                                                const SMESH::ListOfGroups& theNodesNot,
                                                GEOM::GEOM_Object_ptr      theShape );
 
                                                const SMESH::ListOfGroups& theNodesNot,
                                                GEOM::GEOM_Object_ptr      theShape );
 
-    /*!
-     * \brief Generated skin mesh (containing 2D cells) from 3D mesh
-     * The created 2D mesh elements based on nodes of free faces of boundary volumes
-     * \return TRUE if operation has been completed successfully, FALSE otherwise
-    */
-    CORBA::Boolean Make2DMeshFrom3D();
-
- private: //!< private methods
+  /*!
+   * \brief Generated skin mesh (containing 2D cells) from 3D mesh
+   * The created 2D mesh elements based on nodes of free faces of boundary volumes
+   * \return TRUE if operation has been completed successfully, FALSE otherwise
+   */
+  CORBA::Boolean Make2DMeshFrom3D();
+
+  SMESH::SMESH_Mesh_ptr MakeBoundaryMesh(SMESH::SMESH_IDSource_ptr elements,
+                                         SMESH::Bnd_Dimension      dimension,
+                                         const char*               groupName,
+                                         const char*               meshName,
+                                         CORBA::Boolean            toCopyElements,
+                                         CORBA::Boolean            toCopyMissingBondary,
+                                         SMESH::SMESH_Group_out    group);
+
+private: //!< private methods
 
   SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
 
 
   SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); }
 
index 9a88f94a05746a093dcd557f532338ecf7bdcb4c..94ffee1c925f7025151a07183b176c0673a873d9 100644 (file)
@@ -201,6 +201,7 @@ PrecisionConfusion = 1e-07
 # Methods of splitting a hexahedron into tetrahedra
 Hex_5Tet, Hex_6Tet, Hex_24Tet = 1, 2, 3
 
 # Methods of splitting a hexahedron into tetrahedra
 Hex_5Tet, Hex_6Tet, Hex_24Tet = 1, 2, 3
 
+
 ## Converts an angle from degrees to radians
 def DegreesToRadians(AngleInDegrees):
     from math import pi
 ## Converts an angle from degrees to radians
 def DegreesToRadians(AngleInDegrees):
     from math import pi
@@ -2558,6 +2559,8 @@ class Mesh:
     def SplitVolumesIntoTetra(self, elemIDs, method=Hex_5Tet ):
         if isinstance( elemIDs, Mesh ):
             elemIDs = elemIDs.GetMesh()
     def SplitVolumesIntoTetra(self, elemIDs, method=Hex_5Tet ):
         if isinstance( elemIDs, Mesh ):
             elemIDs = elemIDs.GetMesh()
+        if ( isinstance( elemIDs, list )):
+            elemIDs = self.editor.MakeIDSource(elemIDs, SMESH.VOLUME)
         self.editor.SplitVolumesIntoTetra(elemIDs, method)
 
     ## Splits quadrangle faces near triangular facets of volumes
         self.editor.SplitVolumesIntoTetra(elemIDs, method)
 
     ## Splits quadrangle faces near triangular facets of volumes
@@ -2792,7 +2795,30 @@ class Mesh:
     #  @ingroup l2_modif_edit
     def  Make2DMeshFrom3D(self):
         return self.editor. Make2DMeshFrom3D()
     #  @ingroup l2_modif_edit
     def  Make2DMeshFrom3D(self):
         return self.editor. Make2DMeshFrom3D()
-        
+
+    ## Creates missing boundary elements
+    #  @param elements - elements whose boundary is to be checked:
+    #                    mesh, group, sub-mesh or list of elements
+    #  @param dimension - defines type of boundary elements to create:
+    #                     SMESH.BND_2DFROM3D, SMESH.BND_1DFROM3D, SMESH.BND_1DFROM2D
+    #  @param groupName - a name of group to store created boundary elements in,
+    #                     "" means not to create the group
+    #  @param meshName - a name of new mesh to store created boundary elements in,
+    #                     "" means not to create the new mesh
+    #  @param toCopyElements - if true, the checked elements will be copied into the new mesh
+    #  @param toCopyExistingBondary - if true, not only new but also pre-existing 
+    #                                boundary elements will be copied into the new mesh
+    #  @return tuple (mesh, group) where bondary elements were added to
+    #  @ingroup l2_modif_edit
+    def MakeBoundaryMesh(self, elements, dimension=SMESH.BND_2DFROM3D, groupName="", meshName="",
+                         toCopyElements=False, toCopyExistingBondary=False):
+        if isinstance( elements, Mesh ):
+            elements = elements.GetMesh()
+        if ( isinstance( elements, list )):
+            elements = self.editor.MakeIDSource(elements, SMESH.ALL)
+        return self.editor.MakeBoundaryMesh(elements,dimension,groupName,meshName,
+                                            toCopyElements,toCopyExistingBondary)
+
     ## Renumber mesh nodes
     #  @ingroup l2_modif_renumber
     def RenumberNodes(self):
     ## Renumber mesh nodes
     #  @ingroup l2_modif_renumber
     def RenumberNodes(self):