{
myScript = new SMESHDS_Script(theIsEmbeddedMode);
myCurSubMesh = 0;
+ SetPersistentId(theMeshID);
}
//=======================================================================
return myIsEmbeddedMode;
}
+//================================================================================
+/*!
+ * \brief Store ID persistent during lifecycle
+ */
+//================================================================================
+
+void SMESHDS_Mesh::SetPersistentId(int id)
+{
+ if (NbNodes() == 0)
+ myPersistentID = id;
+}
+//================================================================================
+/*!
+ * \brief Return ID persistent during lifecycle
+ */
+//================================================================================
+
+int SMESHDS_Mesh::GetPersistentId() const
+{
+ return myPersistentID;
+}
+
//=======================================================================
//function : ShapeToMesh
//purpose :
//function : AddPolygonalFace
//purpose :
//=======================================================================
-SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID (std::vector<int> nodes_ids,
- const int ID)
+SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID (const std::vector<int>& nodes_ids,
+ const int ID)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes_ids, ID);
if (anElem) {
}
SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFaceWithID
- (std::vector<const SMDS_MeshNode*> nodes,
- const int ID)
+ (const std::vector<const SMDS_MeshNode*>& nodes,
+ const int ID)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID);
if (anElem) {
}
SMDS_MeshFace* SMESHDS_Mesh::AddPolygonalFace
- (std::vector<const SMDS_MeshNode*> nodes)
+ (const std::vector<const SMDS_MeshNode*>& nodes)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddPolygonalFace(nodes);
if (anElem) {
//function : AddPolyhedralVolume
//purpose :
//=======================================================================
-SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID (std::vector<int> nodes_ids,
- std::vector<int> quantities,
- const int ID)
+SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID (const std::vector<int>& nodes_ids,
+ const std::vector<int>& quantities,
+ const int ID)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes_ids, quantities, ID);
if (anElem) {
}
SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolumeWithID
- (std::vector<const SMDS_MeshNode*> nodes,
- std::vector<int> quantities,
- const int ID)
+ (const std::vector<const SMDS_MeshNode*>& nodes,
+ const std::vector<int>& quantities,
+ const int ID)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolumeWithID(nodes, quantities, ID);
if (anElem) {
}
SMDS_MeshVolume* SMESHDS_Mesh::AddPolyhedralVolume
- (std::vector<const SMDS_MeshNode*> nodes,
- std::vector<int> quantities)
+ (const std::vector<const SMDS_MeshNode*>& nodes,
+ const std::vector<int>& quantities)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddPolyhedralVolume(nodes, quantities);
if (anElem) {
bool SMESHDS_Mesh::IsGroupOfSubShapes (const TopoDS_Shape& theShape) const
{
- if ( myShape.IsSame( theShape ))
+ if ( myIndexToShape.Contains(theShape) )
return true;
- for ( TopoDS_Iterator it( theShape ); it.More(); it.Next() ) {
- if (myIndexToShape.Contains( it.Value() ) ||
- IsGroupOfSubShapes( it.Value() ))
+ for ( TopoDS_Iterator it( theShape ); it.More(); it.Next() )
+ if (IsGroupOfSubShapes( it.Value() ))
return true;
- }
-
+
return false;
}
TopAbs_ShapeEnum type)
{
int aMainIndex = 0;
- if ( IsGroupOfSubShapes( S ) || (S.ShapeType() == TopAbs_VERTEX && myIndexToShape.Contains(S)) )
+ if ( IsGroupOfSubShapes( S ))
{
aMainIndex = myIndexToShape.Add( S );
bool all = ( type == TopAbs_SHAPE );
return nullShape;
}
+//================================================================================
+/*!
+ * \brief Return max index of sub-mesh
+ */
+//================================================================================
+
+int SMESHDS_Mesh::MaxSubMeshIndex() const
+{
+ return myShapeIndexToSubMesh.empty() ? 0 : myShapeIndexToSubMesh.rbegin()->first;
+}
+
//=======================================================================
//function : ShapeToIndex
//purpose :