Salome HOME
PR: tools for crack meshing : detection of elements affected by node duplication...
[modules/smesh.git] / src / SMESH_I / SMESH_MeshEditor_i.hxx
index 1cd67ed849e8e492235bcb7e24d29723b1df3997..7030afa9c899b6a28a2aaa98bff66ac09df8f970 100644 (file)
@@ -1,23 +1,23 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
@@ -65,6 +65,8 @@ public:
    */
   CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z);
   CORBA::Long Add0DElement(CORBA::Long IDOfNode);
+  CORBA::Long AddBall(CORBA::Long IDOfNodem, CORBA::Double diameter)
+    throw (SALOME::SALOME_Exception);
   CORBA::Long AddEdge(const SMESH::long_array & IDsOfNodes);
   CORBA::Long AddFace(const SMESH::long_array & IDsOfNodes);
   CORBA::Long AddPolygonalFace(const SMESH::long_array & IDsOfNodes);
@@ -122,6 +124,19 @@ public:
   CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
   CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
   CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
+  /*!
+   * \brief Reorient faces contained in \a the2Dgroup.
+   * \param the2Dgroup - the mesh or its part to reorient
+   * \param theDirection - desired direction of normal of \a theFace
+   * \param theFace - ID of face whose orientation is checked.
+   *        It can be < 1 then \a thePoint is used to find a face.
+   * \param thePoint - is used to find a face if \a theFace < 1.
+   * \return number of reoriented elements.
+   */
+  CORBA::Long Reorient2D(SMESH::SMESH_IDSource_ptr the2Dgroup,
+                         const SMESH::DirStruct&   theDirection,
+                         CORBA::Long               theFace,
+                         const SMESH::PointStruct& thePoint) throw (SALOME::SALOME_Exception);
 
   // Split/Join faces
   CORBA::Boolean TriToQuad       (const SMESH::long_array &   IDsOfElements,
@@ -212,9 +227,17 @@ public:
   void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
                       const SMESH::DirStruct &  StepVector,
                       CORBA::Long               NbOfSteps);
+  void ExtrusionSweep0D(const SMESH::long_array & IDsOfElements,
+                      const SMESH::DirStruct &  StepVector,
+                      CORBA::Long               NbOfSteps);
+
   void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
                             const SMESH::DirStruct &  StepVector,
                             CORBA::Long               NbOfSteps);
+
+  void ExtrusionSweepObject0D(SMESH::SMESH_IDSource_ptr theObject,
+                              const SMESH::DirStruct &  StepVector,
+                              CORBA::Long               NbOfSteps);
   void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
                               const SMESH::DirStruct &  StepVector,
                               CORBA::Long               NbOfSteps);
@@ -315,6 +338,10 @@ public:
   SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
                                                 const SMESH::DirStruct&  StepVector,
                                                 CORBA::Long              NbOfSteps);
+  SMESH::ListOfGroups* ExtrusionSweepMakeGroups0D(const SMESH::long_array& IDsOfElements,
+                                                const SMESH::DirStruct&  StepVector,
+                                                CORBA::Long              NbOfSteps);
+
   SMESH::ListOfGroups* AdvancedExtrusionMakeGroups(const SMESH::long_array& IDsOfElements,
                                                    const SMESH::DirStruct&  StepVector,
                                                    CORBA::Long              NbOfSteps,
@@ -323,6 +350,9 @@ public:
   SMESH::ListOfGroups* ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
                                                       const SMESH::DirStruct&   StepVector,
                                                       CORBA::Long               NbOfSteps);
+  SMESH::ListOfGroups* ExtrusionSweepObject0DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
+                                                        const SMESH::DirStruct&   StepVector,
+                                                        CORBA::Long               NbOfSteps);
   SMESH::ListOfGroups* ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
                                                         const SMESH::DirStruct&   StepVector,
                                                         CORBA::Long               NbOfSteps);
@@ -483,6 +513,16 @@ public:
                                          CORBA::Double      y,
                                          CORBA::Double      z,
                                          SMESH::ElementType type);
