Salome HOME
Enable setting of Numeric Functors as criteria in Split Quadrangles and Union Triangl...
authorjfa <jfa@opencascade.com>
Thu, 11 Aug 2005 08:06:39 +0000 (08:06 +0000)
committerjfa <jfa@opencascade.com>
Thu, 11 Aug 2005 08:06:39 +0000 (08:06 +0000)
idl/SMESH_Mesh.idl
src/Controls/SMESH_Controls.cxx
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_MeshEditor.hxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx
src/SMESHGUI/SMESHGUI_MultiEditDlg.h
src/SMESHGUI/SMESH_msg_en.po
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.hxx

index 53579df6a210624d812957228f2e035927f6df08..c2234028caaf06e289e57629037079a8bea6be08 100644 (file)
@@ -1,21 +1,21 @@
 //  Copyright (C) 2003  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 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 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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 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
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
@@ -80,11 +80,11 @@ module SMESH
     long_array indexes;
   };
 
-  struct PointStruct { double x; 
-                      double y; 
-                      double z; } ; 
+  struct PointStruct { double x;
+                      double y;
+                      double z; } ;
   struct DirStruct   { PointStruct PS ; } ;          // analog to Occ Direction
-   
+
   struct AxisStruct  { double x;
                       double y;
                       double z;
@@ -92,7 +92,7 @@ module SMESH
                       double vy;
                       double vz; } ;
 
-  
+
   /*!
    * Enumeration for element type, like in SMDS
    */
@@ -104,10 +104,10 @@ module SMESH
     FACE,
     VOLUME
   };
-  
+
   /*!
-   * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods) 
-   */  
+   * Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
+   */
   enum Hypothesis_Status // in the order of severity
   {
     HYP_OK,
@@ -120,11 +120,11 @@ module SMESH
     HYP_NOTCONFORM,   // not conform mesh is produced appling a hypothesis
     HYP_ALREADY_EXIST,// such hypothesis already exist
     HYP_BAD_DIM       // bad dimension
-  }; 
-  
+  };
+
   /*!
    * Enumeration for DriverMED read status (used by ImportMEDFile() method)
-   */  
+   */
   enum DriverMED_ReadStatus // in the order of severity
   {
     DRS_OK,
@@ -133,11 +133,11 @@ module SMESH
                         // so the numbers from the file are ignored
     DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
     DRS_FAIL            // general failure (exception etc.)
-  }; 
+  };
 
   /*!
    * Enumeration for DriverMED (used by Perform() method)
-   */  
+   */
   enum MED_VERSION // in the order of severity
   {
     MED_V2_1,
@@ -154,7 +154,7 @@ module SMESH
      */
     long_array GetIDs();
   };
-  
+
   interface SMESH_GroupBase;
   interface SMESH_Group;
   interface SMESH_GroupOnGeom;
@@ -162,27 +162,26 @@ module SMESH
   interface SMESH_MeshEditor;
   interface SMESH_Mesh : SALOME::GenericObj, SMESH_IDSource
   {
-    /*!
-     * Associate a Shape to a Mesh created with NewEmpty
-     */
-
-//     boolean SetMesh(in GEOM::GEOM_Object anObject)
-//        raises (SALOME::SALOME_Exception);
+    ///*!
+    // * Associate a Shape to a Mesh created with NewEmpty
+    // */
+    //boolean SetMesh(in GEOM::GEOM_Object anObject)
+    //  raises (SALOME::SALOME_Exception);
 
     /*!
      * Get the subMesh object associated to a subShape. The subMesh object
      * gives access to nodes and elements IDs.
-     * SubMesh will be used instead of SubShape in a next idl version to 
+     * SubMesh will be used instead of SubShape in a next idl version to
      * adress a specific subMesh...
      */
     SMESH_subMesh GetSubMesh(in GEOM::GEOM_Object aSubObject, in string name)
       raises (SALOME::SALOME_Exception);
 
-    /*!
-     * Create a subMesh without reference to a subShape
-     */
-//     SMESH_subMesh NewEmpty()
-//       raises (SALOME::SALOME_Exception);
+    ///*!
+    // * Create a subMesh without reference to a subShape
+    // */
+    //SMESH_subMesh NewEmpty()
+    //  raises (SALOME::SALOME_Exception);
 
     /*!
      * Get geom shape to mesh. A result may be nil
@@ -217,41 +216,41 @@ module SMESH
     void RemoveGroup(in SMESH_GroupBase aGroup)
       raises (SALOME::SALOME_Exception);
 
-     /*!
+    /*!
      *  Remove group with its contents
      */
     void RemoveGroupWithContents( in SMESH_GroupBase aGroup )
-        raises (SALOME::SALOME_Exception);
+      raises (SALOME::SALOME_Exception);
 
     /*!
      * Union of two groups
-     *    New group is created. All mesh elements that are 
+     *    New group is created. All mesh elements that are
      *    present in initial groups are added to the new one
      */
     SMESH_Group UnionGroups (in SMESH_GroupBase aGroup1,
                              in SMESH_GroupBase aGroup2,
                              in string          name )
-        raises (SALOME::SALOME_Exception);
+      raises (SALOME::SALOME_Exception);
 
     /*!
      *  Intersection of two groups
-     *  New group is created. All mesh elements that are 
+     *  New group is created. All mesh elements that are
      *  present in both initial groups are added to the new one.
      */
     SMESH_Group IntersectGroups (in SMESH_GroupBase aGroup1,
                                  in SMESH_GroupBase aGroup2,
                                  in string          name )
-        raises (SALOME::SALOME_Exception);
-
-      /*!
-       *  Cut of two groups
-       *  New group is created. All mesh elements that are present in 
-       *  main group but do not present in tool group are added to the new one
-       */
-      SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
-                             in SMESH_GroupBase aToolGroup,
-                             in string          name )
-          raises (SALOME::SALOME_Exception);
+      raises (SALOME::SALOME_Exception);
+
+    /*!
+     *  Cut of two groups
+     *  New group is created. All mesh elements that are present in
+     *  main group but do not present in tool group are added to the new one
+     */
+    SMESH_Group CutGroups (in SMESH_GroupBase aMainGroup,
+                          in SMESH_GroupBase aToolGroup,
+                          in string          name )
+      raises (SALOME::SALOME_Exception);
 
     /*!
      * Add hypothesis to the mesh, under a particular subShape
@@ -262,9 +261,9 @@ module SMESH
      * @params
      * - aSubShape : subShape obtained by a shape explode in GEOM
      *   (or main shape)
-     * - anHyp : hypothesis object 
+     * - anHyp : hypothesis object
      * @return
-     * - OK if the hypothesis is compatible with the subShape 
+     * - OK if the hypothesis is compatible with the subShape
      *   (and all previous hypothesis on the subShape)
      * - NOK if the hypothesis is not compatible with the subShape
      *   (or one previous hypothesis on the subShape)
@@ -276,7 +275,6 @@ module SMESH
 //     boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
 //       raises (SALOME::SALOME_Exception);
 
-
     /*!
      * Remove an hypothesis previouly added with AddHypothesis.
      */
@@ -314,17 +312,20 @@ module SMESH
       raises (SALOME::SALOME_Exception);
 
     /*!
-     * Get the internal Id 
+     * Get the internal Id
      */
-    long GetId();     
+    long GetId();
 
     /*!
-     * Get the study Id 
+     * Get the study Id
      */
-    long GetStudyId();    
-    
-    SMESH_MeshEditor GetMeshEditor() 
-       raises (SALOME::SALOME_Exception);
+    long GetStudyId();
+
+    /*!
+     * Obtain instance of SMESH_MeshEditor
+     */
+    SMESH_MeshEditor GetMeshEditor()
+      raises (SALOME::SALOME_Exception);
 
     /*!
      * Export Mesh to different MED Formats
@@ -336,6 +337,7 @@ module SMESH
      */
     void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
       raises (SALOME::SALOME_Exception);
+
     /*!
      * Export Mesh to MED_V2_1 MED format
      * Works, just the same as ExportToMED, with MED_VERSION parameter equal to MED_V2_1.
@@ -360,6 +362,9 @@ module SMESH
     SALOME_MED::MESH GetMEDMesh()
       raises (SALOME::SALOME_Exception);
 
+    /*!
+     * Get informations about mesh contents
+     */
     long NbNodes()
       raises (SALOME::SALOME_Exception);
 
@@ -411,37 +416,40 @@ module SMESH
     long_array GetNodesId()
       raises (SALOME::SALOME_Exception);
 
