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 );
}
//================================================================================
/*!
* \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

View 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:

View 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() ))

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 )
{
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;
}

View 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;
};

View 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 );
}

View 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() ];

View 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() )
TListOfSubMeshes::iterator smDS = smList.begin();
for ( ; smDS != smList.end(); ++smDS )
{
types->length( 1 );
types[0] = SMESH::ElementType( eIt->next()->GetType());
}
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 )
SMDS_ElemIteratorPtr eIt = (*smDS)->GetElements();
if ( eIt->more() )
{
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];
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 );

View File

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