Salome HOME
54355: 'Compute' button is absent for 'Number of the double nodes' value in 'Mesh...
authoreap <eap@opencascade.com>
Wed, 22 Aug 2018 17:46:26 +0000 (20:46 +0300)
committereap <eap@opencascade.com>
Wed, 22 Aug 2018 17:46:26 +0000 (20:46 +0300)
+ fix regression of QuadFromMedialAxis
+ fix invalid icon of sub-mesh on wire (SMESH_subMesh_i.cxx)

src/SMESH/SMESH_ProxyMesh.cxx
src/SMESH/SMESH_ProxyMesh.hxx
src/SMESH/SMESH_subMesh.cxx
src/SMESHDS/SMESHDS_SubMesh.cxx
src/SMESHDS/SMESHDS_SubMesh.hxx
src/SMESHGUI/SMESHGUI_MeshInfo.cxx
src/SMESHUtils/SMESH_MAT2d.cxx
src/SMESH_I/SMESH_subMesh_i.cxx
src/StdMeshers/StdMeshers_QuadFromMedialAxis_1D2D.cxx
src/StdMeshers/StdMeshers_ViscousLayers.cxx

index 9e2e34792d130057528f85c1d3107b734bddcdc4..c8dcec11c7f3cd0bddb77175f8bf3b4fdc6fddd2 100644 (file)
@@ -524,6 +524,18 @@ bool SMESH_ProxyMesh::IsTemporary(const SMDS_MeshElement* elem ) const
   return ( elem->GetID() < 1 ) || _elemsInMesh.count( elem );
 }
 
+//================================================================================
+/*!
+ * \brief SubMesh Constructor
+ */
+//================================================================================
+
+SMESH_ProxyMesh::SubMesh::SubMesh( const SMDS_Mesh* mesh, int index )
+  : SMESHDS_SubMesh( static_cast<const SMESHDS_Mesh*>( mesh ), index ),
+    _n2n(0)
+{
+}
+
 //================================================================================
 /*!
  * \brief Return a proxy node or an input node
index 35a4c3a97b8ff6d2804084a0a6d7d1cd89ed7a47..c7e92a8c4d95a1e745bde5d53c0e6cba084b5e63 100644 (file)
@@ -57,7 +57,7 @@ public:
   /*!
    * \brief Proxy sub-mesh
    */
-  class SMESH_EXPORT SubMesh : public SMESHDS_SubMesh, SMDS_ElementHolder
+  class SMESH_EXPORT SubMesh : public SMESHDS_SubMesh
   {
   public:
 
@@ -79,8 +79,7 @@ public:
       // for which the caller is responsible
       _elements.assign( it, end );
     }
-    SubMesh(const SMDS_Mesh* mesh, int index=0)
-      :SMESHDS_SubMesh(0,index), SMDS_ElementHolder(mesh), _n2n(0) {}
+    SubMesh(const SMDS_Mesh* mesh, int index=0);
     virtual ~SubMesh() { Clear(); }
 
   protected:
index e8a61f295e8675f80d042240b222e5d77b3c80f9..5b5de318b6a1d46e29ff7f5990f9e62222989fef 100644 (file)
@@ -2276,9 +2276,9 @@ void SMESH_subMesh::setEventListener(EventListener*     listener,
     _eventListeners.find( listener );
   if ( l_d != _eventListeners.end() ) {
     EventListenerData* curData = l_d->second;
+    l_d->second = data;
     if ( curData && curData != data && curData->IsDeletable() )
       delete curData;
-    l_d->second = data;
   }
   else
   {
@@ -2286,6 +2286,7 @@ void SMESH_subMesh::setEventListener(EventListener*     listener,
       if ( listener->GetName() == l_d->first->GetName() )
       {
         EventListenerData* curData = l_d->second;
+        l_d->second = 0;
         if ( curData && curData != data && curData->IsDeletable() )
           delete curData;
         if ( l_d->first != listener && l_d->first->IsDeletable() )
@@ -2548,9 +2549,9 @@ namespace {
 
 //================================================================================
 /*!
- * \brief  Return iterator on the submeshes this one depends on
 * \param includeSelf - this submesh to be returned also
 * \param reverse - if true, complex shape submeshes go first
+ * \brief Return iterator on the submeshes this one depends on
 \param includeSelf - this submesh to be returned also
 \param reverse - if true, complex shape submeshes go first
  */
 //================================================================================
 
@@ -2592,7 +2593,10 @@ const std::vector< SMESH_subMesh * > & SMESH_subMesh::GetAncestors() const
     me->_ancestors.reserve( ancShapes.Extent() );
 
     TopTools_MapOfShape map;
-   
+
+    // assure that all sub-meshes exist
+    _father->GetSubMesh( _father->GetShapeToMesh() )->DependsOn();
+
     for ( TopTools_ListIteratorOfListOfShape it( ancShapes ); it.More(); it.Next() )
       if ( SMESH_subMesh* sm = _father->GetSubMeshContaining( it.Value() ))
         if ( map.Add( it.Value() ))
index cc5b6f7d3285d19dfbe9aa1948a3ec2f6bf99a69..ce820acbf49b83e0db6ab2f647268db869b66863 100644 (file)
@@ -72,7 +72,7 @@ namespace
  */
 //================================================================================
 
-SMESHDS_SubMesh::SMESHDS_SubMesh(SMESHDS_Mesh *parent, int index)
+SMESHDS_SubMesh::SMESHDS_SubMesh(const SMESHDS_Mesh *parent, int index)
   : SMDS_ElementHolder( parent )
 {
   myParent = parent;
@@ -131,7 +131,7 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * elem)
 
 bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * elem )
 {
-  if ( !elem || elem->IsNull() || elem->getshapeId() != myIndex )
+  if ( myNbElements == 0 || !elem || elem->IsNull() || elem->getshapeId() != myIndex )
   {
     return false;
   }
@@ -193,7 +193,7 @@ void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
 
 bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N)
 {
-  if ( !N || N->getshapeId() != myIndex )
+  if ( myNbNodes == 0 || !N || N->getshapeId() != myIndex )
   {
     return false;
   }
index f25ebfe9de4efa87a89ec6013ebc0c53c25c5625..3a31915c44685922bbc9f7dff3d3c0ef46bc73c0 100644 (file)
@@ -46,7 +46,7 @@ class SMESHDS_Mesh;
 class SMESHDS_EXPORT SMESHDS_SubMesh : public SMDS_ElementHolder
 {
  public:
-  SMESHDS_SubMesh(SMESHDS_Mesh *parent, int index);
+  SMESHDS_SubMesh(const SMESHDS_Mesh *parent, int index);
   virtual ~SMESHDS_SubMesh();
 
   virtual bool IsComplexSubmesh() const { return !mySubMeshes.empty(); }
@@ -92,7 +92,7 @@ class SMESHDS_EXPORT SMESHDS_SubMesh : public SMDS_ElementHolder
   int                     myNbElements;
   int                     myNbNodes;
   const SMDS_MeshElement* my1stElemNode[2]; // elem and node with least ID, to optimize iteration
-  SMESHDS_Mesh *          myParent;
+  const SMESHDS_Mesh *    myParent;
   TSubMeshSet             mySubMeshes;
 
 };
index 07066bf4605481b7d3e27ef45505cbf34a15b1f6..34c737faf5fdd533c84526a18d1a95159dff5e6d 100644 (file)
@@ -3576,17 +3576,17 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
 
   // nodes info
   const CORBA::Long nbNodes =   nbElemsByType[ SMESH::NODE ];
-  const CORBA::Long nbElems = ( nbElemsByType[ SMESH::EDGE ] +
-                                nbElemsByType[ SMESH::FACE ] +
-                                nbElemsByType[ SMESH::VOLUME ] );
-  if ( nbNodes + nbElems > 0 ) {
-    if ( Max( (int)nbNodes, (int)nbElems ) <= ctrlLimit ) {
+  // const CORBA::Long nbElems = ( nbElemsByType[ SMESH::EDGE ] +
+  //                               nbElemsByType[ SMESH::FACE ] +
+  //                               nbElemsByType[ SMESH::VOLUME ] );
+  if ( nbNodes > 0 ) {
+    if ( nbNodes <= ctrlLimit ) {
       // free nodes
       computeFreeNodesInfo();
+      // node connectivity number
       computeNodesNbConnInfo();
       // double nodes
-      if ( Max( (int)mesh->NbNodes(), (int)mesh->NbElements() ) <= ctrlLimit )
-        computeDoubleNodesInfo();
+      computeDoubleNodesInfo();
     }
     else {
       myButtons[0]->setEnabled( true );
@@ -3595,7 +3595,7 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
     }
   }
   else {
-    for( int i=2; i<=11; i++)
+    for( int i=2; i<=13; i++)
       myMainLayout->itemAt(i)->widget()->setVisible( false );
   }
 
@@ -3608,7 +3608,7 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
       myButtons[3]->setEnabled( true );
   }
   else {
-    for( int i=11; i<=14; i++)
+    for( int i=14; i<=17; i++)
       myMainLayout->itemAt(i)->widget()->setVisible( false );
   }
  
index f37334a160308c8759f28b9568fdf5c1ec023b76..8e3eaeb6481d4b44f0c31cd2c705641b30f5664d 100644 (file)
@@ -469,7 +469,7 @@ namespace
     }
     text << "\n";
     file.write( text.c_str(), text.size() );
-    cout << "execfile( '" << fileName << "')" << endl;
+    cout << fileName << endl;
 #endif
   }
 
@@ -648,10 +648,18 @@ namespace
     for ( size_t iE = 0; iE < edges.size(); ++iE )
     {
       size_t iE2 = (iE+1) % edges.size();
-      if ( !TopExp::CommonVertex( edges[iE], edges[iE2], vShared ))
-        continue;
+      if ( !TopExp::CommonVertex( edges[iE], edges[iE2], vShared )) // FACE with several WIREs?
+        for ( size_t i = 1; i < edges.size(); ++i )
+        {
+          iE2 = (iE2+1) % edges.size();
+          if ( iE != iE2 &&
+               TopExp::CommonVertex( edges[iE], edges[iE2], vShared ) &&
+               vShared.IsSame( TopExp::LastVertex( edges[iE], true )))
+            break;
+        }
       if ( !vShared.IsSame( TopExp::LastVertex( edges[iE], true )))
-        return false;
+        continue;
+        //return false;
       vector< UVU > & points1 = uvuVec[ iE ];
       vector< UVU > & points2 = uvuVec[ iE2 ];
       gp_Pnt2d & uv1 = points1.back() ._uv;
@@ -798,6 +806,12 @@ namespace
     for (TVD::const_cell_iterator it = vd.cells().begin(); it != vd.cells().end(); ++it)
     {
       const TVDCell* cell = &(*it);
+      if ( cell->is_degenerate() )
+      {
+        std::cerr << "SMESH_MAT2d: encounter degenerate voronoi_cell. Invalid input data?"
+                  << std::endl;
+        return;
+      }
       if ( cell->contains_segment() )
       {
         InSegment& seg = inSegments[ cell->source_index() ];
index 720a1509ba6554323aca3cd355870dcc25b84cce..4737a7b0e8eb28a7a8060d80a29beea5b64750e8 100644 (file)
@@ -27,6 +27,7 @@
 //
 #include "SMESH_subMesh_i.hxx"
 
+#include "SMESHDS_Mesh.hxx"
 #include "SMESHDS_SubMesh.hxx"
 #include "SMESH_Gen_i.hxx"
 #include "SMESH_Mesh_i.hxx"
@@ -484,14 +485,19 @@ SMESH::long_array* SMESH_subMesh_i::GetNbElementsByType()
     aRes[ SMESH::NODE ] = GetNumberOfNodes(true);
 
     ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
-    if ( SMESHDS_SubMesh* smDS = aSubMesh->GetSubMeshDS() )
+    TListOfSubMeshes smList;
+    if ( getSubMeshes( aSubMesh, smList ))
     {
-      SMDS_ElemIteratorPtr eIt = smDS->GetElements();
-      if ( eIt->more() )
-        aRes[ eIt->next()->GetType() ] = smDS->NbElements();
+      TListOfSubMeshes::iterator smDS = smList.begin();
+      for ( ; smDS != smList.end(); ++smDS )
+      {
+        SMDS_ElemIteratorPtr eIt = (*smDS)->GetElements();
+        if ( eIt->more() )
+          aRes[ eIt->next()->GetType() ] = (*smDS)->NbElements();
+      }
     }
   }
-  return aRes._retn();  
+  return aRes._retn();
 }
 
 
@@ -508,26 +514,37 @@ SMESH::array_of_ElementType* SMESH_subMesh_i::GetTypes()
   SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType;
 
   ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
-  if ( SMESHDS_SubMesh* smDS = aSubMesh->GetSubMeshDS() )
+
+  TListOfSubMeshes smList;
+  if ( getSubMeshes( aSubMesh, smList ))
   {
-    SMDS_ElemIteratorPtr eIt = smDS->GetElements();
-    if ( eIt->more() )
-    {
-      types->length( 1 );
-      types[0] = SMESH::ElementType( eIt->next()->GetType());
-    }
-    else if ( smDS->GetNodes()->more() )
+    TListOfSubMeshes::iterator smDS = smList.begin();
+    for ( ; smDS != smList.end(); ++smDS )
     {
-      TopoDS_Shape shape = aSubMesh->GetSubShape();
-      while ( !shape.IsNull() && shape.ShapeType() == TopAbs_COMPOUND )
+      SMDS_ElemIteratorPtr eIt = (*smDS)->GetElements();
+      if ( eIt->more() )
       {
-        TopoDS_Iterator it( shape );
-        shape = it.More() ? it.Value() : TopoDS_Shape();
+        types->length( 1 );
+        types[0] = SMESH::ElementType( eIt->next()->GetType());
+        break;
       }
-      if ( !shape.IsNull() && shape.ShapeType() == TopAbs_VERTEX )
+    }
+
+    if ( types->length() == 0 )
+    {
+      for ( smDS = smList.begin(); smDS != smList.end(); ++smDS )
       {
-        types->length( 1 );
-        types[0] = SMESH::NODE;
+        if ( (*smDS)->GetNodes()->more() )
+        {
+          int smID = (*smDS)->GetID();
+          TopoDS_Shape shape = (*smDS)->GetParent()->IndexToShape( smID );
+          if ( !shape.IsNull() && shape.ShapeType() == TopAbs_VERTEX )
+          {
+            types->length( 1 );
+            types[0] = SMESH::NODE;
+            break;
+          }
+        }
       }
     }
   }
index 2043f1ea7df1e96c198611b04af88afa1392d201..0b9005bcaa07fadefbd9c679a0774c0900a7bf3c 100644 (file)
@@ -1154,6 +1154,8 @@ namespace
       bool isShortPrev[2], isShortNext[2], isPrevCloser[2];
       TMAPar2NPoints::iterator u2NPPrev = u2NP, u2NPNext = u2NP;
       --u2NPPrev; ++u2NPNext;
+      if ( u2NPNext == thePointsOnE.end() )
+        u2NPNext = thePointsOnE.begin(); // hope theSinuFace.IsRing()
       for ( int iS = 0; iS < 2; ++iS ) // side with Vertex and side with Nodes
       {
         NodePoint np     = get( u2NP->second,     iS );
index 8bece96283893f38522e12e570b7daeb83029a0c..a384191b2be9903701f64001acb577d3e5007b28 100644 (file)
@@ -97,7 +97,7 @@
 #include <unordered_map>
 
 #ifdef _DEBUG_
-#define __myDEBUG
+//#define __myDEBUG
 //#define __NOT_INVALIDATE_BAD_SMOOTH
 //#define __NODES_AT_POS
 #endif