+    /*!
+     * Get mesh description
+     */
     string Dump();
   };
 
   interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
   {
     /*!
-     * 
+     *
      */
     long GetNumberOfElements()
       raises (SALOME::SALOME_Exception);
 
     /*!
-     * 
+     *
      */
     long GetNumberOfNodes( in boolean all )
       raises (SALOME::SALOME_Exception);
 
     /*!
-     * 
+     *
      */
     long_array GetElementsId()
       raises (SALOME::SALOME_Exception);
 
     /*!
-     * 
+     *
      */
     long_array GetElementsByType( in ElementType theType )
       raises (SALOME::SALOME_Exception);
 
     /*!
-     * 
+     *
      */
     long_array GetNodesId()
       raises (SALOME::SALOME_Exception);
@@ -459,9 +467,9 @@ module SMESH
       raises (SALOME::SALOME_Exception);
 
     /*!
-     * Get the internal Id 
+     * Get the internal Id
      */
-    long GetId();    
+    long GetId();
 
     /*!
      * Get MED subMesh
@@ -469,14 +477,13 @@ module SMESH
     SALOME_MED::FAMILY GetFamily()
       raises (SALOME::SALOME_Exception);
   };
-  
+
   /*!
    * This interface makes modifications on the Mesh - removing elements and nodes etc.
    */
   interface NumericalFunctor;
-  interface SMESH_MeshEditor {
-
-
+  interface SMESH_MeshEditor
+  {
     boolean RemoveElements(in long_array IDsOfElements);
 
     boolean RemoveNodes(in long_array IDsOfNodes);
@@ -489,8 +496,6 @@ module SMESH
 
     boolean AddVolume(in long_array IDsOfNodes);
 
-    //boolean AddPolygonalFace (in long_array IdsOfNodes);
-
     /*!
      *  Create volume of many faces, giving nodes for each face.
      *  \param IdsOfNodes List of node IDs for volume creation face by face.
@@ -515,25 +520,73 @@ module SMESH
     boolean DeleteDiag(in long NodeID1, in long NodeID2);
 
     boolean Reorient(in long_array IDsOfElements);
-    
-    boolean ReorientObject(in SMESH_IDSource  theObject);
-
-    boolean TriToQuad(in long_array       IDsOfElements,
-                      in NumericalFunctor Criterion,
-                      in double           MaxAngle);
-    
-    boolean TriToQuadObject(in SMESH_IDSource   theObject,
-                           in NumericalFunctor Criterion,
-                           in double           MaxAngle);
-    
-    boolean QuadToTri(in long_array       IDsOfElements,
-                      in NumericalFunctor Criterion);
-
-    boolean SplitQuad(in long_array IDsOfElements,
-                      in boolean    Diag13);
-
-    boolean SplitQuadObject(in SMESH_IDSource   theObject,
-                           in boolean    Diag13);
+
+    boolean ReorientObject(in SMESH_IDSource theObject);
+
+    /*!
+     * \brief Fuse neighbour triangles into quadrangles.
+     * \param theElems     The triangles to be fused.
+     * \param theCriterion Is used to choose a neighbour to fuse with.
+     * \param theMaxAngle  Is a max angle between element normals at which fusion
+     *                     is still performed; theMaxAngle is mesured in radians.
+     * \return TRUE in case of success, FALSE otherwise.
+     */
+    boolean TriToQuad (in long_array       IDsOfElements,
+                      in NumericalFunctor Criterion,
+                      in double           MaxAngle);
+
+    /*!
+     * \brief Fuse neighbour triangles into quadrangles.
+     *
+     * Behaves like the above method, taking list of elements from \a theObject
+     */
+    boolean TriToQuadObject (in SMESH_IDSource   theObject,
+                            in NumericalFunctor Criterion,
+                            in double           MaxAngle);
+
+    /*!
+     * \brief Split quadrangles into triangles.
+     * \param theElems     The faces to be splitted.
+     * \param theCriterion Is used to choose a diagonal for splitting.
+     * \return TRUE in case of success, FALSE otherwise.
+     */
+    boolean QuadToTri (in long_array       IDsOfElements,
+                      in NumericalFunctor Criterion);
+
+    /*!
+     * \brief Split quadrangles into triangles.
+     *
+     * Behaves like the above method, taking list of elements from \a theObject
+     */
+    boolean QuadToTriObject (in SMESH_IDSource   theObject,
+                            in NumericalFunctor Criterion);
+
+    /*!
+     * \brief Split quadrangles into triangles.
+     * \param theElems  The faces to be splitted.
+     * \param the13Diag Is used to choose a diagonal for splitting.
+     * \return TRUE in case of success, FALSE otherwise.
+     */
+    boolean SplitQuad (in long_array IDsOfElements,
+                      in boolean    Diag13);
+
+    /*!
+     * \brief Split quadrangles into triangles.
+     *
+     * Behaves like the above method, taking list of elements from \a theObject
+     */
+    boolean SplitQuadObject (in SMESH_IDSource theObject,
+                            in boolean        Diag13);
+
+    /*!
+     *  Find better splitting of the given quadrangle.
+     *  \param IDOfQuad  ID of the quadrangle to be splitted.
+     *  \param Criterion A criterion to choose a diagonal for splitting.
+     *  \return 1 if 1-3 diagonal is better, 2 if 2-4
+     *          diagonal is better, 0 if error occurs.
+     */
+    long BestSplit (in long             IDOfQuad,
+                   in NumericalFunctor Criterion);
 
     enum Smooth_Method { LAPLACIAN_SMOOTH, CENTROIDAL_SMOOTH };
 
@@ -576,7 +629,7 @@ module SMESH
                             in double          AngleInRadians,
                             in long            NbOfSteps,
                             in double          Tolerance);
-                       
+
     void ExtrusionSweep(in long_array      IDsOfElements,
                         in DirStruct       StepVector,
                         in long            NbOfSteps);
@@ -595,7 +648,7 @@ module SMESH
 
     enum Extrusion_Error {
       EXTR_OK,
-      EXTR_NO_ELEMENTS, 
+      EXTR_NO_ELEMENTS,
       EXTR_PATH_NOT_EDGE,
       EXTR_BAD_PATH_SHAPE,
       EXTR_BAD_STARTING_NODE,
@@ -640,7 +693,7 @@ module SMESH
     void TranslateObject (in SMESH_IDSource  theObject,
                          in DirStruct       Vector,
                          in boolean         Copy);
-    
+
     void Rotate (in long_array       IDsOfElements,
                  in AxisStruct       Axis,
                  in double           AngleInRadians,
@@ -650,7 +703,7 @@ module SMESH
                       in AxisStruct      Axis,
                       in double          AngleInRadians,
                       in boolean         Copy);
-    
+
     void FindCoincidentNodes (in  double              Tolerance,
                               out array_of_long_array GroupsOfNodes);
 
index 7699902c190078253069fcc809dbd096a12317f0..0714f7ea4b8027f389c0dea1d8ae4a6b41dcc161 100644 (file)
@@ -1,20 +1,20 @@
 //  Copyright (C) 2003  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 
+//  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 distributed in the hope that it will be useful, 
+//  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 
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 
 #include "SMESH_ControlsDef.hxx"
 
 
 /*
-                            AUXILIARY METHODS 
+                            AUXILIARY METHODS
 */
 
 namespace{
   inline double getAngle( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
   {
     gp_Vec v1( P1 - P2 ), v2( P3 - P2 );
-    
+
     return v1.Magnitude() < gp::Resolution() ||
       v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
   }
@@ -85,13 +85,13 @@ namespace{
   {
     if ( theMesh == 0 )
       return 0;
-    
+
     const SMDS_MeshElement* anEdge = theMesh->FindElement( theId );
     if ( anEdge == 0 || anEdge->GetType() != SMDSAbs_Edge || anEdge->NbNodes() != 2 )
       return 0;
-    
+
     TColStd_MapOfInteger aMap;
-    
+
     int aResult = 0;
     SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
     if ( anIter != 0 ) {
@@ -104,7 +104,7 @@ namespace{
          const SMDS_MeshElement* anElem = anElemIter->next();
          if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
            int anId = anElem->GetID();
-           
+
            if ( anIter->more() )              // i.e. first node
              aMap.Add( anId );
            else if ( aMap.Contains( anId ) )
@@ -113,7 +113,7 @@ namespace{
        }
       }
     }
-    
+
     return aResult;
   }
 
@@ -218,18 +218,19 @@ double MinimumAngle::GetValue( const TSequenceOfXYZ& P )
 
   aMin = getAngle(P( P.size() ), P( 1 ), P( 2 ));
   aMin = Min(aMin,getAngle(P( P.size()-1 ), P( P.size() ), P( 1 )));
-  
+
   for (int i=2; i<P.size();i++){
       double A0 = getAngle( P( i-1 ), P( i ), P( i+1 ) );
     aMin = Min(aMin,A0);
   }
 
-  return aMin * 180 / PI;
+  return aMin * 180.0 / PI;
 }
 
 double MinimumAngle::GetBadRate( double Value, int nbNodes ) const
 {
-  const double aBestAngle = PI / nbNodes;
+  //const double aBestAngle = PI / nbNodes;
+  const double aBestAngle = 180.0 - ( 360.0 / double(nbNodes) );
   return ( fabs( aBestAngle - Value ));
 }
 
@@ -259,7 +260,7 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
 
   // Compute aspect ratio
 
-  if ( nbNodes == 3 ) 
+  if ( nbNodes == 3 )
   {
     double anArea = getArea( P( 1 ), P( 2 ), P( 3 ) );
     if ( anArea <= Precision::Confusion() )
@@ -273,14 +274,14 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
   {
     double aMinLen = aLen[ 0 ];
     double aMaxLen = aLen[ 0 ];
-    
+
     for(int i = 1; i < nbNodes ; i++ ){
       aMinLen = Min( aMinLen, aLen[ i ] );
       aMaxLen = Max( aMaxLen, aLen[ i ] );
     }
     if ( aMinLen <= Precision::Confusion() )
       return 0.;
-    
+
     return aMaxLen / aMinLen;
   }
 }
@@ -341,7 +342,7 @@ namespace{
     double Q = b2*f2*(a2+c2+d2+e2-b2-f2);
     double R = c2*d2*(a2+b2+e2+f2-c2-d2);
     double S = a2*b2*d2+b2*c2*e2+a2*c2*f2+d2*e2*f2;
-    
+
     return sqrt(P+Q+R-S)/12.0;
   }
 
@@ -732,7 +733,7 @@ double Skew::GetValue( const TSequenceOfXYZ& P )
 
     return Max( A0, Max( A1, A2 ) ) * 180 / PI;
   }
-  else 
+  else
   {
     gp_XYZ p12 = ( P( 1 ) + P( 2 ) ) / 2;
     gp_XYZ p23 = ( P( 2 ) + P( 3 ) ) / 2;
@@ -820,16 +821,16 @@ double Length2D::GetValue( long theElementId)
   TSequenceOfXYZ P;
 
   if (GetPoints(theElementId,P)){
-    
+
     double  aVal;// = GetValue( P );
     const SMDS_MeshElement* aElem = myMesh->FindElement( theElementId );
     SMDSAbs_ElementType aType = aElem->GetType();
-    
+
     int len = P.size();
-    
+
     switch (aType){
     case SMDSAbs_All:
-    case SMDSAbs_Node: 
+    case SMDSAbs_Node:
     case SMDSAbs_Edge:
       if (len == 2){
        aVal = getDistance( P( 1 ), P( 2 ) );
@@ -861,7 +862,7 @@ double Length2D::GetValue( long theElementId)
        double L6 = getDistance(P( 3 ),P( 4 ));
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        break;
-      } 
+      }
       else if (len == 5){ // piramids
        double L1 = getDistance(P( 1 ),P( 2 ));
        double L2 = getDistance(P( 2 ),P( 3 ));
@@ -871,7 +872,7 @@ double Length2D::GetValue( long theElementId)
        double L6 = getDistance(P( 2 ),P( 5 ));
        double L7 = getDistance(P( 3 ),P( 5 ));
        double L8 = getDistance(P( 4 ),P( 5 ));
-      
+
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        aVal = Max(aVal,Max(L7,L8));
        break;
@@ -886,7 +887,7 @@ double Length2D::GetValue( long theElementId)
        double L7 = getDistance(P( 1 ),P( 4 ));
        double L8 = getDistance(P( 2 ),P( 5 ));
        double L9 = getDistance(P( 3 ),P( 6 ));
-      
+
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        aVal = Max(aVal,Max(Max(L7,L8),L9));
        break;
@@ -904,17 +905,17 @@ double Length2D::GetValue( long theElementId)
        double L10= getDistance(P( 2 ),P( 6 ));
        double L11= getDistance(P( 3 ),P( 7 ));
        double L12= getDistance(P( 4 ),P( 8 ));
-      
+
        aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
        aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
        aVal = Max(aVal,Max(L11,L12));
        break;
-       
+
       }
-      
-    default: aVal=-1; 
+
+    default: aVal=-1;
     }
-    
+
     if (aVal <0){
       return 0.;
     }
@@ -924,7 +925,7 @@ double Length2D::GetValue( long theElementId)
       double prec = pow( 10., (double)( myPrecision ) );
       aVal = floor( aVal * prec + 0.5 ) / prec;
     }
-    
+
     return aVal;
 
   }
@@ -965,7 +966,7 @@ void Length2D::GetValues(TValues& theValues){
     SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
     long aNodeId[2];
     gp_Pnt P[3];
-    
+
     double aLength;
     const SMDS_MeshElement* aNode;
     if(aNodesIter->more()){
@@ -974,24 +975,24 @@ void Length2D::GetValues(TValues& theValues){
       P[0] = P[1] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
       aNodeId[0] = aNodeId[1] = aNode->GetID();
       aLength = 0;
-    }  
+    }
     for(; aNodesIter->more(); ){
       aNode = aNodesIter->next();
       const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
       long anId = aNode->GetID();
-      
+
       P[2] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
 
       aLength = P[1].Distance(P[2]);
-      
+
       Value aValue(aLength,aNodeId[1],anId);
       aNodeId[1] = anId;
       P[1] = P[2];
       theValues.insert(aValue);
     }
-    
+
     aLength = P[0].Distance(P[1]);
-    
+
     Value aValue(aLength,aNodeId[0],aNodeId[1]);
     theValues.insert(aValue);
   }
@@ -1033,19 +1034,19 @@ double MultiConnection2D::GetValue( long theElementId )
 {
   TSequenceOfXYZ P;
   int aResult = 0;
-  
+
   if (GetPoints(theElementId,P)){
     const SMDS_MeshElement* anFaceElem = myMesh->FindElement( theElementId );
     SMDSAbs_ElementType aType = anFaceElem->GetType();
-    
+
     int len = P.size();
-    
+
     TColStd_MapOfInteger aMap;
     int aResult = 0;
-    
+
     switch (aType){
     case SMDSAbs_All:
-    case SMDSAbs_Node: 
+    case SMDSAbs_Node:
     case SMDSAbs_Edge:
     case SMDSAbs_Face:
       if (len == 3){ // triangles
@@ -1075,14 +1076,14 @@ double MultiConnection2D::GetValue( long theElementId )
            }
          }
        }
-       
+
        aResult = Max(Max(Nb[0],Nb[1]),Nb[2]);
       }
       break;
     case SMDSAbs_Volume:
     default: aResult=0;
     }
-    
+
   }
   return aResult;//getNbMultiConnection( myMesh, theId );
 }
