- int idInSubShape = N->getIdInShape();
- int shapeId = N->getshapeId();
- if ((shapeId > 0) && (idInSubShape >= 0))
- {
-// MESSAGE("========== AddNode already belonging to other subShape " << N->GetID());
- // OK for vertex nodes
- throw SALOME_Exception(LOCALIZED("add node in subshape already belonging to a subshape"));
- }
- SMDS_MeshNode* node = (SMDS_MeshNode*)(N);
- node->setShapeId(myIndex);
- node->setIdInShape(myNodes.size());
- myNodes.push_back(N);
- //MESSAGE("in "<< myIndex << " AddNode " << node->GetID());
+ if ( shapeId != myIndex )
+ throw SALOME_Exception
+ (LOCALIZED("a node being in sub-mesh is added to another sub-mesh"));
+ if ( idInSubShape >= NbNodes() || myNodes[ idInSubShape ] != N )
+ throw SALOME_Exception
+ (LOCALIZED("a node with wrong idInSubShape is re-added to the same sub-mesh"));
+ return; // already in