0021262: EDF 1867 SMESH: Problem with concatenate that causes failure in an important script

Fix regression of MergeNodes() caused by SMDS redesign
This commit is contained in:
eap 2011-05-12 13:40:34 +00:00
parent 8c9a971309
commit 895fb77569

View File

@ -7858,8 +7858,9 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
} // if ( nbNodes != nbUniqueNodes ) // some nodes stick } // if ( nbNodes != nbUniqueNodes ) // some nodes stick
if ( isOk ) { if ( isOk ) { // the elem remains valid after sticking nodes
if (elem->IsPoly() && elem->GetType() == SMDSAbs_Volume) { if (elem->IsPoly() && elem->GetType() == SMDSAbs_Volume)
{
// Change nodes of polyedre // Change nodes of polyedre
const SMDS_VtkVolume* aPolyedre = const SMDS_VtkVolume* aPolyedre =
dynamic_cast<const SMDS_VtkVolume*>( elem ); dynamic_cast<const SMDS_VtkVolume*>( elem );
@ -7886,28 +7887,25 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
aMesh->ChangePolyhedronNodes( elem, poly_nodes, quantities ); aMesh->ChangePolyhedronNodes( elem, poly_nodes, quantities );
} }
} }
else { else // replace non-polyhedron elements
//int elemId = elem->GetID(); {
//MESSAGE("Change regular element or polygon " << elemId); const SMDSAbs_ElementType etyp = elem->GetType();
SMDSAbs_ElementType etyp = elem->GetType(); const int elemId = elem->GetID();
const bool isPoly = (elem->GetEntityType() == SMDSEntity_Polygon);
uniqueNodes.resize(nbUniqueNodes); uniqueNodes.resize(nbUniqueNodes);
SMDS_MeshElement* newElem = 0;
if (elem->GetEntityType() == SMDSEntity_Polygon) SMESHDS_SubMesh * sm = aShapeId > 0 ? aMesh->MeshElements(aShapeId) : 0;
newElem = this->AddElement(uniqueNodes, etyp, true);
else aMesh->RemoveFreeElement(elem, sm, /*fromGroups=*/false);
newElem = this->AddElement(uniqueNodes, etyp, false); SMDS_MeshElement* newElem = this->AddElement(uniqueNodes, etyp, isPoly, elemId);
if (newElem) if ( sm && newElem )
{ sm->AddElement( newElem );
myLastCreatedElems.Append(newElem); if ( elem != newElem )
if ( aShapeId ) ReplaceElemInGroups( elem, newElem, aMesh );
aMesh->SetMeshElementOnShape( newElem, aShapeId );
}
aMesh->RemoveElement(elem);
} }
} }
else { else {
// Remove invalid regular element or invalid polygon // Remove invalid regular element or invalid polygon
//MESSAGE("Remove invalid " << elem->GetID());
rmElemIds.push_back( elem->GetID() ); rmElemIds.push_back( elem->GetID() );
} }