@@ -1133,7 +1134,7 @@ void MultiConnection2D::GetValues(MValues& theValues){
       aNode2 = (SMDS_MeshNode*) aNodesIter->next();
       long anId = aNode2->GetID();
       aNodeId[2] = anId;
-      
+
       Value aValue(aNodeId[1],aNodeId[2]);
       MValues::iterator aItr = theValues.find(aValue);
       if (aItr != theValues.end()){
@@ -1249,7 +1250,7 @@ bool FreeEdges::IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId
       {
         int anId = anElem->GetID();
 
-        if ( i == 0 ) 
+        if ( i == 0 )
           aMap.Add( anId );
         else if ( aMap.Contains( anId ) && anId != theFaceId )
           return false;
@@ -1288,7 +1289,7 @@ bool FreeEdges::IsSatisfy( long theId )
       return true;
 
   aNodes[ 1 ] = aNodes[ nbNodes - 1 ];
-  
+
   return IsFreeEdge( &aNodes[ 0 ], theId );
 
 }
@@ -1315,7 +1316,7 @@ bool FreeEdges::Border::operator<(const FreeEdges::Border& x) const{
 }
 
 inline void UpdateBorders(const FreeEdges::Border& theBorder,
-                         FreeEdges::TBorders& theRegistry, 
+                         FreeEdges::TBorders& theRegistry,
                          FreeEdges::TBorders& theContainer)
 {
   if(theRegistry.find(theBorder) == theRegistry.end()){
@@ -1339,7 +1340,7 @@ void FreeEdges::GetBoreders(TBorders& theBorders)
     if(aNodesIter->more()){
       aNode = aNodesIter->next();
       aNodeId[0] = aNodeId[1] = aNode->GetID();
-    }  
+    }
     for(; aNodesIter->more(); ){
       aNode = aNodesIter->next();
       long anId = aNode->GetID();
@@ -1376,7 +1377,7 @@ RangeOfIds::RangeOfIds()
 
 //=======================================================================
 // name    : SetMesh
-// Purpose : Set mesh 
+// Purpose : Set mesh
 //=======================================================================
 void RangeOfIds::SetMesh( const SMDS_Mesh* theMesh )
 {
@@ -1422,9 +1423,9 @@ void RangeOfIds::GetRangeStr( TCollection_AsciiString& theResStr )
     TCollection_AsciiString aStr;
     if ( aMinId != IntegerFirst() )
       aStr += aMinId;
-      
+
     aStr += "-";
-      
+
     if ( aMaxId != IntegerLast() )
       aStr += aMaxId;
 
@@ -1492,7 +1493,7 @@ bool RangeOfIds::SetRangeStr( const TCollection_AsciiString& theStr )
   {
     tmpStr = aStr.Token( ",", i++ );
     int aPos = tmpStr.Search( '-' );
-    
+
     if ( aPos == -1 )
     {
       if ( tmpStr.IsIntegerValue() )
@@ -1504,14 +1505,14 @@ bool RangeOfIds::SetRangeStr( const TCollection_AsciiString& theStr )
     {
       TCollection_AsciiString aMaxStr = tmpStr.Split( aPos );
       TCollection_AsciiString aMinStr = tmpStr;
-      
+
       while ( aMinStr.Search( "-" ) != -1 ) aMinStr.RemoveAll( '-' );
       while ( aMaxStr.Search( "-" ) != -1 ) aMaxStr.RemoveAll( '-' );
 
       if ( !aMinStr.IsEmpty() && !aMinStr.IsIntegerValue() ||
            !aMaxStr.IsEmpty() && !aMaxStr.IsIntegerValue() )
         return false;
-           
+
       myMin.Append( aMinStr.IsEmpty() ? IntegerFirst() : aMinStr.IntegerValue() );
       myMax.Append( aMaxStr.IsEmpty() ? IntegerLast()  : aMaxStr.IntegerValue() );
     }
@@ -1558,7 +1559,7 @@ bool RangeOfIds::IsSatisfy( long theId )
     if ( anElem == 0 || myType != anElem->GetType() && myType != SMDSAbs_All )
       return false;
   }
-    
+
   if ( myIds.Contains( theId ) )
     return true;
 
@@ -1729,10 +1730,10 @@ SMDSAbs_ElementType LogicalBinary::GetType() const
 */
 bool LogicalAND::IsSatisfy( long theId )
 {
-  return 
-    myPredicate1 && 
-    myPredicate2 && 
-    myPredicate1->IsSatisfy( theId ) && 
+  return
+    myPredicate1 &&
+    myPredicate2 &&
+    myPredicate1->IsSatisfy( theId ) &&
     myPredicate2->IsSatisfy( theId );
 }
 
@@ -1743,10 +1744,10 @@ bool LogicalAND::IsSatisfy( long theId )
 */
 bool LogicalOR::IsSatisfy( long theId )
 {
-  return 
-    myPredicate1 && 
-    myPredicate2 && 
-    myPredicate1->IsSatisfy( theId ) || 
+  return
+    myPredicate1 &&
+    myPredicate2 &&
+    myPredicate1->IsSatisfy( theId ) ||
     myPredicate2->IsSatisfy( theId );
 }
 
@@ -1766,7 +1767,7 @@ void Filter::SetPredicate( PredicatePtr thePredicate )
   myPredicate = thePredicate;
 }
 
-template<class TElement, class TIterator, class TPredicate> 
+template<class TElement, class TIterator, class TPredicate>
 inline void FillSequence(const TIterator& theIterator,
                         TPredicate& thePredicate,
                         Filter::TIdSequence& theSequence)
@@ -1783,13 +1784,13 @@ inline void FillSequence(const TIterator& theIterator,
 
 void
 Filter::
-GetElementsId( const SMDS_Mesh* theMesh, 
-              PredicatePtr thePredicate, 
+GetElementsId( const SMDS_Mesh* theMesh,
+              PredicatePtr thePredicate,
               TIdSequence& theSequence )
 {
   theSequence.clear();
 
-  if ( !theMesh || !thePredicate ) 
+  if ( !theMesh || !thePredicate )
     return;
 
   thePredicate->SetMesh( theMesh );
@@ -1829,9 +1830,9 @@ Filter::GetElementsId( const SMDS_Mesh* theMesh,
 
 typedef std::set<SMDS_MeshFace*>                    TMapOfFacePtr;
 
-/*  
+/*
    Internal class Link
-*/ 
+*/
 
 ManifoldPart::Link::Link( SMDS_MeshNode* theNode1,
                           SMDS_MeshNode* theNode2 )
@@ -1868,7 +1869,7 @@ bool ManifoldPart::Link::operator<( const ManifoldPart::Link& x ) const
 
 bool ManifoldPart::IsEqual( const ManifoldPart::Link& theLink1,
                             const ManifoldPart::Link& theLink2 )
-{ 
+{
   return theLink1.IsEqual( theLink2 );
 }
 
@@ -1914,7 +1915,7 @@ bool ManifoldPart::process()
 {
   myMapIds.Clear();
   myMapBadGeomIds.Clear();
-  
+
   myAllFacePtr.clear();
   myAllFacePtrIntDMap.clear();
   if ( !myMesh )
@@ -1946,7 +1947,7 @@ bool ManifoldPart::process()
     if ( fi == aStartIndx )
       isStartTreat = true;
     // as result next time when fi will be equal to aStartIndx
-    
+
     SMDS_MeshFace* aFacePtr = myAllFacePtr[ fi ];
     if ( aMapOfTreated.Contains( aFacePtr->GetID() ) )
       continue;
@@ -1979,7 +1980,7 @@ static void getLinks( const SMDS_MeshFace* theFace,
   SMDS_MeshNode* aNode = 0;
   for ( ; aNodeItr->more() && i <= aNbNode; )
   {
-    
+
     SMDS_MeshNode* aN1 = (SMDS_MeshNode*)aNodeItr->next();
     if ( i == 1 )
       aNode = aN1;
@@ -2003,7 +2004,7 @@ static gp_XYZ getNormale( const SMDS_MeshFace* theFace )
     SMDS_MeshNode* aNode = (SMDS_MeshNode*)aNodeItr->next();
     anArrOfXYZ.SetValue(i, gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
   }
-  
+
   gp_XYZ q1 = anArrOfXYZ.Value(2) - anArrOfXYZ.Value(1);
   gp_XYZ q2 = anArrOfXYZ.Value(3) - anArrOfXYZ.Value(1);
   n  = q1 ^ q2;
@@ -2028,7 +2029,7 @@ bool ManifoldPart::findConnected
   theResFaces.Clear();
   if ( !theAllFacePtrInt.size() )
     return false;
-  
+
   if ( getNormale( theStartFace ).SquareModulus() <= gp::Resolution() )
   {
     myMapBadGeomIds.Add( theStartFace->GetID() );
@@ -2040,7 +2041,7 @@ bool ManifoldPart::findConnected
   theResFaces.Add( theStartFace->GetID() );
   ManifoldPart::TDataMapOfLinkFacePtr aDMapLinkFace;
 
-  expandBoundary( aMapOfBoundary, aSeqOfBoundary, 
+  expandBoundary( aMapOfBoundary, aSeqOfBoundary,
                  aDMapLinkFace, theNonManifold, theStartFace );
 
   bool isDone = false;
@@ -2058,7 +2059,7 @@ bool ManifoldPart::findConnected
 
       ManifoldPart::TVectorOfFacePtr aFaces;
       // find next
-      if ( myIsOnlyManifold && 
+      if ( myIsOnlyManifold &&
            (theNonManifold.find( aLink ) != theNonManifold.end()) )
         continue;
       else
@@ -2082,7 +2083,7 @@ bool ManifoldPart::findConnected
           continue;
         }
       }
-      
+
       // compare normal with normals of neighbor element
       SMDS_MeshFace* aPrevFace = aDMapLinkFace[ aLink ];
       ManifoldPart::TVectorOfFacePtr::iterator pFace = aFaces.begin();
@@ -2101,7 +2102,7 @@ bool ManifoldPart::findConnected
           continue;
         // add new element to connected and extend the boundaries.
         theResFaces.Add( anNextFaceID );
-        expandBoundary( aMapOfBoundary, aSeqOfBoundary, 
+        expandBoundary( aMapOfBoundary, aSeqOfBoundary,
                         aDMapLinkFace, theNonManifold, aNextFace );
         isToReset = true;
       }
@@ -2214,7 +2215,7 @@ ElementsOnSurface::~ElementsOnSurface()
 }
 
 void ElementsOnSurface::SetMesh( const SMDS_Mesh* theMesh )
-{ 
+{
   if ( myMesh == theMesh )
     return;
   myMesh = theMesh;
index 94b59dced6ce99b79cb4cab0c12f4cf0adc8745e..c1d184c3751f74e9ebcf00a1aeaf5dc9c41ae06e 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESH : idl implementation based on 'SMESH' unit's classes
 //
 //  Copyright (C) 2003  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 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 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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 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
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
@@ -78,7 +78,7 @@ typedef map<const SMDS_MeshElement*, vector<TNodeOfNodeListMapItr> > TElemOfVecO
 
 //=======================================================================
 //function : SMESH_MeshEditor
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 SMESH_MeshEditor::SMESH_MeshEditor( SMESH_Mesh* theMesh ):
@@ -98,7 +98,7 @@ bool SMESH_MeshEditor::Remove (const list< int >& theIDs,
 
   SMESHDS_Mesh* aMesh = GetMeshDS();
   set< SMESH_subMesh *> smmap;
-  
+
   list<int>::const_iterator it = theIDs.begin();
   for ( ; it != theIDs.end(); it++ )
   {
@@ -224,8 +224,8 @@ bool SMESH_MeshEditor::InverseDiag (const SMDS_MeshElement * theTria1,
   if (!F2) return false;
 
   //  1 +--+ A  theTria1: ( 1 A B ) A->2 ( 1 2 B ) 1 +--+ A
-  //    | /|    theTria2: ( B A 2 ) B->1 ( 1 A 2 )   |\ |  
-  //    |/ |                                         | \|  
+  //    | /|    theTria2: ( B A 2 ) B->1 ( 1 A 2 )   |\ |
+  //    |/ |                                         | \|
   //  B +--+ 2                                     B +--+ 2
 
   // put nodes in array and find out indices of the same ones
@@ -345,8 +345,8 @@ bool SMESH_MeshEditor::InverseDiag (const SMDS_MeshNode * theNode1,
   if (!F2) return false;
 
   //  1 +--+ A  tr1: ( 1 A B ) A->2 ( 1 2 B ) 1 +--+ A
-  //    | /|    tr2: ( B A 2 ) B->1 ( 1 A 2 )   |\ |  
-  //    |/ |                                    | \|  
+  //    | /|    tr2: ( B A 2 ) B->1 ( 1 A 2 )   |\ |
+  //    |/ |                                    | \|
   //  B +--+ 2                                B +--+ 2
 
   // put nodes in array
@@ -388,7 +388,7 @@ bool SMESH_MeshEditor::InverseDiag (const SMDS_MeshNode * theNode1,
   //MESSAGE( tr1 << tr2 );
 
   return true;
-  
+
 }
 
 //=======================================================================
@@ -489,7 +489,7 @@ bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theElem)
     return false;
 
   switch ( theElem->GetType() ) {
-    
+
   case SMDSAbs_Edge:
   case SMDSAbs_Face:
   {
@@ -542,7 +542,7 @@ bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theElem)
 
 //=======================================================================
 //function : getBadRate
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 static double getBadRate (const SMDS_MeshElement*               theElem,
@@ -552,8 +552,9 @@ static double getBadRate (const SMDS_MeshElement*               theElem,
   if ( !theElem || !theCrit->GetPoints( theElem, P ))
     return 1e100;
   return theCrit->GetBadRate( theCrit->GetValue( P ), theElem->NbNodes() );
+  //return theCrit->GetBadRate( theCrit->GetValue( theElem->GetID() ), theElem->NbNodes() );
 }
-  
+
 //=======================================================================
 //function : QuadToTri
 //purpose  : Cut quadrangles into triangles.
@@ -589,7 +590,7 @@ bool SMESH_MeshEditor::QuadToTri (set<const SMDS_MeshElement*> &       theElems,
     SMDS_FaceOfNodes tr1 ( aNodes[0], aNodes[1], aNodes[2] );
     SMDS_FaceOfNodes tr2 ( aNodes[2], aNodes[3], aNodes[0] );
     aBadRate1 = getBadRate( &tr1, theCrit ) + getBadRate( &tr2, theCrit );
-      
+
     SMDS_FaceOfNodes tr3 ( aNodes[1], aNodes[2], aNodes[3] );
     SMDS_FaceOfNodes tr4 ( aNodes[3], aNodes[0], aNodes[1] );
     aBadRate2 = getBadRate( &tr3, theCrit ) + getBadRate( &tr4, theCrit );
@@ -597,7 +598,7 @@ bool SMESH_MeshEditor::QuadToTri (set<const SMDS_MeshElement*> &       theElems,
     int aShapeId = FindShape( elem );
     //MESSAGE( "aBadRate1 = " << aBadRate1 << "; aBadRate2 = " << aBadRate2
       //      << " ShapeID = " << aShapeId << endl << elem );
-    
+
     if ( aBadRate1 <= aBadRate2 ) {
       // tr1 + tr2 is better
       aMesh->ChangeElementNodes( elem, aNodes, 3 );
@@ -622,6 +623,42 @@ bool SMESH_MeshEditor::QuadToTri (set<const SMDS_MeshElement*> &       theElems,
   return true;
 }
 
+//=======================================================================
+//function : BestSplit
+//purpose  : Find better diagonal for cutting.
+//=======================================================================
+int SMESH_MeshEditor::BestSplit (const SMDS_MeshElement*              theQuad,
+                                 SMESH::Controls::NumericalFunctorPtr theCrit)
+{
+  if (!theCrit.get())
+    return -1;
+
+  if (!theQuad || theQuad->GetType() != SMDSAbs_Face || theQuad->NbNodes() != 4)
+    return -1;
+
+  // retrieve element nodes
+  const SMDS_MeshNode* aNodes [4];
+  SMDS_ElemIteratorPtr itN = theQuad->nodesIterator();
+  int i = 0;
+  while (itN->more())
+    aNodes[ i++ ] = static_cast<const SMDS_MeshNode*>( itN->next() );
+
+  // compare two sets of possible triangles
+  double aBadRate1, aBadRate2; // to what extent a set is bad
+  SMDS_FaceOfNodes tr1 ( aNodes[0], aNodes[1], aNodes[2] );
+  SMDS_FaceOfNodes tr2 ( aNodes[2], aNodes[3], aNodes[0] );
+  aBadRate1 = getBadRate( &tr1, theCrit ) + getBadRate( &tr2, theCrit );
+
+  SMDS_FaceOfNodes tr3 ( aNodes[1], aNodes[2], aNodes[3] );
+  SMDS_FaceOfNodes tr4 ( aNodes[3], aNodes[0], aNodes[1] );
+  aBadRate2 = getBadRate( &tr3, theCrit ) + getBadRate( &tr4, theCrit );
+
+  if (aBadRate1 <= aBadRate2) // tr1 + tr2 is better
+    return 1; // diagonal 1-3
+
+  return 2; // diagonal 2-4
+}
+
 //=======================================================================
 //function : AddToSameGroups
 //purpose  : add elemToAdd to the groups the elemInGroups belongs to
@@ -693,7 +730,7 @@ bool SMESH_MeshEditor::QuadToTri (std::set<const SMDS_MeshElement*> & theElems,
 
 //=======================================================================
 //function : getAngle
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 double getAngle(const SMDS_MeshElement * tr1,
@@ -714,7 +751,7 @@ double getAngle(const SMDS_MeshElement * tr1,
   gp_Vec N2 = gp_Vec( P2(2) - P2(1) ) ^ gp_Vec( P2(3) - P2(1) );
   if ( N2.SquareMagnitude() <= gp::Resolution() )
     return angle;
-  
+
   // find the first diagonal node n1 in the triangles:
   // take in account a diagonal link orientation
   const SMDS_MeshElement *nFirst[2], *tr[] = { tr1, tr2 };
@@ -834,7 +871,7 @@ bool SMESH_MeshEditor::TriToQuad (set<const SMDS_MeshElement*> &       theElems,
       itLE = mapLi_listEl.find( linkID );
       if ( itLE != mapLi_listEl.end() )
       {
-        if ((*itLE).second.size() > 1 ) // consider only 2 elems adjacent by a link 
+        if ((*itLE).second.size() > 1 ) // consider only 2 elems adjacent by a link
           continue;
         const SMDS_MeshElement* elem2 = (*itLE).second.front();
 //         if ( FindShape( elem ) != FindShape( elem2 ))
@@ -864,7 +901,7 @@ bool SMESH_MeshEditor::TriToQuad (set<const SMDS_MeshElement*> &       theElems,
   }
 
   // Algo: fuse triangles into quadrangles
-  
+
   while ( ! mapEl_setLi.empty() )
   {
     // Look for the start element:
@@ -1006,7 +1043,7 @@ bool SMESH_MeshEditor::TriToQuad (set<const SMDS_MeshElement*> &       theElems,
       } // if ( startElem )
     } // while ( startElem || !startLinks.empty() )
   } // while ( ! mapEl_setLi.empty() )
-    
+
   return true;
 }
 
@@ -1096,7 +1133,7 @@ bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh,
   }
   DUMPSO( "========================================");
 
-  
+
   set<int> faceNodes;  // ids of bottom face nodes, to be found
   set<int> checkedId1; // ids of tried 2-nd nodes
   Standard_Real leastDist = DBL_MAX; // dist of the 4-th node from 123 plane
@@ -1115,7 +1152,7 @@ bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh,
         checkedId1.insert ( id1 );
         break;
       }
-  
+
     // Find the 3-d node so that 1-2-3 triangle to be on a hexa face,
     // ie that all but meybe one (id3 which is on the same face) nodes
     // lay on the same side from the triangle plane.
@@ -1216,7 +1253,7 @@ bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh,
     }
   }
 
-    
+
   // Set nodes of the found bottom face in good order
   DUMPSO( " Found bottom face: ");
   i = SortQuadNodes( theMesh, idNodes );
@@ -1240,7 +1277,7 @@ bool SMESH_MeshEditor::SortHexaNodes (const SMDS_Mesh * theMesh,
   Standard_Real upDirSize = upDir.Magnitude();
   if ( upDirSize <= gp::Resolution() ) return false;
   upDir / upDirSize;
-  
+
   // Assure that the bottom face normal points up
   gp_Vec Nb = gp_Vec (P[0], P[1]).Crossed( gp_Vec (P[0], P[2]) );
   Nb += gp_Vec (P[0], P[2]).Crossed( gp_Vec (P[0], P[3]) );
@@ -1473,7 +1510,7 @@ void SMESH_MeshEditor::Smooth (set<const SMDS_MeshElement*> & theElems,
   SMESH::Controls::AspectRatio aQualityFunc;
 
   SMESHDS_Mesh* aMesh = GetMeshDS();
-  
+
   if ( theElems.empty() ) {
     // add all faces to theElems
     SMDS_FaceIteratorPtr fIt = aMesh->facesIterator();
@@ -1568,7 +1605,7 @@ void SMESH_MeshEditor::Smooth (set<const SMDS_MeshElement*> & theElems,
         const SMDS_PositionPtr& pos = node->GetPosition();
         posType = pos.get() ? pos->GetTypeOfPosition() : SMDS_TOP_3DSPACE;
         if (posType != SMDS_TOP_EDGE &&
-            posType != SMDS_TOP_VERTEX && 
+            posType != SMDS_TOP_VERTEX &&
             theFixedNodes.find( node ) == theFixedNodes.end())
         {
           // check if all faces around the node are on faceSubMesh
@@ -1829,7 +1866,7 @@ void SMESH_MeshEditor::Smooth (set<const SMDS_MeshElement*> & theElems,
               }
             }
           }
-        } // loop on nodes on seam 
+        } // loop on nodes on seam
       } // loop on edge of a face
     } // if ( !face.IsNull() )
 
@@ -2159,7 +2196,7 @@ static void makeWalls (SMESHDS_Mesh*                 aMesh,
 
   // Make a ceiling for each element ie an equal element of last new nodes.
   // Find free links of faces - make edges and sweep them into faces.
-  
+
   TElemOfElemListMap::iterator   itElem      = newElemsMap.begin();
   TElemOfVecOfNnlmiMap::iterator itElemNodes = elemNewNodesMap.begin();
   for ( ; itElem != newElemsMap.end(); itElem++, itElemNodes++ )
@@ -2267,7 +2304,7 @@ static void makeWalls (SMESHDS_Mesh*                 aMesh,
     } // sweep free links into faces
 
     // make a ceiling face with a normal external to a volume
-      
+
     SMDS_VolumeTool lastVol( itElem->second.back() );
     int iF = lastVol.GetFaceIndex( aFaceLastNodes );
     if ( iF >= 0 )
@@ -2304,7 +2341,7 @@ static void makeWalls (SMESHDS_Mesh*                 aMesh,
 
 //=======================================================================
 //function : RotationSweep
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor::RotationSweep(set<const SMDS_MeshElement*> & theElems,
@@ -2374,7 +2411,7 @@ void SMESH_MeshEditor::RotationSweep(set<const SMDS_MeshElement*> & theElems,
 }
 //=======================================================================
 //function : ExtrusionSweep
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor::ExtrusionSweep(set<const SMDS_MeshElement*> & theElems,
@@ -2433,7 +2470,7 @@ void SMESH_MeshEditor::ExtrusionSweep(set<const SMDS_MeshElement*> & theElems,
 
 //=======================================================================
 //class    : SMESH_MeshEditor_PathPoint
-//purpose  : auxiliary class 
+//purpose  : auxiliary class
 //=======================================================================
 class SMESH_MeshEditor_PathPoint {
 public:
@@ -2477,9 +2514,9 @@ protected:
 
 //=======================================================================
 //function : ExtrusionAlongTrack
-//purpose  : 
+//purpose  :
 //=======================================================================
-SMESH_MeshEditor::Extrusion_Error 
+SMESH_MeshEditor::Extrusion_Error
   SMESH_MeshEditor::ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & theElements,
                                         SMESH_subMesh* theTrack,
                                         const SMDS_MeshNode* theN1,
@@ -2554,7 +2591,7 @@ SMESH_MeshEditor::Extrusion_Error
   aItN = theTrack->GetFather()->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes();
   const SMDS_MeshNode* aN2 = aItN->next();
 
-  // starting node must be aN1 or aN2 
+  // starting node must be aN1 or aN2
   if ( !( aN1 == theN1 || aN2 == theN1 ) )
     return EXTR_BAD_STARTING_NODE;
 
@@ -2566,7 +2603,7 @@ SMESH_MeshEditor::Extrusion_Error
   for ( j=0; j < aNbTP; ++j ) {
     aAngles[j] = 0.;
   }
-  
+
   if ( theHasAngles ) {
     aItD = theAngles.begin();
     for ( j=1; (aItD != theAngles.end()) && (j<aNbTP); ++aItD, ++j ) {
@@ -2575,7 +2612,7 @@ SMESH_MeshEditor::Extrusion_Error
     }
   }
 
-  // 2. Collect parameters on the track edge  
+  // 2. Collect parameters on the track edge
   aPrms.push_back( aT1 );
   aPrms.push_back( aT2 );
 
@@ -2675,16 +2712,16 @@ SMESH_MeshEditor::Extrusion_Error
     while ( itN->more() ) {
 
       // check if a node has been already processed
-      const SMDS_MeshNode* node = 
+      const SMDS_MeshNode* node =
        static_cast<const SMDS_MeshNode*>( itN->next() );
       TNodeOfNodeListMap::iterator nIt = mapNewNodes.find( node );
       if ( nIt == mapNewNodes.end() ) {
         nIt = mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first;
         list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
-       
+
        // make new nodes
        aX = node->X();  aY = node->Y(); aZ = node->Z();
-       
+
        Standard_Real aAngle1x, aAngleT1T0, aTolAng;
        gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x;
        gp_Ax1 anAx1, anAxT1T0;
@@ -2704,16 +2741,16 @@ SMESH_MeshEditor::Extrusion_Error
          aP1x = aPP1.Pnt();
          aDT1x = aPP1.Tangent();
          aAngle1x = aPP1.Angle();
-         
-         gp_Trsf aTrsf, aTrsfRot, aTrsfRotT1T0; 
+
+         gp_Trsf aTrsf, aTrsfRot, aTrsfRotT1T0;
          // Translation
          gp_Vec aV01x( aP0x, aP1x );
          aTrsf.SetTranslation( aV01x );
-         
+
          // traslated point
          aV1x = aV0x.Transformed( aTrsf );
          aPN1 = aPN0.Transformed( aTrsf );
-         
+
          // rotation 1 [ T1,T0 ]
          aAngleT1T0=-aDT1x.Angle( aDT0x );
          if (fabs(aAngleT1T0) > aTolAng) {
@@ -2721,7 +2758,7 @@ SMESH_MeshEditor::Extrusion_Error
            anAxT1T0.SetLocation( aV1x );
            anAxT1T0.SetDirection( aDT1T0 );
            aTrsfRotT1T0.SetRotation( anAxT1T0, aAngleT1T0 );
-           
+
            aPN1 = aPN1.Transformed( aTrsfRotT1T0 );
          }
 
@@ -2730,7 +2767,7 @@ SMESH_MeshEditor::Extrusion_Error
            anAx1.SetLocation( aV1x );
            anAx1.SetDirection( aDT1x );
            aTrsfRot.SetRotation( anAx1, aAngle1x );
-           
+
            aPN1 = aPN1.Transformed( aTrsfRot );
          }
 
@@ -2740,7 +2777,7 @@ SMESH_MeshEditor::Extrusion_Error
          aZ = aPN1.Z();
          const SMDS_MeshNode* newNode = aMesh->AddNode( aX, aY, aZ );
          listNewNodes.push_back( newNode );
-         
+
          aPN0 = aPN1;
          aP0x = aP1x;
          aV0x = aV1x;
@@ -2752,7 +2789,7 @@ SMESH_MeshEditor::Extrusion_Error
     // make new elements
     sweepElement( aMesh, elem, newNodesItVec, newElemsMap[elem] );
   }
-  
+
   makeWalls( aMesh, mapNewNodes, newElemsMap, mapElemNewNodes, theElements );
 
   return EXTR_OK;
@@ -2760,7 +2797,7 @@ SMESH_MeshEditor::Extrusion_Error
 
 //=======================================================================
 //function : Transform
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor::Transform (set<const SMDS_MeshElement*> & theElems,
@@ -2802,7 +2839,7 @@ void SMESH_MeshEditor::Transform (set<const SMDS_MeshElement*> & theElems,
       const SMDS_MeshNode* node =
         static_cast<const SMDS_MeshNode*>( itN->next() );
       if (nodeMap.find( node ) != nodeMap.end() )
-        continue; 
+        continue;
 
       double coord[3];
       coord[0] = node->X();
@@ -2840,7 +2877,7 @@ void SMESH_MeshEditor::Transform (set<const SMDS_MeshElement*> & theElems,
       theElems.insert( *invElemIt );
   }
 
-  // replicate or reverse elements 
+  // replicate or reverse elements
 
   enum {
     REV_TETRA   = 0,  //  = nbNodes - 4
@@ -2851,12 +2888,12 @@ void SMESH_MeshEditor::Transform (set<const SMDS_MeshElement*> & theElems,
     FORWARD     = 5
     };
   int index[][8] = {
-    { 2, 1, 0, 3, 4, 0, 0, 0 },  // REV_TETRA  
+    { 2, 1, 0, 3, 4, 0, 0, 0 },  // REV_TETRA
     { 2, 1, 0, 3, 4, 0, 0, 0 },  // REV_PYRAMID
-    { 2, 1, 0, 5, 4, 3, 0, 0 },  // REV_PENTA  
-    { 2, 1, 0, 3, 0, 0, 0, 0 },  // REV_FACE   
-    { 2, 1, 0, 3, 6, 5, 4, 7 },  // REV_HEXA   
-    { 0, 1, 2, 3, 4, 5, 6, 7 }   // FORWARD    
+    { 2, 1, 0, 5, 4, 3, 0, 0 },  // REV_PENTA
+    { 2, 1, 0, 3, 0, 0, 0, 0 },  // REV_FACE
+    { 2, 1, 0, 3, 6, 5, 4, 7 },  // REV_HEXA
+    { 0, 1, 2, 3, 4, 5, 6, 7 }   // FORWARD
   };
 
   for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
@@ -2967,7 +3004,7 @@ void SMESH_MeshEditor::Transform (set<const SMDS_MeshElement*> & theElems,
     if ( iNode != nbNodes )
       continue; // not all nodes transformed
 
-    if ( theCopy ) 
+    if ( theCopy )
     {
       // add a new element
       switch ( elemType ) {
@@ -3027,7 +3064,7 @@ void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes
   else
   {
     nodes.insert( nodes.end(), theNodes.begin(), theNodes.end() );
-  }  
+  }
 
   list<const SMDS_MeshNode*>::iterator it2, it1 = nodes.begin();
   for ( ; it1 != nodes.end(); it1++ )
@@ -3058,7 +3095,7 @@ void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes
 
 //=======================================================================
 //function : SimplifyFace
-//purpose  : 
+//purpose  :
 //=======================================================================
 int SMESH_MeshEditor::SimplifyFace (const vector<const SMDS_MeshNode *> faceNodes,
                                     vector<const SMDS_MeshNode *>&      poly_nodes,
@@ -3174,7 +3211,7 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
         elems.insert( invElemIt->next() );
     }
   }
-  // Change element nodes or remove an element 
+  // Change element nodes or remove an element
 
   set<const SMDS_MeshElement*>::iterator eIt = elems.begin();
   for ( ; eIt != elems.end(); eIt++ )
@@ -3340,7 +3377,7 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
           if ( nbRepl == 2 && iRepl[ 1 ] - iRepl [ 0 ] == 3 ) {
             // a bottom node sticks with a linked top one
             // 1.
-            SMDS_MeshElement* newElem = 
+            SMDS_MeshElement* newElem =
               aMesh->AddVolume(curNodes[ 3 ],
                                curNodes[ 4 ],
                                curNodes[ 5 ],
@@ -3416,7 +3453,7 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
                 uniqueNodes[ 3 ] = curNodes[indTop[ 0 ]];
                 nbUniqueNodes = 4;
                 // tetrahedron 2
-                SMDS_MeshElement* newElem = 
+                SMDS_MeshElement* newElem =
                   aMesh->AddVolume(curNodes[ind[ 0 ]],
                                    curNodes[ind[ 3 ]],
                                    curNodes[ind[ 2 ]],
@@ -3534,7 +3571,7 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
       } // switch ( nbNodes )
 
     } // if ( nbNodes != nbUniqueNodes ) // some nodes stick
-    
+
     if ( isOk ) {
       if (elem->IsPoly() && elem->GetType() == SMDSAbs_Volume) {
         // Change nodes of polyedre
@@ -3673,7 +3710,7 @@ const SMDS_MeshElement*
 
 //=======================================================================
 //function : findAdjacentFace
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 static const SMDS_MeshElement* findAdjacentFace(const SMDS_MeshNode* n1,
@@ -3685,10 +3722,10 @@ static const SMDS_MeshElement* findAdjacentFace(const SMDS_MeshNode* n1,
     avoidSet.insert ( elem );
   return SMESH_MeshEditor::FindFaceInSet( n1, n2, elemSet, avoidSet );
 }
-  
+
 //=======================================================================
 //function : findFreeBorder
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 #define ControlFreeBorder SMESH::Controls::FreeEdges::IsFreeEdge
@@ -3834,7 +3871,7 @@ bool SMESH_MeshEditor::CheckFreeBorderNodes(const SMDS_MeshNode* theNode1,
 
 //=======================================================================
 //function : SewFreeBorder
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 SMESH_MeshEditor::Sew_Error
@@ -3868,7 +3905,7 @@ SMESH_MeshEditor::Sew_Error
     aResult = SEW_BORDER1_NOT_FOUND;
   }
   if (theSideIsFreeBorder)
-  { 
+  {
     // Free border 2
     // --------------
     if (!findFreeBorder(theSideFirstNode, theSideSecondNode, theSideThirdNode,
@@ -3927,7 +3964,7 @@ SMESH_MeshEditor::Sew_Error
       toBordSys.SetTransformation( toBordAx );
       fromSide2Sys.SetTransformation( fromSideAx, toGlobalAx );
       fromSide2Sys.SetScaleFactor( Zs.Magnitude() / Zb.Magnitude() );
-      
+
       // move
       for ( nBordIt = bordNodes.begin(); nBordIt != bordNodes.end(); nBordIt++ ) {
         const SMDS_MeshNode* n = *nBordIt;
@@ -4093,7 +4130,7 @@ SMESH_MeshEditor::Sew_Error
          nIt[0]++, nIt[1]++ )
     {
       nodeGroupsToMerge.push_back( list<const SMDS_MeshNode*>() );
-      nodeGroupsToMerge.back().push_back( *nIt[1] ); // to keep 
+      nodeGroupsToMerge.back().push_back( *nIt[1] ); // to keep
       nodeGroupsToMerge.back().push_back( *nIt[0] ); // tp remove
     }
   }
@@ -4150,7 +4187,7 @@ SMESH_MeshEditor::Sew_Error
       double minParam = Min( param[ 0 ][ i[0] ], param[ 1 ][ i[1] ]);
       double maxParam = Max( param[ 0 ][ i[0] ], param[ 1 ][ i[1] ]);
       double minSegLen = Min( nextParam - minParam, maxParam - prevParam );
-          
+
       // choose to insert or to merge nodes
       double du = param[ 1 ][ i[1] ] - param[ 0 ][ i[0] ];
       if ( Abs( du ) <= minSegLen * 0.2 ) {
@@ -4319,7 +4356,7 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
     iNode = i3;
     i3 = i4;
     i4 = iNode;
-  } 
+  }
 
   if (toCreatePoly || theFace->IsPoly()) {
 
@@ -4418,7 +4455,7 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
   // create new elements
   SMESHDS_Mesh *aMesh = GetMeshDS();
   int aShapeId = FindShape( theFace );
-  
+
   i1 = 0; i2 = 1;
   for ( iSplit = 0; iSplit < nbSplits - 1; iSplit++ ) {
     SMDS_MeshElement* newElem = 0;
@@ -4446,7 +4483,7 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement*     theFace,
 
 //=======================================================================
 //function : UpdateVolumes
-//purpose  : 
+//purpose  :
 //=======================================================================
 void SMESH_MeshEditor::UpdateVolumes (const SMDS_MeshNode*        theBetweenNode1,
                                       const SMDS_MeshNode*        theBetweenNode2,
@@ -4527,7 +4564,7 @@ void SMESH_MeshEditor::UpdateVolumes (const SMDS_MeshNode*        theBetweenNode
 
 //=======================================================================
 //function : SewSideElements
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 SMESH_MeshEditor::Sew_Error
@@ -4637,7 +4674,7 @@ SMESH_MeshEditor::Sew_Error
     if ( !volSet->empty() )
     {
       //int nodeSetSize = nodeSet->size();
-      
+
       // loop on given volumes
       for ( vIt = volSet->begin(); vIt != volSet->end(); vIt++ ) {
         SMDS_VolumeTool vol (*vIt);
@@ -4712,7 +4749,7 @@ SMESH_MeshEditor::Sew_Error
               maxNbNodes = nbSharedNodes;
               fIt++;
             }
-            else 
+            else
               freeFaceList.erase( fIt++ ); // here fIt++ occures before erase
           }
           if ( freeFaceList.size() > 1 )
index 0bb91f730c6f4dc91fd5a6d37cab829a070ff4de..0dfd8c09d0ce31e7cba87ae62d5983e0b0a0d5e1 100644 (file)
@@ -74,22 +74,44 @@ class SMESH_MeshEditor {
   // Reverse theElement orientation
 
 
+  /*!
+   * \brief Fuse neighbour triangles into quadrangles.
+   * \param theElems     - The triangles to be fused.
+   * \param theCriterion - Is used to choose a neighbour to fuse with.
+   * \param theMaxAngle  - Is a max angle between element normals at which fusion
+   *                       is still performed; theMaxAngle is mesured in radians.
+   * \retval bool - Success or not.
+   */
   bool TriToQuad (std::set<const SMDS_MeshElement*> &  theElems,
                   SMESH::Controls::NumericalFunctorPtr theCriterion,
                   const double                         theMaxAngle);
-  // Fuse neighbour triangles into quadrangles.
-  // theCriterion is used to choose a neighbour to fuse with.
-  // theMaxAngle is a max angle between element normals at which
-  // fusion is still performed; theMaxAngle is mesured in radians.
 
+  /*!
+   * \brief Split quadrangles into triangles.
+   * \param theElems     - The faces to be splitted.
+   * \param theCriterion - Is used to choose a diagonal for splitting.
+   * \retval bool - Success or not.
+   */
   bool QuadToTri (std::set<const SMDS_MeshElement*> &  theElems,
                   SMESH::Controls::NumericalFunctorPtr theCriterion);
-  // Cut quadrangles into triangles.
-  // theCriterion is used to choose a diagonal to cut
 
+  /*!
+   * \brief Split quadrangles into triangles.
+   * \param theElems  - The faces to be splitted.
+   * \param the13Diag - Is used to choose a diagonal for splitting.
+   * \retval bool - Success or not.
+   */
   bool QuadToTri (std::set<const SMDS_MeshElement*> & theElems,
                   const bool                          the13Diag);
-  // Cut quadrangles into triangles
+
+  /*!
+   * \brief Find better diagonal for splitting.
+   * \param theQuad      - The face to find better splitting of.
+   * \param theCriterion - Is used to choose a diagonal for splitting.
+   * \retval int - 1 for 1-3 diagonal, 2 for 2-4, -1 - for errors.
+   */
+  int BestSplit (const SMDS_MeshElement*              theQuad,
+                 SMESH::Controls::NumericalFunctorPtr theCriterion);
 
 
   enum SmoothMethod { LAPLACIAN = 0, CENTROIDAL };
index 2982dc69e0de324211b5a525a79bef98ed6757e1..1a469b7a85bfb032f53196c06c828f64d62185ec 100644 (file)
@@ -25,6 +25,7 @@
 //  $Header$
 
 #include "SMESHGUI.h"
+
 #include "SMESHGUI_InitMeshDlg.h"
 #include "SMESHGUI_AddSubMeshDlg.h"
 #include "SMESHGUI_NodesDlg.h"
@@ -39,7 +40,6 @@
 #include "SMESHGUI_Preferences_ScalarBarDlg.h"
 #include "SMESHGUI_Preferences_SelectionDlg.h"
 #include "SMESHGUI_Hypotheses.h"
-#include "SMESHGUI_HypothesesUtils.h"
 #include "SMESHGUI_MoveNodesDlg.h"
 #include "SMESHGUI_AddMeshElementDlg.h"
 #include "SMESHGUI_EditHypothesesDlg.h"
 #include "SMESHGUI_Selection.h"
 #include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
 
-#include <SVTK_InteractorStyle.h>
-#include <SVTK_RenderWindowInteractor.h>
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_GEOMGenUtils.h"
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_GroupUtils.h"
+#include "SMESHGUI_FilterUtils.h"
+#include "SMESHGUI_PatternUtils.h"
+#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_HypothesesUtils.h"
 
 #include "SMESH_Actor.h"
 #include "SMESH_Object.h"
 #include "SMESH_TypeFilter.hxx"
 
-#include "SUIT_Tools.h"
-#include "SUIT_MessageBox.h"
-#include "SUIT_ResourceMgr.h"
-#include "SUIT_FileDlg.h"
-#include "SUIT_Desktop.h"
-#include "SUIT_ResourceMgr.h"
-#include "SUIT_OverrideCursor.h"
-#include "SUIT_Study.h"
-#include "SUIT_Session.h"
-
-#include "SALOME_NamingService.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_ListIO.hxx"
-#include <SALOME_LifeCycleCORBA.hxx>
-
-#include "OB_Browser.h"
-
-#include "QtxPopupMgr.h"
-
 #include "SalomeApp_Tools.h"
 #include "SalomeApp_Study.h"
 #include "SalomeApp_NameDlg.h"
 #include "SalomeApp_Application.h"
 #include "SalomeApp_Preferences.h"
 #include "SalomeApp_VTKSelector.h"
-
 #include "SalomeApp_ImportOperation.h"
 
 #include <SVTK_ViewWindow.h>
 #include <SVTK_ViewModel.h>
+#include <SVTK_InteractorStyle.h>
+#include <SVTK_RenderWindowInteractor.h>
 
 #include <VTKViewer_ViewManager.h>
 
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_GEOMGenUtils.h"
-#include "SMESHGUI_MeshUtils.h"
-#include "SMESHGUI_GroupUtils.h"
-#include "SMESHGUI_FilterUtils.h"
-#include "SMESHGUI_PatternUtils.h"
-#include "SMESHGUI_VTKUtils.h"
+#include "OB_Browser.h"
+
+#include "SUIT_Tools.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_FileDlg.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_OverrideCursor.h"
+#include "SUIT_Study.h"
+#include "SUIT_Session.h"
+
+#include "QtxPopupMgr.h"
+
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SALOME_InteractiveObject.hxx"
+#include "SALOME_NamingService.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
 
 #include "SALOMEconfig.h"
 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
 
 // QT Includes
 #define         INCLUDE_MENUITEM_DEF
-#include <qapplication.h>
-#include <qlineedit.h>
-#include <qmenudata.h>
-#include <qmenubar.h>
 #include <qpopupmenu.h>
-#include <qfont.h>
 #include <qstring.h>
-#include <qpainter.h>
-#include <qcheckbox.h>
-#include <qcolordialog.h>
-#include <qspinbox.h>
-#include <qlist.h>
 #include <qwidget.h>
-#include <qevent.h>
 #include <qaction.h>
-#include <qradiobutton.h>
 
+// BOOST Includes
 #include <boost/shared_ptr.hpp>
 
+// VTK Includes
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
 #include <vtkActorCollection.h>
index 16fc4560ad27220085424da9712bad577e18ad2b..2887e3c592a1ba96eb12fbe264bb06f0fa56cbcd 100755 (executable)
 //  Module : SMESH
 
 #include "SMESHGUI_MultiEditDlg.h"
-#include "SMESHGUI_FilterDlg.h"
-#include "SMESHGUI_Filter.h"
 
 #include "SMESHGUI.h"
+#include "SMESHGUI_Filter.h"
+#include "SMESHGUI_FilterDlg.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_FilterUtils.h"
+#include "SMESHGUI_SpinBox.h"
 
 #include "SMESH_Actor.h"
 #include "SMESH_TypeFilter.hxx"
 #include <vtkDataSetMapper.h>
 
 // QT Includes
-#include <qcheckbox.h>
 #include <qframe.h>
-#include <qgroupbox.h>
 #include <qlabel.h>
 #include <qlayout.h>
-#include <qlineedit.h>
 #include <qlistbox.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qgroupbox.h>
+#include <qlineedit.h>
 #include <qpushbutton.h>
 #include <qapplication.h>
-#include <qhbuttongroup.h>
 #include <qradiobutton.h>
+#include <qhbuttongroup.h>
 
 // IDL Headers
 #include "SALOMEconfig.h"
@@ -105,9 +108,9 @@ SMESHGUI_MultiEditDlg
                        const int theMode,
                        const bool the3d2d,
                        const char* theName):
-  QDialog(SMESH::GetDesktop(theModule), 
-         theName, 
-         false, 
+  QDialog(SMESH::GetDesktop(theModule),
+         theName,
+         false,
          WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
     mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
     mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
@@ -158,7 +161,6 @@ QFrame* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool t
   myListBox = new QListBox(aFrame);
   myListBox->setSelectionMode(QListBox::Extended);
   myListBox->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
-//  myListBox->setColumnMode(QListBox::FitToHeight);
   myListBox->installEventFilter(this);
 
   myFilterBtn = new QPushButton(tr("FILTER")   , aFrame);
@@ -178,6 +180,29 @@ QFrame* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool t
 
   myToAllChk = new QCheckBox(tr("TO_ALL"), mySelGrp);
 
+  // Split/Join criterion group
+  myCriterionGrp = new QGroupBox(3, Qt::Vertical, tr("SPLIT_JOIN_CRITERION"), aMainGrp);
+
+  myGroupChoice = new QButtonGroup(3, Qt::Vertical, myCriterionGrp);
+  myGroupChoice->setInsideMargin(0);
+  myGroupChoice->setFrameStyle(QFrame::NoFrame);
+  (new QRadioButton(tr("USE_DIAGONAL_1_3"), myGroupChoice))->setChecked(true);
+  (new QRadioButton(tr("USE_DIAGONAL_2_4"), myGroupChoice));
+  (new QRadioButton(tr("USE_NUMERIC_FUNC"), myGroupChoice));
+
+  myComboBoxFunctor = new QComboBox(myCriterionGrp);
+  myComboBoxFunctor->insertItem(tr("ASPECTRATIO_ELEMENTS"));
+  myComboBoxFunctor->insertItem(tr("MINIMUMANGLE_ELEMENTS"));
+  myComboBoxFunctor->insertItem(tr("SKEW_ELEMENTS"));
+  myComboBoxFunctor->insertItem(tr("AREA_ELEMENTS"));
+  //myComboBoxFunctor->insertItem(tr("LENGTH2D_EDGES")); // for existing elements only
+  //myComboBoxFunctor->insertItem(tr("MULTI2D_BORDERS")); // for existing elements only
+  myComboBoxFunctor->setCurrentItem(0);
+
+  myCriterionGrp->hide();
+  myGroupChoice->hide();
+  myComboBoxFunctor->setEnabled(false);
+
   // "Select from" group
   QGroupBox* aGrp = new QGroupBox(3, Qt::Horizontal, tr("SELECT_FROM"), aMainGrp);
 
@@ -187,7 +212,7 @@ QFrame* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool t
   mySubmesh->setReadOnly(true);
   mySubmeshBtn->setPixmap(aPix);
 
-  myGroupChk = new QCheckBox(tr("GROUP"), aGrp);
+  myGroupChk = new QCheckBox(tr("SMESH_GROUP"), aGrp);
   myGroupBtn = new QPushButton(aGrp);
   myGroup = new QLineEdit(aGrp);
   myGroup->setReadOnly(true);
@@ -258,6 +283,39 @@ bool SMESHGUI_MultiEditDlg::eventFilter (QObject* object, QEvent* event)
   return QDialog::eventFilter(object, event);
 }
 
+//=======================================================================
+// name    : SMESHGUI_MultiEditDlg::getNumericalFunctor
+// Purpose :
+//=======================================================================
+SMESH::NumericalFunctor_ptr SMESHGUI_MultiEditDlg::getNumericalFunctor()
+{
+  SMESH::NumericalFunctor_var aNF = SMESH::NumericalFunctor::_nil();
+
+  SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
+  if (aFilterMgr->_is_nil())
+    return aNF._retn();
+
+  if (myComboBoxFunctor->currentText() == tr("ASPECTRATIO_ELEMENTS"))
+    aNF = aFilterMgr->CreateAspectRatio();
+  else if (myComboBoxFunctor->currentText() == tr("WARP_ELEMENTS"))
+    aNF = aFilterMgr->CreateWarping();
+  else if (myComboBoxFunctor->currentText() == tr("MINIMUMANGLE_ELEMENTS"))
+    aNF = aFilterMgr->CreateMinimumAngle();
+  else if (myComboBoxFunctor->currentText() == tr("TAPER_ELEMENTS"))
+    aNF = aFilterMgr->CreateTaper();
+  else if (myComboBoxFunctor->currentText() == tr("SKEW_ELEMENTS"))
+    aNF = aFilterMgr->CreateSkew();
+  else if (myComboBoxFunctor->currentText() == tr("AREA_ELEMENTS"))
+    aNF = aFilterMgr->CreateArea();
+  else if (myComboBoxFunctor->currentText() == tr("LENGTH2D_EDGES"))
+    aNF = aFilterMgr->CreateLength2D();
+  else if (myComboBoxFunctor->currentText() == tr("MULTI2D_BORDERS"))
+    aNF = aFilterMgr->CreateMultiConnection2D();
+  else ;
+
+  return aNF._retn();
+}
+
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::Init
 // Purpose : Init dialog fields, connect signals and slots, show dialog
@@ -932,14 +990,14 @@ int SMESHGUI_MultiEditDlg::entityType()
   return myEntityType;
 }
 
-/*
+/*!
  *  Class       : SMESHGUI_ChangeOrientationDlg
  *  Description : Modification of orientation of faces
  */
 
 SMESHGUI_ChangeOrientationDlg
 ::SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
-                               const char* theName): 
+                               const char* theName):
   SMESHGUI_MultiEditDlg(theModule, SMESHGUI_FaceFilter, true, theName)
 {
   setCaption(tr("CAPTION"));
@@ -966,6 +1024,21 @@ SMESHGUI_UnionOfTrianglesDlg
   SMESHGUI_MultiEditDlg(theModule, SMESHGUI_TriaFilter, false, theName)
 {
   setCaption(tr("CAPTION"));
+
+  myComboBoxFunctor->setEnabled(true);
+  myComboBoxFunctor->insertItem(tr("WARP_ELEMENTS")); // for quadrangles only
+  myComboBoxFunctor->insertItem(tr("TAPER_ELEMENTS")); // for quadrangles only
+
+  // Maximum angle
+  QGroupBox* aMaxAngleGrp = new QGroupBox (2, Qt::Horizontal, myCriterionGrp);
+  aMaxAngleGrp->setInsideMargin(0);
+  aMaxAngleGrp->setFrameStyle(QFrame::NoFrame);
+  new QLabel (tr("MAXIMUM_ANGLE"), aMaxAngleGrp);
+  myMaxAngleSpin = new SMESHGUI_SpinBox (aMaxAngleGrp);
+  myMaxAngleSpin->RangeStepAndValidator(0, 180.0, 1.0, 3);
+  myMaxAngleSpin->SetValue(30.0);
+
+  myCriterionGrp->show();
 }
 
 SMESHGUI_UnionOfTrianglesDlg::~SMESHGUI_UnionOfTrianglesDlg()
@@ -975,12 +1048,15 @@ SMESHGUI_UnionOfTrianglesDlg::~SMESHGUI_UnionOfTrianglesDlg()
 bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
                                             const SMESH::long_array&    theIds)
 {
-  return theEditor->TriToQuad(theIds, SMESH::NumericalFunctor::_nil(), 1.);
+  SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
+  double aMaxAngle = myMaxAngleSpin->GetValue() * PI / 180.0;
+  return theEditor->TriToQuad(theIds, aCriterion, aMaxAngle);
 }
 
+
 /*!
  *  Class       : SMESHGUI_CuttingOfQuadsDlg
- *  Description : Construction of quadrangles by automatic association of triangles
+ *  Description : Automatic splitting of quadrangles into triangles
  */
 
 SMESHGUI_CuttingOfQuadsDlg
@@ -991,12 +1067,16 @@ SMESHGUI_CuttingOfQuadsDlg
   setCaption(tr("CAPTION"));
   myPreviewActor = 0;
 
-  myUseDiagChk = new QCheckBox (tr("USE_DIAGONAL_2_4"), mySelGrp);
   myPreviewChk = new QCheckBox (tr("PREVIEW"), mySelGrp);
 
-  connect(myPreviewChk, SIGNAL(stateChanged(int)),    this, SLOT(onPreviewChk()));
-  connect(myUseDiagChk, SIGNAL(stateChanged(int)),    this, SLOT(onPreviewChk()));
-  connect(this,         SIGNAL(ListContensChanged()), this, SLOT(onPreviewChk()));
+  myCriterionGrp->show();
+  myGroupChoice->show();
+  myComboBoxFunctor->setEnabled(false);
+
+  connect(myPreviewChk     , SIGNAL(stateChanged(int))   , this, SLOT(onPreviewChk()));
+  connect(myGroupChoice    , SIGNAL(clicked(int))        , this, SLOT(onCriterionRB()));
+  connect(myComboBoxFunctor, SIGNAL(activated(int))      , this, SLOT(onPreviewChk()));
+  connect(this             , SIGNAL(ListContensChanged()), this, SLOT(onPreviewChk()));
 }
 
 SMESHGUI_CuttingOfQuadsDlg::~SMESHGUI_CuttingOfQuadsDlg()
@@ -1012,7 +1092,27 @@ void SMESHGUI_CuttingOfQuadsDlg::onClose()
 bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
                                           const SMESH::long_array&    theIds)
 {
-  return theEditor->SplitQuad(theIds, !myUseDiagChk->isChecked());
+  switch (myGroupChoice->id(myGroupChoice->selected())) {
+  case 0: // use diagonal 1-3
+    return theEditor->SplitQuad(theIds, true);
+  case 1: // use diagonal 2-4
+    return theEditor->SplitQuad(theIds, false);
+  default: // use numeric functor
+    break;
+  }
+
+  SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
+  return theEditor->QuadToTri(theIds, aCriterion);
+}
+
+void SMESHGUI_CuttingOfQuadsDlg::onCriterionRB()
+{
+  if (myGroupChoice->id(myGroupChoice->selected()) == 2) // Use numeric functor
+    myComboBoxFunctor->setEnabled(true);
+  else
+    myComboBoxFunctor->setEnabled(false);
+
+  onPreviewChk();
 }
 
 void SMESHGUI_CuttingOfQuadsDlg::onPreviewChk()
@@ -1032,7 +1132,7 @@ void SMESHGUI_CuttingOfQuadsDlg::erasePreview()
   myPreviewActor->Delete();
   myPreviewActor = 0;
 }
-
+  
 void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
 {
   if (myActor == 0)
@@ -1050,7 +1150,16 @@ void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
   if (aMesh == 0)
     return;
 
-  bool isDiag24 = myUseDiagChk->isChecked();
+  // 0 - use diagonal 1-3, 1 - use diagonal 2-4, 2 - use numerical functor
+  int aChoice = myGroupChoice->id(myGroupChoice->selected());
+  SMESH::NumericalFunctor_var aCriterion  = SMESH::NumericalFunctor::_nil();
+  SMESH::SMESH_MeshEditor_var aMeshEditor = SMESH::SMESH_MeshEditor::_nil();
+  if (aChoice == 2) {
+    aCriterion  = getNumericalFunctor();
+    aMeshEditor = myMesh->GetMeshEditor();
+    if (aMeshEditor->_is_nil())
+      return;
+  }
 
   //Create grid
   vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
@@ -1082,8 +1191,9 @@ void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
 
     SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
     int k = 0;
-    while(anIter->more())
-      if (const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next())
+    while (anIter->more()) {
+      const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(anIter->next());
+      if (aNode)
       {
         if (!anIdToVtk.IsBound(aNode->GetID()))
         {
@@ -1093,11 +1203,33 @@ void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
 
         aNodes[ k++ ] = aNode->GetID();
       }
+    }
 
     if (k != 4)
       continue;
 
-    if (!isDiag24)
+    bool isDiag13 = true;
+    if (aChoice == 0) // use diagonal 1-3
+    {
+      isDiag13 = true;
+    }
+    else if (aChoice == 1) // use diagonal 2-4
+    {
+      isDiag13 = false;
+    }
+    else // use numerical functor
+    {
+      // compare two sets of possible triangles
+      int diag = aMeshEditor->BestSplit(anElemIds[i], aCriterion);
+      if (diag == 1) // 1-3
+        isDiag13 = true;
+      else if (diag == 2) // 2-4
+        isDiag13 = false;
+      else // error
+        continue;
+    }
+
+    if (isDiag13)
     {
       anIdList->SetId(0, anIdToVtk(aNodes[ 0 ]));
       anIdList->SetId(1, anIdToVtk(aNodes[ 1 ]));
index 09134549338501707bdb0cc7ea885e0d0fd8d8e7..e66ebc0f24c20b330f8863b423306e7f80397be5 100755 (executable)
@@ -1,21 +1,21 @@
 //  Copyright (C) 2003  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 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 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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 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
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(SMESH_Filter)
 
+class SMESHGUI;
 class SMESHGUI_FilterDlg;
-class QCheckBox;
-class QGroupBox;
-class QListBox;
-class QFrame;
-class QLineEdit;
 class SMESHGUI_SpinBox;
-class QPushButton;
-class QButtonGroup;
-class QObject;
 
 class SMESH_Actor;
-class SALOME_Actor;
-class SalomeApp_SelectionMgr;
 
-class SMESHGUI;
-class SMESH_Actor;
+class SalomeApp_SelectionMgr;
+class SALOME_Actor;
 class SVTK_Selector;
 class SVTK_ViewWindow;
 
-/*
-  Class       : SMESHGUI_MultiEditDlg
-  Description : Base class for dialogs of diagonal inversion and 
-                union of two neighboring triangles
-*/
+class QFrame;
+class QObject;
+class QListBox;
+class QComboBox;
+class QCheckBox;
+class QGroupBox;
+class QLineEdit;
+class QPushButton;
+class QButtonGroup;
+
+/*!
+ * Class       : SMESHGUI_MultiEditDlg
+ * Description : Base class for dialogs of diagonal inversion and
+ *               union of two neighboring triangles
+ */
 
 class SMESHGUI_MultiEditDlg : public QDialog
-{ 
+{
   Q_OBJECT
 
 public:
@@ -73,7 +75,7 @@ public:
                                                  const char* = 0 );
   virtual                   ~SMESHGUI_MultiEditDlg();
 
-  void                      Init() ;
+  void                      Init();
 
   bool                      eventFilter( QObject* object, QEvent* event );
 
@@ -81,14 +83,13 @@ signals:
   void                      ListContensChanged();
 
 protected slots:
-
   void                      onOk();
   virtual bool              onApply();
   virtual void              onClose();
 
   void                      onDeactivate();
   void                      onSelectionDone();
-  
+
   void                      onFilterBtn();
   void                      onAddBtn();
   void                      onRemoveBtn();
@@ -99,11 +100,12 @@ protected slots:
   virtual void              onToAllChk();
   void                      onFilterAccepted();
   void                      on3d2dChanged(int);
-  
-protected:
 
+  SMESH::NumericalFunctor_ptr getNumericalFunctor();
+
+protected:
   void                      closeEvent( QCloseEvent* e ) ;
-  void                      enterEvent ( QEvent * ) ;            
+  void                      enterEvent ( QEvent * ) ;
   void                      hideEvent ( QHideEvent * );                        /* ESC key */
   QFrame*                   createButtonFrame( QWidget* );
   QFrame*                   createMainFrame  ( QWidget*, const bool );
@@ -114,38 +116,41 @@ protected:
   virtual bool              isIdValid( const int theID ) const;
   virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& ) = 0;
   int                       entityType();
-  
-protected:
 
+protected:
   QPushButton*              myOkBtn;
   QPushButton*              myApplyBtn;
   QPushButton*              myCloseBtn;
   SMESH_Actor*              myActor;
   SMESH::SMESH_Mesh_var     myMesh;
-  
+
   SalomeApp_SelectionMgr*   mySelectionMgr;
   SVTK_Selector*            mySelector;
   SMESHGUI*                 mySMESHGUI;
 
   QGroupBox*                mySelGrp;
-  
+  QGroupBox*                myCriterionGrp;
+
+  QButtonGroup*             myGroupChoice;
+  QComboBox*                myComboBoxFunctor;
+
   QListBox*                 myListBox;
   QPushButton*              myFilterBtn;
   QPushButton*              myAddBtn;
   QPushButton*              myRemoveBtn;
   QPushButton*              mySortBtn;
-  
+
   QCheckBox*                myToAllChk;
   QButtonGroup*             myEntityTypeGrp;
-  
+
   QCheckBox*                mySubmeshChk;
   QPushButton*              mySubmeshBtn;
   QLineEdit*                mySubmesh;
-  
+
   QCheckBox*                myGroupChk;
   QPushButton*              myGroupBtn;
   QLineEdit*                myGroup;
-  
+
   SMESHGUI_FilterDlg*       myFilterDlg;
   TColStd_MapOfInteger      myIds;
   int                       myFilterType;
@@ -153,40 +158,41 @@ protected:
   int                       myEntityType;
 };
 
-/*
-  Class       : SMESHGUI_ChangeOrientationDlg
-  Description : Modification of orientation of faces
-*/
+/*!
* Class       : SMESHGUI_ChangeOrientationDlg
* Description : Modification of orientation of faces
+ */
 class  SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg
-{ 
+{
   Q_OBJECT
 
 public:
-                            SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
-                                                         const char* = 0);
-  virtual                   ~SMESHGUI_ChangeOrientationDlg();
+               SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule,
+                                            const char* = 0);
+  virtual      ~SMESHGUI_ChangeOrientationDlg();
 
 protected:
-
-  virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
+  virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
 };
 
-/*
-  Class       : SMESHGUI_UnionOfTrianglesDlg
-  Description : Construction of quadrangles by automatic association of triangles
-*/
+/*!
* Class       : SMESHGUI_UnionOfTrianglesDlg
* Description : Construction of quadrangles by automatic association of triangles
+ */
 class  SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg
 {
   Q_OBJECT
 
 public:
-                            SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule,
-                                                        const char* = 0);
-  virtual                   ~SMESHGUI_UnionOfTrianglesDlg();
+               SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule,
+                                           const char* = 0);
+  virtual      ~SMESHGUI_UnionOfTrianglesDlg();
 
 protected:
+  virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
 
-  virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
+private:
+  SMESHGUI_SpinBox* myMaxAngleSpin;
 };
 
 /*
@@ -198,25 +204,25 @@ class  SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg
   Q_OBJECT
 
 public:
-                            SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule,
-                                                      const char* = 0);
-  virtual                   ~SMESHGUI_CuttingOfQuadsDlg();
+                SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule,
+                                          const char* = 0);
+  virtual       ~SMESHGUI_CuttingOfQuadsDlg();
 
 protected:
-  virtual bool              process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
-  
+  virtual bool  process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
+
 protected slots:
-  virtual void              onClose();
-  void                      onPreviewChk();
+  virtual void  onClose();
+  void          onCriterionRB();
+  void          onPreviewChk();
 
 private:
-  void                      displayPreview();
-  void                      erasePreview();
-  
+  void          displayPreview();
+  void          erasePreview();
+
 private:
-  QCheckBox*                myUseDiagChk;
-  SALOME_Actor*             myPreviewActor;
-  QCheckBox*                myPreviewChk;
+  SALOME_Actor* myPreviewActor;
+  QCheckBox*    myPreviewChk;
 };
 
 #endif
index 5b353db564e4b202c3910e9707e2a5c1e008cec0..65291e2f8c71fd1cb95c1151fb293d7d50d89939 100644 (file)
@@ -1346,24 +1346,33 @@ msgstr "Sort list"
 msgid "SMESHGUI_MultiEditDlg::TO_ALL"
 msgstr "Apply to all"
 
+msgid "SMESHGUI_MultiEditDlg::SPLIT_JOIN_CRITERION"
+msgstr "Criterion"
+
+msgid "SMESHGUI_MultiEditDlg::USE_DIAGONAL_1_3"
+msgstr "Use diagonal 1-3"
+
+msgid "SMESHGUI_MultiEditDlg::USE_DIAGONAL_2_4"
+msgstr "Use diagonal 2-4"
+
+msgid "SMESHGUI_MultiEditDlg::USE_NUMERIC_FUNC"
+msgstr "Use numeric functor"
+
 msgid "SMESHGUI_MultiEditDlg::SELECT_FROM"
 msgstr "Select from"
 
-msgid "SMESHGUI_MultiEditDlg::GROUP"
-msgstr "Group"
-
 msgid "SMESHGUI_ChangeOrientationDlg::CAPTION"
 msgstr "Modification of orientation"
 
 msgid "SMESHGUI_UnionOfTrianglesDlg::CAPTION"
 msgstr "Union of triangles"
 
+msgid "SMESHGUI_UnionOfTrianglesDlg::MAXIMUM_ANGLE"
+msgstr "Maximum bending angle"
+
 msgid "SMESHGUI_CuttingOfQuadsDlg::CAPTION"
 msgstr "Cutting of quadrangles"
 
-msgid "SMESHGUI_CuttingOfQuadsDlg::USE_DIAGONAL_2_4"
-msgstr "Use diagonal 2-4"
-
 msgid "SMESHGUI_CuttingOfQuadsDlg::PREVIEW"
 msgstr "Preview"
 
index 2c444819c7bbabe0ebd1f1af78b0a5bfd020426f..0c46be9fe4b994850d2c7639fea6db5369e61fc3 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //
 //  Copyright (C) 2003  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 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 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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 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
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
@@ -49,7 +49,7 @@ using namespace std;
 
 //=======================================================================
 //function : addAxis
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 static TCollection_AsciiString& addAxis(TCollection_AsciiString&  theStr,
@@ -67,7 +67,7 @@ static TCollection_AsciiString& addAxis(TCollection_AsciiString&  theStr,
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -78,7 +78,7 @@ SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESH_Mesh* theMesh)
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -104,7 +104,7 @@ CORBA::Boolean
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -129,7 +129,7 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -153,7 +153,7 @@ CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes)
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -216,7 +216,7 @@ CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes)
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -242,7 +242,7 @@ CORBA::Boolean SMESH_MeshEditor_i::AddVolume(const SMESH::
 #ifdef _DEBUG_
   SMESH_Gen_i::AddToCurrentPyScript( "print \"AddVolume: \", isDone" );
 #endif
-  
+
   return true;
 };
 
@@ -316,7 +316,7 @@ CORBA::Boolean SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -328,7 +328,7 @@ CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long   NodeID,
   const SMDS_MeshNode * node = GetMeshDS()->FindNode( NodeID );
   if ( !node )
     return false;
-  
+
   GetMeshDS()->MoveNode(node, x, y, z);
 
   // Update Python script
@@ -344,7 +344,7 @@ CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long   NodeID,
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -368,7 +368,7 @@ CORBA::Boolean SMESH_MeshEditor_i::InverseDiag(CORBA::Long NodeID1,
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -392,7 +392,7 @@ CORBA::Boolean SMESH_MeshEditor_i::DeleteDiag(CORBA::Long NodeID1,
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -417,7 +417,7 @@ CORBA::Boolean SMESH_MeshEditor_i::Reorient(const SMESH::long_array & IDsOfEleme
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -440,14 +440,12 @@ CORBA::Boolean SMESH_MeshEditor_i::ReorientObject(SMESH::SMESH_IDSource_ptr theO
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
-
-CORBA::Boolean
-  SMESH_MeshEditor_i::TriToQuad (const SMESH::long_array &   IDsOfElements,
-                                 SMESH::NumericalFunctor_ptr Criterion,
-                                 CORBA::Double               MaxAngle)
+CORBA::Boolean SMESH_MeshEditor_i::TriToQuad (const SMESH::long_array &   IDsOfElements,
+                                              SMESH::NumericalFunctor_ptr Criterion,
+                                              CORBA::Double               MaxAngle)
 {
   set<const SMDS_MeshElement*> faces;
   for (int i = 0; i < IDsOfElements.length(); i++)
@@ -457,7 +455,7 @@ CORBA::Boolean
     if ( elem && elem->GetType() == SMDSAbs_Face)
       faces.insert( elem );
   }
-  SMESH::NumericalFunctor_i* aNumericalFunctor = 
+  SMESH::NumericalFunctor_i* aNumericalFunctor =
     dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() );
   SMESH::Controls::NumericalFunctorPtr aCrit;
   if ( !aNumericalFunctor )
@@ -468,8 +466,8 @@ CORBA::Boolean
   // Update Python script
   TCollection_AsciiString str ("isDone = mesh_editor.TriToQuad(");
   SMESH_Gen_i::AddArray( str, IDsOfElements ) += ", None, ";
-  str += (Standard_Real) MaxAngle;
-  SMESH_Gen_i::AddToCurrentPyScript( str + ")" );
+  str += TCollection_AsciiString((Standard_Real) MaxAngle) + ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
 #ifdef _DEBUG_
   SMESH_Gen_i::AddToCurrentPyScript( "print \"TriToQuad: \", isDone" );
 #endif
@@ -480,14 +478,12 @@ CORBA::Boolean
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
-
-CORBA::Boolean
-  SMESH_MeshEditor_i::TriToQuadObject (SMESH::SMESH_IDSource_ptr   theObject,
-                                      SMESH::NumericalFunctor_ptr Criterion,
-                                      CORBA::Double               MaxAngle)
+CORBA::Boolean SMESH_MeshEditor_i::TriToQuadObject (SMESH::SMESH_IDSource_ptr   theObject,
+                                                    SMESH::NumericalFunctor_ptr Criterion,
+                                                    CORBA::Double               MaxAngle)
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   CORBA::Boolean isDone = TriToQuad(anElementsId, Criterion, MaxAngle);
@@ -502,8 +498,8 @@ CORBA::Boolean
   // Update Python script
   TCollection_AsciiString str ("isDone = mesh_editor.TriToQuadObject(");
   SMESH_Gen_i::AddObject( str, theObject ) += ", None, ";
-  str += (Standard_Real) MaxAngle;
-  SMESH_Gen_i::AddToCurrentPyScript( str + ")" );
+  str += TCollection_AsciiString((Standard_Real) MaxAngle) + ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
 #ifdef _DEBUG_
   SMESH_Gen_i::AddToCurrentPyScript( "print \"TriToQuadObject: \", isDone" );
 #endif
@@ -513,13 +509,11 @@ CORBA::Boolean
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
-
-CORBA::Boolean
-  SMESH_MeshEditor_i::QuadToTri(const SMESH::long_array &   IDsOfElements,
-                                SMESH::NumericalFunctor_ptr Criterion)
+CORBA::Boolean SMESH_MeshEditor_i::QuadToTri (const SMESH::long_array &   IDsOfElements,
+                                              SMESH::NumericalFunctor_ptr Criterion)
 {
   set<const SMDS_MeshElement*> faces;
   for (int i = 0; i < IDsOfElements.length(); i++)
@@ -529,7 +523,7 @@ CORBA::Boolean
     if ( elem && elem->GetType() == SMDSAbs_Face)
       faces.insert( elem );
   }
-  SMESH::NumericalFunctor_i* aNumericalFunctor = 
+  SMESH::NumericalFunctor_i* aNumericalFunctor =
     dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() );
   SMESH::Controls::NumericalFunctorPtr aCrit;
   if ( !aNumericalFunctor )
@@ -540,7 +534,7 @@ CORBA::Boolean
 
   // Update Python script
   TCollection_AsciiString str ("isDone = mesh_editor.QuadToTri(");
-  SMESH_Gen_i::AddArray( str, IDsOfElements ) += ", None )";
+  SMESH_Gen_i::AddArray( str, IDsOfElements ) += ", None )";
   SMESH_Gen_i::AddToCurrentPyScript( str );
 #ifdef _DEBUG_
   SMESH_Gen_i::AddToCurrentPyScript( "print \"QuadToTri: \", isDone" );
@@ -552,13 +546,40 @@ CORBA::Boolean
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
+CORBA::Boolean SMESH_MeshEditor_i::QuadToTriObject (SMESH::SMESH_IDSource_ptr   theObject,
+                                                    SMESH::NumericalFunctor_ptr Criterion)
+{
+  SMESH::long_array_var anElementsId = theObject->GetIDs();
+  CORBA::Boolean isDone = QuadToTri(anElementsId, Criterion);
 
-CORBA::Boolean
-  SMESH_MeshEditor_i::SplitQuad(const SMESH::long_array & IDsOfElements,
-                                CORBA::Boolean            Diag13)
+  // Clear python line(s), created by QuadToTri()
+  SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#ifdef _DEBUG_
+  aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
+#endif
+
+  // Update Python script
+  TCollection_AsciiString str ("isDone = mesh_editor.QuadToTriObject(");
+  SMESH_Gen_i::AddObject( str, theObject ) += ", None )";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
+#ifdef _DEBUG_
+  SMESH_Gen_i::AddToCurrentPyScript( "print \"QuadToTriObject: \", isDone" );
+#endif
+
+  return isDone;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+CORBA::Boolean SMESH_MeshEditor_i::SplitQuad (const SMESH::long_array & IDsOfElements,
+                                              CORBA::Boolean            Diag13)
 {
   set<const SMDS_MeshElement*> faces;
   for (int i = 0; i < IDsOfElements.length(); i++)
@@ -572,8 +593,8 @@ CORBA::Boolean
   // Update Python script
   TCollection_AsciiString str ("isDone = mesh_editor.SplitQuad(");
   SMESH_Gen_i::AddArray( str, IDsOfElements ) += ", ";
-  str += TCollection_AsciiString( Diag13 );
-  SMESH_Gen_i::AddToCurrentPyScript( str + ")" );
+  str += TCollection_AsciiString( Diag13 ) + ")";
+  SMESH_Gen_i::AddToCurrentPyScript( str );
 #ifdef _DEBUG_
   SMESH_Gen_i::AddToCurrentPyScript( "print \"SplitQuad: \", isDone" );
 #endif
@@ -584,13 +605,11 @@ CORBA::Boolean
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
-
-CORBA::Boolean
-  SMESH_MeshEditor_i::SplitQuadObject(SMESH::SMESH_IDSource_ptr theObject,
-                                     CORBA::Boolean            Diag13)
+CORBA::Boolean SMESH_MeshEditor_i::SplitQuadObject (SMESH::SMESH_IDSource_ptr theObject,
+                                                    CORBA::Boolean            Diag13)
 {
   SMESH::long_array_var anElementsId = theObject->GetIDs();
   CORBA::Boolean isDone = SplitQuad(anElementsId, Diag13);
@@ -614,9 +633,34 @@ CORBA::Boolean
   return isDone;
 }
 
+//=============================================================================
+/*!
+ *  BestSplit
+ */
+//=============================================================================
+CORBA::Long SMESH_MeshEditor_i::BestSplit (CORBA::Long                 IDOfQuad,
+                                           SMESH::NumericalFunctor_ptr Criterion)
+{
+  const SMDS_MeshElement* quad = GetMeshDS()->FindElement(IDOfQuad);
+  if (quad && quad->GetType() == SMDSAbs_Face && quad->NbNodes() == 4)
+  {
+    SMESH::NumericalFunctor_i* aNumericalFunctor =
+      dynamic_cast<SMESH::NumericalFunctor_i*>(SMESH_Gen_i::GetServant(Criterion).in());
+    SMESH::Controls::NumericalFunctorPtr aCrit;
+    if (aNumericalFunctor)
+      aCrit = aNumericalFunctor->GetNumericalFunctor();
+    else
+      aCrit.reset(new SMESH::Controls::AspectRatio());
+
+    ::SMESH_MeshEditor anEditor (_myMesh);
+    return anEditor.BestSplit(quad, aCrit);
+  }
+  return -1;
+}
+
 //=======================================================================
 //function : Smooth
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 CORBA::Boolean
@@ -632,7 +676,7 @@ CORBA::Boolean
 
 //=======================================================================
 //function : SmoothParametric
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 CORBA::Boolean
@@ -648,7 +692,7 @@ CORBA::Boolean
 
 //=======================================================================
 //function : SmoothObject
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 CORBA::Boolean
@@ -664,7 +708,7 @@ CORBA::Boolean
 
 //=======================================================================
 //function : SmoothParametricObject
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 CORBA::Boolean
@@ -680,7 +724,7 @@ CORBA::Boolean
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -743,7 +787,7 @@ CORBA::Boolean
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -774,7 +818,7 @@ CORBA::Boolean
   str += (Standard_Integer) MaxNbOfIterations;
   str += ", ";
   str += (Standard_Real) MaxAspectRatio;
-  if ( Method == ::SMESH_MeshEditor::CENTROIDAL )
+  if ( Method == SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH )
     str += ", SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH, ";
   else
     str += ", SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH, ";
@@ -790,7 +834,7 @@ CORBA::Boolean
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -804,7 +848,7 @@ void SMESH_MeshEditor_i::RenumberNodes()
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -818,7 +862,7 @@ void SMESH_MeshEditor_i::RenumberElements()
 
 //=======================================================================
 //function : RotationSweep
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElements,
@@ -858,7 +902,7 @@ void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElement
 
 //=======================================================================
 //function : RotationSweepObject
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
@@ -885,7 +929,7 @@ void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject
 
 //=======================================================================
 //function : ExtrusionSweep
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElements,
@@ -923,7 +967,7 @@ void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElemen
 
 //=======================================================================
 //function : ExtrusionSweepObject
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
@@ -945,7 +989,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObjec
 }
 //=======================================================================
 //function : ExtrusionSweepObject1D
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
@@ -973,7 +1017,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObj
 
 //=======================================================================
 //function : ExtrusionSweepObject2D
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
@@ -1017,7 +1061,7 @@ static SMESH::SMESH_MeshEditor::Extrusion_Error convExtrError( const::SMESH_Mesh
 
 //=======================================================================
 //function : ExtrusionAlongPath
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 SMESH::SMESH_MeshEditor::Extrusion_Error
@@ -1085,7 +1129,7 @@ SMESH::SMESH_MeshEditor::Extrusion_Error
 
 //=======================================================================
 //function : ExtrusionAlongPathObject
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 SMESH::SMESH_MeshEditor::Extrusion_Error
@@ -1123,7 +1167,7 @@ SMESH::SMESH_MeshEditor::Extrusion_Error
 
 //=======================================================================
 //function : Mirror
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::Mirror(const SMESH::long_array &           theIDsOfElements,
@@ -1174,7 +1218,7 @@ void SMESH_MeshEditor_i::Mirror(const SMESH::long_array &           theIDsOfElem
 
 //=======================================================================
 //function : MirrorObject
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr           theObject,
@@ -1211,7 +1255,7 @@ void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr           theObj
 
 //=======================================================================
 //function : Translate
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
@@ -1249,7 +1293,7 @@ void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
 
 //=======================================================================
 //function : TranslateObject
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
@@ -1272,7 +1316,7 @@ void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
 
 //=======================================================================
 //function : Rotate
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
@@ -1295,7 +1339,7 @@ void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
 
   gp_Trsf aTrsf;
   aTrsf.SetRotation( gp_Ax1( P, V ), theAngle);
-  
+
   ::SMESH_MeshEditor anEditor( _myMesh );
   anEditor.Transform (elements, aTrsf, theCopy);
 
@@ -1312,7 +1356,7 @@ void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
 
 //=======================================================================
 //function : RotateObject
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
@@ -1337,7 +1381,7 @@ void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
 
 //=======================================================================
 //function : FindCoincidentNodes
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::FindCoincidentNodes (CORBA::Double                  Tolerance,
@@ -1364,7 +1408,7 @@ void SMESH_MeshEditor_i::FindCoincidentNodes (CORBA::Double                  Tol
 
 //=======================================================================
 //function : MergeNodes
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes)
@@ -1401,7 +1445,7 @@ void SMESH_MeshEditor_i::MergeNodes (const SMESH::array_of_long_array& GroupsOfN
 
 //=======================================================================
 //function : MergeEqualElements
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void SMESH_MeshEditor_i::MergeEqualElements()
@@ -1415,7 +1459,7 @@ void SMESH_MeshEditor_i::MergeEqualElements()
 
 //=======================================================================
 //function : operator
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 #define RETCASE(enm) case ::SMESH_MeshEditor::enm: return SMESH::SMESH_MeshEditor::enm;
@@ -1439,7 +1483,7 @@ static SMESH::SMESH_MeshEditor::Sew_Error convError( const::SMESH_MeshEditor::Se
 
 //=======================================================================
 //function : SewFreeBorders
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 SMESH::SMESH_MeshEditor::Sew_Error
@@ -1496,7 +1540,7 @@ SMESH::SMESH_MeshEditor::Sew_Error
 
 //=======================================================================
 //function : SewConformFreeBorders
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 SMESH::SMESH_MeshEditor::Sew_Error
@@ -1545,7 +1589,7 @@ SMESH::SMESH_MeshEditor::Sew_Error
 
 //=======================================================================
 //function : SewBorderToSide
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 SMESH::SMESH_MeshEditor::Sew_Error
@@ -1599,7 +1643,7 @@ SMESH::SMESH_MeshEditor::Sew_Error
 
 //=======================================================================
 //function : SewSideElements
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 SMESH::SMESH_MeshEditor::Sew_Error
index 9aba3bb4fe9871f3bb699759417644a35498977d..327c497a5bc87335c365be0eee2982638b2f4d83 100644 (file)
@@ -1,23 +1,23 @@
 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //
 //  Copyright (C) 2003  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 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 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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 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
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
@@ -64,18 +64,23 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
   CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
   CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
 
-  CORBA::Boolean TriToQuad(const SMESH::long_array &   IDsOfElements,
-                           SMESH::NumericalFunctor_ptr Criterion,
-                           CORBA::Double               MaxAngle);
-  CORBA::Boolean TriToQuadObject(SMESH::SMESH_IDSource_ptr theObject,
-                                SMESH::NumericalFunctor_ptr Criterion,
-                                CORBA::Double               MaxAngle);
-  CORBA::Boolean QuadToTri(const SMESH::long_array &   IDsOfElements,
-                           SMESH::NumericalFunctor_ptr Criterion);
-  CORBA::Boolean SplitQuad(const SMESH::long_array & IDsOfElements,
-                           CORBA::Boolean            Diag13);
-  CORBA::Boolean SplitQuadObject(SMESH::SMESH_IDSource_ptr theObject,
-                                CORBA::Boolean            Diag13);
+  // Split/Join faces
+  CORBA::Boolean TriToQuad       (const SMESH::long_array &   IDsOfElements,
+                                  SMESH::NumericalFunctor_ptr Criterion,
+                                  CORBA::Double               MaxAngle);
+  CORBA::Boolean TriToQuadObject (SMESH::SMESH_IDSource_ptr   theObject,
+                                  SMESH::NumericalFunctor_ptr Criterion,
+                                  CORBA::Double               MaxAngle);
+  CORBA::Boolean QuadToTri       (const SMESH::long_array &   IDsOfElements,
+                                  SMESH::NumericalFunctor_ptr Criterion);
+  CORBA::Boolean QuadToTriObject (SMESH::SMESH_IDSource_ptr   theObject,
+                                  SMESH::NumericalFunctor_ptr Criterion);
+  CORBA::Boolean SplitQuad       (const SMESH::long_array &   IDsOfElements,
+                                  CORBA::Boolean              Diag13);
+  CORBA::Boolean SplitQuadObject (SMESH::SMESH_IDSource_ptr   theObject,
+                                  CORBA::Boolean              Diag13);
+  CORBA::Long    BestSplit       (CORBA::Long                 IDOfQuad,
+                                  SMESH::NumericalFunctor_ptr Criterion);
 
   CORBA::Boolean Smooth(const SMESH::long_array &              IDsOfElements,
                         const SMESH::long_array &              IDsOfFixedNodes,
@@ -136,7 +141,7 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
   void ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
                               const SMESH::DirStruct &  StepVector,
                               CORBA::Long               NbOfSteps);
-  
+
   SMESH::SMESH_MeshEditor::Extrusion_Error
     ExtrusionAlongPath(const SMESH::long_array &   IDsOfElements,
                        SMESH::SMESH_Mesh_ptr       PathMesh,
@@ -146,7 +151,7 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
                        const SMESH::double_array & Angles,
                        CORBA::Boolean              HasRefPoint,
                        const SMESH::PointStruct &  RefPoint);
-  
+
   SMESH::SMESH_MeshEditor::Extrusion_Error
     ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr   theObject,
                              SMESH::SMESH_Mesh_ptr       PathMesh,