Salome HOME
Porting to Python 2.6 - add coding page specification for Python scripts
[modules/smesh.git] / src / StdMeshers / StdMeshers_CompositeSegment_1D.cxx
index 381caade19a2358e5705d35784cb8bbb7d1da963..eee3ef0129ad367f4d04ada26b2458d713e0fb04 100644 (file)
@@ -1,32 +1,31 @@
-//  SMESH SMESH : implementaion of SMESH idl descriptions
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+//  SMESH SMESH : implementaion of SMESH idl descriptions
 //  File   : StdMeshers_Regular_1D.cxx
 //           Moved here from SMESH_Regular_1D.cxx
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
 //  $Header$
-
+//
 #include "StdMeshers_CompositeSegment_1D.hxx"
 #include "StdMeshers_FaceSide.hxx"
 #include "StdMeshers_AutomaticLength.hxx"
@@ -252,6 +251,35 @@ StdMeshers_CompositeSegment_1D::~StdMeshers_CompositeSegment_1D()
 
 void StdMeshers_CompositeSegment_1D::SetEventListener(SMESH_subMesh* subMesh)
 {
+  // issue 0020279. Set "_alwaysComputed" flag to the submeshes of internal
+  // vertices of composite edge in order to avoid creation of vertices on
+  // them for the sake of stability.
+
+  // check if "_alwaysComputed" is not yet set
+  bool isAlwaysComputed = false;
+  SMESH_subMeshIteratorPtr smIt = subMesh->getDependsOnIterator(false,false);
+  while ( !isAlwaysComputed && smIt->more() )
+    isAlwaysComputed = smIt->next()->IsAlwaysComputed();
+
+  if ( !isAlwaysComputed )
+  {
+    // check if an edge is a part of a complex side
+    TopoDS_Face face;
+    TopoDS_Edge edge = TopoDS::Edge( subMesh->GetSubShape() );
+    auto_ptr< StdMeshers_FaceSide > side
+      ( StdMeshers_CompositeSegment_1D::GetFaceSide(*subMesh->GetFather(),edge, face, false ));
+    if ( side->NbEdges() > 1 ) { // complex
+
+      // set _alwaysComputed to vertices
+      for ( int iE = 1; iE < side->NbEdges(); ++iE )
+      {
+        TopoDS_Vertex V = side->FirstVertex( iE );
+        SMESH_subMesh* sm = side->GetMesh()->GetSubMesh( V );
+        sm->SetIsAlwaysComputed( true );
+      }
+    }
+  }
+  // set listener that will remove _alwaysComputed from submeshes at algorithm change
   subMesh->SetEventListener( _EventListener, 0, subMesh);
   StdMeshers_Regular_1D::SetEventListener( subMesh );
 }