+  /*!
+   * Searching among the given elements, return elements of given type 
+   * where the given point is IN or ON.
+   * 'ALL' type means elements of any type excluding nodes
+   */
+  SMESH::long_array* FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elements,
+                                              CORBA::Double             x,
+                                              CORBA::Double             y,
+                                              CORBA::Double             z,
+                                              SMESH::ElementType        type);
 
   /*!
    * Return point state in a closed 2D mesh in terms of TopAbs_State enumeration.
@@ -634,6 +674,12 @@ public:
   SMESH::SMESH_Group_ptr DoubleNodeElemGroupNew( SMESH::SMESH_GroupBase_ptr theElems,
                                                  SMESH::SMESH_GroupBase_ptr theNodesNot,
                                                  SMESH::SMESH_GroupBase_ptr theAffectedElems );
+
+  SMESH::ListOfGroups*   DoubleNodeElemGroup2New(SMESH::SMESH_GroupBase_ptr theElems,
+                                                 SMESH::SMESH_GroupBase_ptr theNodesNot,
+                                                 SMESH::SMESH_GroupBase_ptr theAffectedElems,
+                                                 CORBA::Boolean             theElemGroupNeeded,
+                                                 CORBA::Boolean             theNodeGroupNeeded);
   
   /*!
    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
@@ -677,6 +723,11 @@ public:
                                                   const SMESH::ListOfGroups& theNodesNot,
                                                   const SMESH::ListOfGroups& theAffectedElems );
 
+  SMESH::ListOfGroups*   DoubleNodeElemGroups2New(const SMESH::ListOfGroups& theElems,
+                                                  const SMESH::ListOfGroups& theNodesNot,
+                                                  const SMESH::ListOfGroups& theAffectedElems,
+                                                  CORBA::Boolean             theElemGroupNeeded,
+                                                  CORBA::Boolean             theNodeGroupNeeded);
 
   /*!
    * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
@@ -692,6 +743,22 @@ public:
   CORBA::Boolean DoubleNodeElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
                                                const SMESH::ListOfGroups& theNodesNot,
                                                GEOM::GEOM_Object_ptr      theShape );
+
+  /*!
+   * \brief Identify the elements that will be affected by node duplication (actual duplication is not performed.
+   * This method is the first step of DoubleNodeElemGroupsInRegion.
+   * \param theElems - list of groups of elements (edges or faces) to be replicated
+   * \param theNodesNot - list of groups of nodes not to replicated
+   * \param theShape - shape to detect affected elements (element which geometric center
+   *        located on or inside shape).
+   *        The replicated nodes should be associated to affected elements.
+   * \return groups of affected elements
+   * \sa DoubleNodeElemGroupsInRegion()
+   */
+  SMESH::ListOfGroups* AffectedElemGroupsInRegion( const SMESH::ListOfGroups& theElems,
+                                                   const SMESH::ListOfGroups& theNodesNot,
+                                                   GEOM::GEOM_Object_ptr      theShape );
+
   /*!
    * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
    * The list of groups must describe a partition of the mesh volumes.
@@ -703,7 +770,31 @@ public:
    * @return TRUE if operation has been completed successfully, FALSE otherwise
    */
   CORBA::Boolean DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& theDomains,
-                                               CORBA::Boolean createJointElems );
+                                               CORBA::Boolean createJointElems )
+    throw (SALOME::SALOME_Exception);
+  /*!
+   * \brief Double nodes on some external faces and create flat elements.
+   * Flat elements are mainly used by some types of mechanic calculations.
+   *
+   * Each group of the list must be constituted of faces.
+   * Triangles are transformed in prisms, and quadrangles in hexahedrons.
+   * @param theGroupsOfFaces - list of groups of faces
+   * @return TRUE if operation has been completed successfully, FALSE otherwise
+   */
+  CORBA::Boolean CreateFlatElementsOnFacesGroups( const SMESH::ListOfGroups& theGroupsOfFaces );
+
+  /*!
+   *  \brief identify all the elements around a geom shape, get the faces delimiting the hole
+   *  Build groups of volume to remove, groups of faces to replace on the skin of the object,
+   *  groups of faces to remove insidethe object, (idem edges).
+   *  Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
+   */
+  void CreateHoleSkin(CORBA::Double radius,
+                      GEOM::GEOM_Object_ptr theShape,
+                      const char* groupName,
+                      const SMESH::double_array& theNodesCoords,
+                      SMESH::array_of_long_array_out GroupsOfNodes)
+  throw (SALOME::SALOME_Exception);
 
   /*!
    * \brief Generated skin mesh (containing 2D cells) from 3D mesh
@@ -822,11 +913,9 @@ private: //!< private methods
 
 private: //!< fields
 
-  SMESH_Mesh_i*         myMesh_i;
-  SMESH_Mesh *          myMesh;
-
-  SMESH::long_array_var myLastCreatedElems;
-  SMESH::long_array_var myLastCreatedNodes;
+  SMESH_Mesh_i*      myMesh_i;
+  SMESH_Mesh *       myMesh;
+  ::SMESH_MeshEditor myEditor;
 
   SMESH::MeshPreviewStruct_var myPreviewData;
   bool                         myPreviewMode;