mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-12 17:50:34 +05:00
PAL7403. In ShapeToMesh(), remove shape referring data if the main shape becomes NULL
This commit is contained in:
parent
31e0d2b9b7
commit
6d13ce6863
@ -33,6 +33,7 @@
|
|||||||
#include "SMESH_Group.hxx"
|
#include "SMESH_Group.hxx"
|
||||||
#include "SMESHDS_Group.hxx"
|
#include "SMESHDS_Group.hxx"
|
||||||
#include "SMESHDS_Script.hxx"
|
#include "SMESHDS_Script.hxx"
|
||||||
|
#include "SMESHDS_GroupOnGeom.hxx"
|
||||||
#include "SMDS_MeshVolume.hxx"
|
#include "SMDS_MeshVolume.hxx"
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
@ -110,15 +111,39 @@ SMESH_Mesh::~SMESH_Mesh()
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape){
|
void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
||||||
|
{
|
||||||
if(MYDEBUG) MESSAGE("SMESH_Mesh::ShapeToMesh");
|
if(MYDEBUG) MESSAGE("SMESH_Mesh::ShapeToMesh");
|
||||||
|
|
||||||
|
if ( !_myMeshDS->ShapeToMesh().IsNull() && aShape.IsNull() )
|
||||||
|
{
|
||||||
|
// removal of a shape to mesh, delete objects referring to sub-shapes:
|
||||||
|
// - sub-meshes
|
||||||
|
map <int, SMESH_subMesh *>::iterator i_sm = _mapSubMesh.begin();
|
||||||
|
for ( ; i_sm != _mapSubMesh.end(); ++i_sm )
|
||||||
|
delete i_sm->second;
|
||||||
|
_mapSubMesh.clear();
|
||||||
|
// - groups on geometry
|
||||||
|
map <int, SMESH_Group *>::iterator i_gr = _mapGroup.begin();
|
||||||
|
while ( i_gr != _mapGroup.end() ) {
|
||||||
|
if ( dynamic_cast<SMESHDS_GroupOnGeom*>( i_gr->second->GetGroupDS() )) {
|
||||||
|
_myMeshDS->RemoveGroup( i_gr->second->GetGroupDS() );
|
||||||
|
delete i_gr->second;
|
||||||
|
_mapGroup.erase( i_gr++ );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
i_gr++;
|
||||||
|
}
|
||||||
|
_mapAncestors.Clear();
|
||||||
|
_mapPropagationChains.Clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (_isShapeToMesh)
|
if (_isShapeToMesh)
|
||||||
throw
|
throw SALOME_Exception(LOCALIZED ("a shape to mesh has already been defined"));
|
||||||
SALOME_Exception(LOCALIZED
|
}
|
||||||
("a shape to mesh as already been defined"));
|
|
||||||
_isShapeToMesh = true;
|
_isShapeToMesh = true;
|
||||||
_myMeshDS->ShapeToMesh(aShape);
|
_myMeshDS->ShapeToMesh(aShape);
|
||||||
|
|
||||||
// NRI : 24/02/03
|
// NRI : 24/02/03
|
||||||
//EAP: 1/9/04 TopExp::MapShapes(aShape, _subShapes); USE the same map of _myMeshDS
|
//EAP: 1/9/04 TopExp::MapShapes(aShape, _subShapes); USE the same map of _myMeshDS
|
||||||
}
|
}
|
||||||
@ -132,7 +157,7 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName)
|
|||||||
{
|
{
|
||||||
if(MYDEBUG) MESSAGE("UNVToMesh - theFileName = "<<theFileName);
|
if(MYDEBUG) MESSAGE("UNVToMesh - theFileName = "<<theFileName);
|
||||||
if(_isShapeToMesh)
|
if(_isShapeToMesh)
|
||||||
throw SALOME_Exception(LOCALIZED("a shape to mesh as already been defined"));
|
throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
|
||||||
_isShapeToMesh = true;
|
_isShapeToMesh = true;
|
||||||
DriverUNV_R_SMDS_Mesh myReader;
|
DriverUNV_R_SMDS_Mesh myReader;
|
||||||
myReader.SetMesh(_myMeshDS);
|
myReader.SetMesh(_myMeshDS);
|
||||||
@ -157,7 +182,7 @@ int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
|
|||||||
{
|
{
|
||||||
if(MYDEBUG) MESSAGE("MEDToMesh - theFileName = "<<theFileName<<", mesh name = "<<theMeshName);
|
if(MYDEBUG) MESSAGE("MEDToMesh - theFileName = "<<theFileName<<", mesh name = "<<theMeshName);
|
||||||
if(_isShapeToMesh)
|
if(_isShapeToMesh)
|
||||||
throw SALOME_Exception(LOCALIZED("a shape to mesh as already been defined"));
|
throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
|
||||||
_isShapeToMesh = true;
|
_isShapeToMesh = true;
|
||||||
DriverMED_R_SMESHDS_Mesh myReader;
|
DriverMED_R_SMESHDS_Mesh myReader;
|
||||||
myReader.SetMesh(_myMeshDS);
|
myReader.SetMesh(_myMeshDS);
|
||||||
@ -199,7 +224,7 @@ int SMESH_Mesh::STLToMesh(const char* theFileName)
|
|||||||
{
|
{
|
||||||
if(MYDEBUG) MESSAGE("UNVToMesh - theFileName = "<<theFileName);
|
if(MYDEBUG) MESSAGE("UNVToMesh - theFileName = "<<theFileName);
|
||||||
if(_isShapeToMesh)
|
if(_isShapeToMesh)
|
||||||
throw SALOME_Exception(LOCALIZED("a shape to mesh as already been defined"));
|
throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
|
||||||
_isShapeToMesh = true;
|
_isShapeToMesh = true;
|
||||||
DriverSTL_R_SMDS_Mesh myReader;
|
DriverSTL_R_SMDS_Mesh myReader;
|
||||||
myReader.SetMesh(_myMeshDS);
|
myReader.SetMesh(_myMeshDS);
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "SMDS_VertexPosition.hxx"
|
#include "SMDS_VertexPosition.hxx"
|
||||||
#include "SMDS_EdgePosition.hxx"
|
#include "SMDS_EdgePosition.hxx"
|
||||||
#include "SMDS_FacePosition.hxx"
|
#include "SMDS_FacePosition.hxx"
|
||||||
|
#include "SMESHDS_GroupOnGeom.hxx"
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
#include <TopoDS_Iterator.hxx>
|
#include <TopoDS_Iterator.hxx>
|
||||||
@ -55,9 +56,38 @@ SMESHDS_Mesh::SMESHDS_Mesh(int MeshID):myMeshID(MeshID)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape & S)
|
void SMESHDS_Mesh::ShapeToMesh(const TopoDS_Shape & S)
|
||||||
{
|
{
|
||||||
|
if ( !myShape.IsNull() && S.IsNull() )
|
||||||
|
{
|
||||||
|
// removal of a shape to mesh, delete ...
|
||||||
|
// - hypotheses
|
||||||
|
myShapeToHypothesis.clear();
|
||||||
|
// - shape indices in SMDS_Position of nodes
|
||||||
|
map<int,SMESHDS_SubMesh*>::iterator i_sub = myShapeIndexToSubMesh.begin();
|
||||||
|
for ( ; i_sub != myShapeIndexToSubMesh.end(); i_sub++ ) {
|
||||||
|
if ( !i_sub->second->IsComplexSubmesh() ) {
|
||||||
|
SMDS_NodeIteratorPtr nIt = i_sub->second->GetNodes();
|
||||||
|
while ( nIt->more() )
|
||||||
|
nIt->next()->GetPosition()->SetShapeId( 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// - sub-meshes
|
||||||
|
myIndexToShape.Clear();
|
||||||
|
myShapeIndexToSubMesh.clear();
|
||||||
|
// - groups on geometry
|
||||||
|
set<SMESHDS_GroupBase*>::iterator gr = myGroups.begin();
|
||||||
|
while ( gr != myGroups.end() ) {
|
||||||
|
if ( dynamic_cast<SMESHDS_GroupOnGeom*>( *gr ))
|
||||||
|
myGroups.erase( gr++ );
|
||||||
|
else
|
||||||
|
gr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
myShape = S;
|
myShape = S;
|
||||||
|
if ( !S.IsNull() )
|
||||||
TopExp::MapShapes(myShape, myIndexToShape);
|
TopExp::MapShapes(myShape, myIndexToShape);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : AddHypothesis
|
//function : AddHypothesis
|
||||||
|
Loading…
Reference in New Issue
Block a user