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)
This commit is contained in:
eap 2018-08-22 20:46:26 +03:00
parent aa574473cf
commit 2f529dcd26
10 changed files with 96 additions and 48 deletions

View File

@ -524,6 +524,18 @@ bool SMESH_ProxyMesh::IsTemporary(const SMDS_MeshElement* elem ) const
return ( elem->GetID() < 1 ) || _elemsInMesh.count( elem ); 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 * \brief Return a proxy node or an input node

View File

@ -57,7 +57,7 @@ public:
/*! /*!
* \brief Proxy sub-mesh * \brief Proxy sub-mesh
*/ */
class SMESH_EXPORT SubMesh : public SMESHDS_SubMesh, SMDS_ElementHolder class SMESH_EXPORT SubMesh : public SMESHDS_SubMesh
{ {
public: public:
@ -79,8 +79,7 @@ public:
// for which the caller is responsible // for which the caller is responsible
_elements.assign( it, end ); _elements.assign( it, end );
} }
SubMesh(const SMDS_Mesh* mesh, int index=0) SubMesh(const SMDS_Mesh* mesh, int index=0);
:SMESHDS_SubMesh(0,index), SMDS_ElementHolder(mesh), _n2n(0) {}
virtual ~SubMesh() { Clear(); } virtual ~SubMesh() { Clear(); }
protected: protected:

View File

