0022183: EDF SMESH: Error with ConvertToQuadratic

In AddNode(), throw an exception only if a node is already in an other
sub-mesh or its position in myNodes is wrong.
This commit is contained in:
eap 2013-03-29 15:22:09 +00:00
parent 7daf8d6589
commit 0de9672b5e

View File

@ -155,25 +155,28 @@ bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDele
//function : AddNode
//purpose :
//=======================================================================
void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
{
if ( !IsComplexSubmesh() )
{
int idInSubShape = N->getIdInShape();
int shapeId = N->getshapeId();
if ((shapeId > 0) && (idInSubShape >= 0))
{
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
}
//MESSAGE("try to add node in a complex submesh " << N->GetID());
SMDS_MeshNode* node = (SMDS_MeshNode*)(N);
node->setShapeId(myIndex);
node->setIdInShape(myNodes.size());
myNodes.push_back(N);
}
}
//=======================================================================