From: eap Date: Wed, 22 Aug 2018 17:46:26 +0000 (+0300) Subject: 54355: 'Compute' button is absent for 'Number of the double nodes' value in 'Mesh... X-Git-Tag: SHAPER_V9_1_0RC1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2f529dcd2629679dadcca3047583bfcf28ca7b1a;p=modules%2Fsmesh.git 54355: 'Compute' button is absent for 'Number of the double nodes' value in 'Mesh Information' dialog in 'Quality Info' tab. + fix regression of QuadFromMedialAxis + fix invalid icon of sub-mesh on wire (SMESH_subMesh_i.cxx) --- diff --git a/src/SMESH/SMESH_ProxyMesh.cxx b/src/SMESH/SMESH_ProxyMesh.cxx index 9e2e34792..c8dcec11c 100644 --- a/src/SMESH/SMESH_ProxyMesh.cxx +++ b/src/SMESH/SMESH_ProxyMesh.cxx @@ -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( mesh ), index ), + _n2n(0) +{ +} + //================================================================================ /*! * \brief Return a proxy node or an input node diff --git a/src/SMESH/SMESH_ProxyMesh.hxx b/src/SMESH/SMESH_ProxyMesh.hxx index 35a4c3a97..c7e92a8c4 100644 --- a/src/SMESH/SMESH_ProxyMesh.hxx +++ b/src/SMESH/SMESH_ProxyMesh.hxx @@ -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: diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index e8a61f295..5b5de318b 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -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() )) diff --git a/src/SMESHDS/SMESHDS_SubMesh.cxx b/src/SMESHDS/SMESHDS_SubMesh.cxx index cc5b6f7d3..ce820acbf 100644 --- a/src/SMESHDS/SMESHDS_SubMesh.cxx +++ b/src/SMESHDS/SMESHDS_SubMesh.cxx @@ -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; } diff --git a/src/SMESHDS/SMESHDS_SubMesh.hxx b/src/SMESHDS/SMESHDS_SubMesh.hxx index f25ebfe9d..3a31915c4 100644 --- a/src/SMESHDS/SMESHDS_SubMesh.hxx +++ b/src/SMESHDS/SMESHDS_SubMesh.hxx @@ -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; }; diff --git a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx index 07066bf46..34c737faf 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfo.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfo.cxx @@ -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 ); } diff --git a/src/SMESHUtils/SMESH_MAT2d.cxx b/src/SMESHUtils/SMESH_MAT2d.cxx index f37334a16..8e3eaeb64 100644 --- a/src/SMESHUtils/SMESH_MAT2d.cxx +++ b/src/SMESHUtils/SMESH_MAT2d.cxx @@ -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() ]; diff --git a/src/SMESH_I/SMESH_subMesh_i.cxx b/src/SMESH_I/SMESH_subMesh_i.cxx index 720a1509b..4737a7b0e 100644 --- a/src/SMESH_I/SMESH_subMesh_i.cxx +++ b/src/SMESH_I/SMESH_subMesh_i.cxx @@ -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; + } + } } } } diff --git a/src/StdMeshers/StdMeshers_QuadFromMedialAxis_1D2D.cxx b/src/StdMeshers/StdMeshers_QuadFromMedialAxis_1D2D.cxx index 2043f1ea7..0b9005bca 100644 --- a/src/StdMeshers/StdMeshers_QuadFromMedialAxis_1D2D.cxx +++ b/src/StdMeshers/StdMeshers_QuadFromMedialAxis_1D2D.cxx @@ -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 ); diff --git a/src/StdMeshers/StdMeshers_ViscousLayers.cxx b/src/StdMeshers/StdMeshers_ViscousLayers.cxx index 8bece9628..a384191b2 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers.cxx @@ -97,7 +97,7 @@ #include #ifdef _DEBUG_ -#define __myDEBUG +//#define __myDEBUG //#define __NOT_INVALIDATE_BAD_SMOOTH //#define __NODES_AT_POS #endif