@ -2276,9 +2276,9 @@ void SMESH_subMesh::setEventListener(EventListener* listener,
_eventListeners.find( listener ); _eventListeners.find( listener );
if ( l_d != _eventListeners.end() ) { if ( l_d != _eventListeners.end() ) {
EventListenerData* curData = l_d->second; EventListenerData* curData = l_d->second;
l_d->second = data;
if ( curData && curData != data && curData->IsDeletable() ) if ( curData && curData != data && curData->IsDeletable() )
delete curData; delete curData;
l_d->second = data;
} }
else else
{ {
@ -2286,6 +2286,7 @@ void SMESH_subMesh::setEventListener(EventListener* listener,
if ( listener->GetName() == l_d->first->GetName() ) if ( listener->GetName() == l_d->first->GetName() )
{ {
EventListenerData* curData = l_d->second; EventListenerData* curData = l_d->second;
l_d->second = 0;
if ( curData && curData != data && curData->IsDeletable() ) if ( curData && curData != data && curData->IsDeletable() )
delete curData; delete curData;
if ( l_d->first != listener && l_d->first->IsDeletable() ) if ( l_d->first != listener && l_d->first->IsDeletable() )
@ -2548,9 +2549,9 @@ namespace {
//================================================================================ //================================================================================
/*! /*!
* \brief Return iterator on the submeshes this one depends on * \brief Return iterator on the submeshes this one depends on
* \param includeSelf - this submesh to be returned also * \param includeSelf - this submesh to be returned also
* \param reverse - if true, complex shape submeshes go first * \param reverse - if true, complex shape submeshes go first
*/ */
//================================================================================ //================================================================================
@ -2593,6 +2594,9 @@ const std::vector< SMESH_subMesh * > & SMESH_subMesh::GetAncestors() const
TopTools_MapOfShape map; TopTools_MapOfShape map;
// assure that all sub-meshes exist
_father->GetSubMesh( _father->GetShapeToMesh() )->DependsOn();
for ( TopTools_ListIteratorOfListOfShape it( ancShapes ); it.More(); it.Next() ) for ( TopTools_ListIteratorOfListOfShape it( ancShapes ); it.More(); it.Next() )
if ( SMESH_subMesh* sm = _father->GetSubMeshContaining( it.Value() )) if ( SMESH_subMesh* sm = _father->GetSubMeshContaining( it.Value() ))
if ( map.Add( it.Value() )) if ( map.Add( it.Value() ))

View 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 ) : SMDS_ElementHolder( parent )
{ {
myParent = parent; myParent = parent;
@ -131,7 +131,7 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * elem)
bool SMESHDS_SubMesh::RemoveElement(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; return false;
} }
@ -193,7 +193,7 @@ void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
bool SMESHDS_SubMesh::RemoveNode(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; return false;
} }

View File

@ -46,7 +46,7 @@ class SMESHDS_Mesh;
class SMESHDS_EXPORT SMESHDS_SubMesh : public SMDS_ElementHolder class SMESHDS_EXPORT SMESHDS_SubMesh : public SMDS_ElementHolder
{ {
public: public:
SMESHDS_SubMesh(SMESHDS_Mesh *parent, int index); SMESHDS_SubMesh(const SMESHDS_Mesh *parent, int index);
virtual ~SMESHDS_SubMesh(); virtual ~SMESHDS_SubMesh();
virtual bool IsComplexSubmesh() const { return !mySubMeshes.empty(); } virtual bool IsComplexSubmesh() const { return !mySubMeshes.empty(); }
@ -92,7 +92,7 @@ class SMESHDS_EXPORT SMESHDS_SubMesh : public SMDS_ElementHolder
int myNbElements; int myNbElements;
int myNbNodes; int myNbNodes;
const SMDS_MeshElement* my1stElemNode[2]; // elem and node with least ID, to optimize iteration const SMDS_MeshElement* my1stElemNode[2]; // elem and node with least ID, to optimize iteration
SMESHDS_Mesh * myParent; const SMESHDS_Mesh * myParent;
TSubMeshSet mySubMeshes; TSubMeshSet mySubMeshes;
}; };

View File

@ -3576,17 +3576,17 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
// nodes info // nodes info
const CORBA::Long nbNodes = nbElemsByType[ SMESH::NODE ]; const CORBA::Long nbNodes = nbElemsByType[ SMESH::NODE ];
const CORBA::Long nbElems = ( nbElemsByType[ SMESH::EDGE ] + // const CORBA::Long nbElems = ( nbElemsByType[ SMESH::EDGE ] +
nbElemsByType[ SMESH::FACE ] + // nbElemsByType[ SMESH::FACE ] +
nbElemsByType[ SMESH::VOLUME ] ); // nbElemsByType[ SMESH::VOLUME ] );
if ( nbNodes + nbElems > 0 ) { if ( nbNodes > 0 ) {
if ( Max( (int)nbNodes, (int)nbElems ) <= ctrlLimit ) { if ( nbNodes <= ctrlLimit ) {
// free nodes // free nodes
computeFreeNodesInfo(); computeFreeNodesInfo();
// node connectivity number
computeNodesNbConnInfo(); computeNodesNbConnInfo();
// double nodes // double nodes
if ( Max( (int)mesh->NbNodes(), (int)mesh->NbElements() ) <= ctrlLimit ) computeDoubleNodesInfo();
computeDoubleNodesInfo();
} }
else { else {
myButtons[0]->setEnabled( true ); myButtons[0]->setEnabled( true );
@ -3595,7 +3595,7 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
} }
} }
else { else {
for( int i=2; i<=11; i++) for( int i=2; i<=13; i++)
myMainLayout->itemAt(i)->widget()->setVisible( false ); myMainLayout->itemAt(i)->widget()->setVisible( false );
} }
@ -3608,7 +3608,7 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
myButtons[3]->setEnabled( true ); myButtons[3]->setEnabled( true );
} }
else { else {
for( int i=11; i<=14; i++) for( int i=14; i<=17; i++)
myMainLayout->itemAt(i)->widget()->setVisible( false ); myMainLayout->itemAt(i)->widget()->setVisible( false );
} }

View File

@ -469,7 +469,7 @@ namespace
} }
text << "\n"; text << "\n";
file.write( text.c_str(), text.size() ); file.write( text.c_str(), text.size() );
cout << "execfile( '" << fileName << "')" << endl; cout << fileName << endl;
#endif #endif
} }
@ -648,10 +648,18 @@ namespace
for ( size_t iE = 0; iE < edges.size(); ++iE ) for ( size_t iE = 0; iE < edges.size(); ++iE )
{ {
size_t iE2 = (iE+1) % edges.size(); size_t iE2 = (iE+1) % edges.size();
if ( !TopExp::CommonVertex( edges[iE], edges[iE2], vShared )) if ( !TopExp::CommonVertex( edges[iE], edges[iE2], vShared )) // FACE with several WIREs?
continue; 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 ))) if ( !vShared.IsSame( TopExp::LastVertex( edges[iE], true )))
return false; continue;
//return false;
vector< UVU > & points1 = uvuVec[ iE ]; vector< UVU > & points1 = uvuVec[ iE ];
vector< UVU > & points2 = uvuVec[ iE2 ]; vector< UVU > & points2 = uvuVec[ iE2 ];
gp_Pnt2d & uv1 = points1.back() ._uv; 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) for (TVD::const_cell_iterator it = vd.cells().begin(); it != vd.cells().end(); ++it)
{ {
const TVDCell* cell = &(*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() ) if ( cell->contains_segment() )
{ {
InSegment& seg = inSegments[ cell->source_index() ]; InSegment& seg = inSegments[ cell->source_index() ];

View File

@ -27,6 +27,7 @@
// //
#include "SMESH_subMesh_i.hxx" #include "SMESH_subMesh_i.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx" #include "SMESHDS_SubMesh.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
#include "SMESH_Mesh_i.hxx" #include "SMESH_Mesh_i.hxx"
@ -484,11 +485,16 @@ SMESH::long_array* SMESH_subMesh_i::GetNbElementsByType()
aRes[ SMESH::NODE ] = GetNumberOfNodes(true); aRes[ SMESH::NODE ] = GetNumberOfNodes(true);
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId]; ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
if ( SMESHDS_SubMesh* smDS = aSubMesh->GetSubMeshDS() ) TListOfSubMeshes smList;
if ( getSubMeshes( aSubMesh, smList ))
{ {
SMDS_ElemIteratorPtr eIt = smDS->GetElements(); TListOfSubMeshes::iterator smDS = smList.begin();
if ( eIt->more() ) for ( ; smDS != smList.end(); ++smDS )
aRes[ eIt->next()->GetType() ] = smDS->NbElements(); {
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::array_of_ElementType_var types = new SMESH::array_of_ElementType;
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId]; ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
if ( SMESHDS_SubMesh* smDS = aSubMesh->GetSubMeshDS() )
TListOfSubMeshes smList;
if ( getSubMeshes( aSubMesh, smList ))
{ {
SMDS_ElemIteratorPtr eIt = smDS->GetElements(); TListOfSubMeshes::iterator smDS = smList.begin();
if ( eIt->more() ) for ( ; smDS != smList.end(); ++smDS )
{ {
types->length( 1 ); SMDS_ElemIteratorPtr eIt = (*smDS)->GetElements();
types[0] = SMESH::ElementType( eIt->next()->GetType()); if ( eIt->more() )
}
else if ( smDS->GetNodes()->more() )
{
TopoDS_Shape shape = aSubMesh->GetSubShape();
while ( !shape.IsNull() && shape.ShapeType() == TopAbs_COMPOUND )
{
TopoDS_Iterator it( shape );
shape = it.More() ? it.Value() : TopoDS_Shape();
}
if ( !shape.IsNull() && shape.ShapeType() == TopAbs_VERTEX )
{ {
types->length( 1 ); types->length( 1 );
types[0] = SMESH::NODE; types[0] = SMESH::ElementType( eIt->next()->GetType());
break;
}
}
if ( types->length() == 0 )
{
for ( smDS = smList.begin(); smDS != smList.end(); ++smDS )
{
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;
}
}
} }
} }
} }

View File

@ -1154,6 +1154,8 @@ namespace
bool isShortPrev[2], isShortNext[2], isPrevCloser[2]; bool isShortPrev[2], isShortNext[2], isPrevCloser[2];
TMAPar2NPoints::iterator u2NPPrev = u2NP, u2NPNext = u2NP; TMAPar2NPoints::iterator u2NPPrev = u2NP, u2NPNext = u2NP;
--u2NPPrev; ++u2NPNext; --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 for ( int iS = 0; iS < 2; ++iS ) // side with Vertex and side with Nodes
{ {
NodePoint np = get( u2NP->second, iS ); NodePoint np = get( u2NP->second, iS );

View File

@ -97,7 +97,7 @@
#include <unordered_map> #include <unordered_map>
#ifdef _DEBUG_ #ifdef _DEBUG_
#define __myDEBUG //#define __myDEBUG
//#define __NOT_INVALIDATE_BAD_SMOOTH //#define __NOT_INVALIDATE_BAD_SMOOTH
//#define __NODES_AT_POS //#define __NODES_AT_POS
#endif #endif