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 Proxy sub-mesh
*/
- class SMESH_EXPORT SubMesh : public SMESHDS_SubMesh, SMDS_ElementHolder
+ class SMESH_EXPORT SubMesh : public SMESHDS_SubMesh
{
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:
_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
{
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() )
//================================================================================
/*!
- * \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
*/
//================================================================================
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() ))
*/
//================================================================================
-SMESHDS_SubMesh::SMESHDS_SubMesh(SMESHDS_Mesh *parent, int index)
+SMESHDS_SubMesh::SMESHDS_SubMesh(const SMESHDS_Mesh *parent, int index)
: SMDS_ElementHolder( parent )
{
myParent = parent;
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;
}
bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N)
{
- if ( !N || N->getshapeId() != myIndex )
+ if ( myNbNodes == 0 || !N || N->getshapeId() != myIndex )
{
return false;
}
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(); }
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;
};
// 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 );
}
}
else {
- for( int i=2; i<=11; i++)
+ for( int i=2; i<=13; i++)
myMainLayout->itemAt(i)->widget()->setVisible( false );
}
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 );
}
}
text << "\n";
file.write( text.c_str(), text.size() );
- cout << "execfile( '" << fileName << "')" << endl;
+ cout << fileName << endl;
#endif
}
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;
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() ];
//
#include "SMESH_subMesh_i.hxx"
+#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_Mesh_i.hxx"
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();
}
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;
+ }
+ }
}
}
}
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 );
#include <unordered_map>
#ifdef _DEBUG_
-#define __myDEBUG
+//#define __myDEBUG
//#define __NOT_INVALIDATE_BAD_SMOOTH
//#define __NODES_AT_POS
#endif