throw(SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
+
+ const int prevNbMeshEnt = NbNodes() + NbElements();
+
if ( _preMeshInfo )
_preMeshInfo->ForgetOrLoad();
- const int prevNbMeshEnt = _impl->NbNodes() + _impl->GetMeshDS()->NbElements();
-
std::string error;
SMESH_Hypothesis::Hypothesis_Status status = addHypothesis( aSubShape, anHyp, &error );
anErrorText = error.c_str();
if ( n->NbInverseElements() == 0 )
_impl->GetMeshDS()->RemoveFreeNode( n, /*sm=*/0 );
+ _impl->GetMeshDS()->Modified();
+ _impl->SetIsModified( true );
+
// Update Python script (theGroup must be alive for this)
pyDump << SMESH::SMESH_Mesh_var(_this())
<< ".RemoveGroupWithContents( " << theGroup << " )";
bool geomChanged = true;
GEOM::GEOM_Object_var oldGeom = GetShapeToMesh();
if ( !theNewGeom->_is_nil() && !oldGeom->_is_nil() )
- geomChanged = ( //oldGeom->_is_equivalent( theNewGeom ) ||
- oldGeom->GetTick() < theNewGeom->GetTick() );
+ geomChanged = ( oldGeom->GetTick() != theNewGeom->GetTick() );
TopoDS_Shape S = _impl->GetShapeToMesh();
GEOM_Client* geomClient = _gen_i->GetShapeReader();
TCollection_AsciiString aIOR;
- CORBA::String_var ior;
if ( geomClient->Find( S, aIOR ))
geomClient->RemoveShapeFromBuffer( aIOR );
// clear buffer also for sub-groups
- const std::set<SMESHDS_GroupBase*>& groups = _impl->GetMeshDS()->GetGroups();
+ SMESHDS_Mesh* meshDS = _impl->GetMeshDS();
+ const std::set<SMESHDS_GroupBase*>& groups = meshDS->GetGroups();
std::set<SMESHDS_GroupBase*>::const_iterator g = groups.begin();
for (; g != groups.end(); ++g)
if (const SMESHDS_GroupOnGeom* group = dynamic_cast<SMESHDS_GroupOnGeom*>(*g))
geomClient->RemoveShapeFromBuffer( aIOR );
}
+ // clear buffer also for sub-meshes
+ std::map<int, SMESH_subMesh_i*>::const_iterator aSubMeshIter = _mapSubMesh_i.cbegin();
+ for(; aSubMeshIter != _mapSubMesh_i.cend(); aSubMeshIter++) {
+ int aShapeID = aSubMeshIter->first;
+ const TopoDS_Shape& aSubShape = meshDS->IndexToShape(aShapeID);
+ TCollection_AsciiString aShapeIOR;
+ if ( geomClient->Find( aSubShape, aShapeIOR ))
+ geomClient->RemoveShapeFromBuffer( aShapeIOR );
+ }
+
typedef struct {
int shapeID, fromID, toID; // indices of elements of a sub-mesh
} TRange;
std::vector< TRange > elemRanges, nodeRanges; // elements of sub-meshes
std::vector< SMDS_PositionPtr > positions; // node positions
- SMESHDS_Mesh* meshDS = _impl->GetMeshDS();
if ( !geomChanged )
{
// store positions of elements on geometry
{
SMESH_Mesh_i* _mesh;
TCallUp_i(SMESH_Mesh_i* mesh):_mesh(mesh) {}
- virtual void RemoveGroup (const int theGroupID) { _mesh->removeGroup( theGroupID ); }
- virtual void HypothesisModified( int hypID,
- bool updIcons) { _mesh->onHypothesisModified( hypID,
- updIcons ); }
- virtual void Load () { _mesh->Load(); }
- virtual bool IsLoaded() { return _mesh->IsLoaded(); }
+ void RemoveGroup (const int theGroupID) override { _mesh->removeGroup( theGroupID ); }
+ void HypothesisModified( int hypID,
+ bool updIcons) override { _mesh->onHypothesisModified( hypID,
+ updIcons ); }
+ void Load () override { _mesh->Load(); }
+ bool IsLoaded() override { return _mesh->IsLoaded(); }
+ TopoDS_Shape GetShapeByEntry(const std::string& entry) override
+ {
+ GEOM::GEOM_Object_var go = SMESH_Gen_i::GetGeomObjectByEntry( entry );
+ return SMESH_Gen_i::GeomObjectToShape( go );
+ }
};
}
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportMED( r'"
<< file << "', "
<< "auto_groups=" <<auto_groups << ", "
- << "minor=" << version << ", "
+ << "version=" << version << ", "
<< "overwrite=" << overwrite << ", "
<< "meshPart=None, "
<< "autoDimension=" << autoDimension << " )";
GEOM::GEOM_Object_var shapeVar = _gen_i->ShapeToGeomObject( shape );
_gen_i->PublishGroup( aMesh, groupVar, shapeVar, group->GetName());
}
+
if ( !addedIDs.empty() )
{
// python dump
- set<int>::iterator id = addedIDs.begin();
- for ( ; id != addedIDs.end(); ++id )
+ map<int, SMESH::SMESH_GroupBase_ptr>::iterator i_grp = _mapGroups.begin();
+ for ( int index = 0; i_grp != _mapGroups.end(); ++index, ++i_grp )
{
- map<int, SMESH::SMESH_GroupBase_ptr>::iterator it = _mapGroups.find(*id);
- int i = std::distance( _mapGroups.begin(), it );
- TPythonDump() << it->second << " = " << aMesh << ".GetGroups()[ "<< i << " ]";
+ set<int>::iterator it = addedIDs.find( i_grp->first );
+ if ( it != addedIDs.end() )
+ {
+ TPythonDump() << i_grp->second << " = " << aMesh << ".GetGroups()[ "<< index << " ]";
+ addedIDs.erase( it );
+ if ( addedIDs.empty() )
+ break;
+ }
}
}
}
TDimHypList dimHypListArr[4]; // dimHyp list for each shape dimension
map<int, ::SMESH_subMesh*>::iterator i_sm = _mapSubMesh.begin();
- for ( ; i_sm != _mapSubMesh.end(); i_sm++ ) {
+ for ( ; i_sm != _mapSubMesh.end(); i_sm++ )
+ {
::SMESH_subMesh* sm = (*i_sm).second;
// shape of submesh
const TopoDS_Shape& aSubMeshShape = sm->GetSubShape();
// Find out dimensions where the submesh can be concurrent.
// We define the dimensions by algo of each of hypotheses in hypList
list <const SMESHDS_Hypothesis*>::const_iterator hypIt = hypList.begin();
- for( ; hypIt != hypList.end(); hypIt++ ) {
+ for( ; hypIt != hypList.end(); hypIt++ )
+ {
SMESH_Algo* anAlgo = 0;
const SMESH_Hypothesis* hyp = dynamic_cast<const SMESH_Hypothesis*>(*hypIt);
if ( hyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO )