X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Mesh_i.cxx;h=b5c003e4c3b292fc5764cd60495a741205b11ac3;hb=16d4535b347502e1467045dc1a27a5eaad9eebc7;hp=93cdb1ea95550f61f7c057167f60cd5b8fbc7a66;hpb=4b5a9b85aebed2ccc12fe282ee52be127235e052;p=modules%2Fsmesh.git diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 93cdb1ea9..b5c003e4c 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -183,7 +183,6 @@ SMESH_Mesh_i::~SMESH_Mesh_i() //============================================================================= void SMESH_Mesh_i::SetShape( GEOM::GEOM_Object_ptr theShapeObject ) - throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); try { @@ -206,7 +205,6 @@ void SMESH_Mesh_i::SetShape( GEOM::GEOM_Object_ptr theShapeObject ) //================================================================================ CORBA::Boolean SMESH_Mesh_i::HasShapeToMesh() - throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); bool res = false; @@ -226,7 +224,6 @@ CORBA::Boolean SMESH_Mesh_i::HasShapeToMesh() //================================================================================ GEOM::GEOM_Object_ptr SMESH_Mesh_i::GetShapeToMesh() - throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); GEOM::GEOM_Object_var aShapeObj; @@ -263,7 +260,7 @@ GEOM::GEOM_Object_ptr SMESH_Mesh_i::GetShapeToMesh() */ //================================================================================ -CORBA::Boolean SMESH_Mesh_i::IsLoaded() throw (SALOME::SALOME_Exception) +CORBA::Boolean SMESH_Mesh_i::IsLoaded() { Unexpect aCatch(SALOME_SalomeException); return !_preMeshInfo; @@ -275,7 +272,7 @@ CORBA::Boolean SMESH_Mesh_i::IsLoaded() throw (SALOME::SALOME_Exception) */ //================================================================================ -void SMESH_Mesh_i::Load() throw (SALOME::SALOME_Exception) +void SMESH_Mesh_i::Load() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -288,7 +285,7 @@ void SMESH_Mesh_i::Load() throw (SALOME::SALOME_Exception) */ //================================================================================ -void SMESH_Mesh_i::Clear() throw (SALOME::SALOME_Exception) +void SMESH_Mesh_i::Clear() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -315,7 +312,6 @@ void SMESH_Mesh_i::Clear() throw (SALOME::SALOME_Exception) //================================================================================ void SMESH_Mesh_i::ClearSubMesh(CORBA::Long ShapeID) - throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -394,7 +390,6 @@ static SMESH::ComputeError* ConvertComputeError( SMESH_ComputeErrorPtr errorPtr SMESH::DriverMED_ReadStatus SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName ) - throw ( SALOME::SALOME_Exception ) { Unexpect aCatch(SALOME_SalomeException); int status; @@ -433,7 +428,6 @@ SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName ) SMESH::DriverMED_ReadStatus SMESH_Mesh_i::ImportCGNSFile( const char* theFileName, const int theMeshIndex, std::string& theMeshName ) - throw ( SALOME::SALOME_Exception ) { Unexpect aCatch(SALOME_SalomeException); int status; @@ -499,7 +493,6 @@ SMESH::long_array* SMESH_Mesh_i::GetMEDVersionsCompatibleForAppend() //============================================================================= int SMESH_Mesh_i::ImportUNVFile( const char* theFileName ) - throw ( SALOME::SALOME_Exception ) { SMESH_TRY; @@ -529,7 +522,6 @@ int SMESH_Mesh_i::ImportUNVFile( const char* theFileName ) //============================================================================= int SMESH_Mesh_i::ImportSTLFile( const char* theFileName ) - throw ( SALOME::SALOME_Exception ) { SMESH_TRY; @@ -568,13 +560,12 @@ namespace //================================================================================ /*! - * \brief Import data from a GMF file and Return an error description + * \brief Import data from a GMF file and return an error description */ //================================================================================ SMESH::ComputeError* SMESH_Mesh_i::ImportGMFFile( const char* theFileName, bool theMakeRequiredGroups ) - throw (SALOME::SALOME_Exception) { SMESH_ComputeErrorPtr error; @@ -646,14 +637,14 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Object_ptr aSubShape, SMESH::SMESH_Hypothesis_ptr anHyp, CORBA::String_out anErrorText) - 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(); @@ -663,8 +654,8 @@ SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Object_ptr aSubShape, { _gen_i->AddHypothesisToShape( mesh, aSubShape, anHyp ); - int newNbMeshEnt = _impl->NbNodes() + _impl->GetMeshDS()->NbElements(); - if ( newNbMeshEnt != prevNbMeshEnt ) + //int newNbMeshEnt = _impl->NbNodes() + _impl->GetMeshDS()->NbElements(); + if ( prevNbMeshEnt > 0 /*newNbMeshEnt != prevNbMeshEnt*/ ) _gen_i->UpdateIcons( mesh ); } if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status ); @@ -739,7 +730,6 @@ SMESH_Mesh_i::addHypothesis(GEOM::GEOM_Object_ptr aSubShape, SMESH::Hypothesis_Status SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Object_ptr aSubShape, SMESH::SMESH_Hypothesis_ptr anHyp) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -818,7 +808,6 @@ SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Object_ptr aSubShape, SMESH::ListOfHypothesis * SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Object_ptr aSubShape) -throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if (MYDEBUG) MESSAGE("GetHypothesisList"); @@ -858,7 +847,7 @@ throw(SALOME::SALOME_Exception) */ //================================================================================ -SMESH::submesh_array* SMESH_Mesh_i::GetSubMeshes() throw (SALOME::SALOME_Exception) +SMESH::submesh_array* SMESH_Mesh_i::GetSubMeshes() { Unexpect aCatch(SALOME_SalomeException); if (MYDEBUG) MESSAGE("GetSubMeshes"); @@ -902,7 +891,6 @@ SMESH::submesh_array* SMESH_Mesh_i::GetSubMeshes() throw (SALOME::SALOME_Excepti SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Object_ptr aSubShape, const char* theName ) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if (CORBA::is_nil(aSubShape)) @@ -954,7 +942,6 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Object_ptr aSubShap //================================================================================ void SMESH_Mesh_i::RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh ) - throw (SALOME::SALOME_Exception) { SMESH_TRY; @@ -998,7 +985,6 @@ void SMESH_Mesh_i::RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh ) SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateGroup( SMESH::ElementType theElemType, const char* theName ) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -1030,7 +1016,6 @@ SMESH::SMESH_GroupOnGeom_ptr SMESH_Mesh_i::CreateGroupFromGEOM (SMESH::ElementType theElemType, const char* theName, GEOM::GEOM_Object_ptr theGeomObj) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -1072,7 +1057,6 @@ SMESH::SMESH_GroupOnFilter_ptr SMESH_Mesh_i::CreateGroupFromFilter(SMESH::ElementType theElemType, const char* theName, SMESH::Filter_ptr theFilter ) - throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -1112,7 +1096,6 @@ SMESH_Mesh_i::CreateGroupFromFilter(SMESH::ElementType theElemType, //================================================================================ void SMESH_Mesh_i::RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup ) - throw (SALOME::SALOME_Exception) { if ( theGroup->_is_nil() ) return; @@ -1152,7 +1135,6 @@ void SMESH_Mesh_i::RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup ) //============================================================================= void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup ) - throw (SALOME::SALOME_Exception) { SMESH_TRY; if ( _preMeshInfo ) @@ -1212,6 +1194,9 @@ void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup 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 << " )"; @@ -1226,7 +1211,7 @@ void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup */ //================================================================================ -SMESH::ListOfGroups * SMESH_Mesh_i::GetGroups() throw(SALOME::SALOME_Exception) +SMESH::ListOfGroups * SMESH_Mesh_i::GetGroups() { Unexpect aCatch(SALOME_SalomeException); if (MYDEBUG) MESSAGE("GetGroups"); @@ -1265,7 +1250,7 @@ SMESH::ListOfGroups * SMESH_Mesh_i::GetGroups() throw(SALOME::SALOME_Exception) */ //============================================================================= -CORBA::Long SMESH_Mesh_i::NbGroups() throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbGroups() { Unexpect aCatch(SALOME_SalomeException); return _mapGroups.size(); @@ -1280,7 +1265,6 @@ CORBA::Long SMESH_Mesh_i::NbGroups() throw (SALOME::SALOME_Exception) SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionGroups( SMESH::SMESH_GroupBase_ptr theGroup1, SMESH::SMESH_GroupBase_ptr theGroup2, const char* theName ) - throw (SALOME::SALOME_Exception) { SMESH::SMESH_Group_var aResGrp; @@ -1324,7 +1308,6 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionGroups( SMESH::SMESH_GroupBase_ptr the SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionListOfGroups(const SMESH::ListOfGroups& theGroups, const char* theName ) - throw (SALOME::SALOME_Exception) { SMESH::SMESH_Group_var aResGrp; @@ -1387,7 +1370,6 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::UnionListOfGroups(const SMESH::ListOfGroups SMESH::SMESH_Group_ptr SMESH_Mesh_i::IntersectGroups( SMESH::SMESH_GroupBase_ptr theGroup1, SMESH::SMESH_GroupBase_ptr theGroup2, const char* theName ) - throw (SALOME::SALOME_Exception) { SMESH::SMESH_Group_var aResGrp; @@ -1453,7 +1435,6 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::IntersectGroups( SMESH::SMESH_GroupBase_ptr SMESH::SMESH_Group_ptr SMESH_Mesh_i::IntersectListOfGroups(const SMESH::ListOfGroups& theGroups, const char* theName ) - throw (SALOME::SALOME_Exception) { SMESH::SMESH_Group_var aResGrp; @@ -1537,7 +1518,6 @@ SMESH_Mesh_i::IntersectListOfGroups(const SMESH::ListOfGroups& theGroups, SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutGroups( SMESH::SMESH_GroupBase_ptr theGroup1, SMESH::SMESH_GroupBase_ptr theGroup2, const char* theName ) - throw (SALOME::SALOME_Exception) { SMESH::SMESH_Group_var aResGrp; @@ -1604,7 +1584,6 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CutListOfGroups(const SMESH::ListOfGroups& theMainGroups, const SMESH::ListOfGroups& theToolGroups, const char* theName ) - throw (SALOME::SALOME_Exception) { SMESH::SMESH_Group_var aResGrp; @@ -1693,25 +1672,25 @@ SMESH_Mesh_i::CutListOfGroups(const SMESH::ListOfGroups& theMainGroups, namespace // functions making checks according to SMESH::NB_COMMON_NODES_ENUM { - bool isAllNodesCommon(int nbChecked, int nbCommon, int nbNodes, int nbCorners, + bool isAllNodesCommon(int nbChecked, int nbCommon, int nbNodes, int /*nbCorners*/, bool & toStopChecking ) { toStopChecking = ( nbCommon < nbChecked ); return nbCommon == nbNodes; } - bool isMainNodesCommon(int nbChecked, int nbCommon, int nbNodes, int nbCorners, + bool isMainNodesCommon(int nbChecked, int nbCommon, int /*nbNodes*/, int nbCorners, bool & toStopChecking ) { toStopChecking = ( nbCommon < nbChecked || nbChecked >= nbCorners ); return nbCommon == nbCorners; } - bool isAtLeastOneNodeCommon(int nbChecked, int nbCommon, int nbNodes, int nbCorners, - bool & toStopChecking ) + bool isAtLeastOneNodeCommon(int /*nbChecked*/, int nbCommon, int /*nbNodes*/, int /*nbCorners*/, + bool & /*toStopChecking*/ ) { return nbCommon > 0; } - bool isMajorityOfNodesCommon(int nbChecked, int nbCommon, int nbNodes, int nbCorners, - bool & toStopChecking ) + bool isMajorityOfNodesCommon(int /*nbChecked*/, int nbCommon, int nbNodes, int /*nbCorners*/, + bool & /*toStopChecking*/ ) { return nbCommon >= (nbNodes+1) / 2; } @@ -1737,7 +1716,6 @@ SMESH_Mesh_i::CreateDimGroup(const SMESH::ListOfIDSources& theGroups, const char* theName, SMESH::NB_COMMON_NODES_ENUM theNbCommonNodes, CORBA::Boolean theUnderlyingOnly) - throw (SALOME::SALOME_Exception) { SMESH::SMESH_Group_var aResGrp; @@ -1918,7 +1896,6 @@ SMESH::ListOfGroups* SMESH_Mesh_i::FaceGroupsSeparatedByEdges( CORBA::Double theSharpAngle, CORBA::Boolean theCreateEdges, CORBA::Boolean theUseExistingEdges ) - throw (SALOME::SALOME_Exception) { if ( theSharpAngle < 0 || theSharpAngle > 180 ) THROW_SALOME_CORBA_EXCEPTION("Invalid sharp angle, it must be between 0 and 180 degrees", @@ -2046,24 +2023,22 @@ void SMESH_Mesh_i::removeGeomGroupData(CORBA::Object_ptr theSmeshObj) //================================================================================ void SMESH_Mesh_i::ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom) - throw (SALOME::SALOME_Exception) { // check if geometry changed 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& groups = _impl->GetMeshDS()->GetGroups(); + SMESHDS_Mesh* meshDS = _impl->GetMeshDS(); + const std::set& groups = meshDS->GetGroups(); std::set::const_iterator g = groups.begin(); for (; g != groups.end(); ++g) if (const SMESHDS_GroupOnGeom* group = dynamic_cast(*g)) @@ -2073,12 +2048,21 @@ void SMESH_Mesh_i::ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom) geomClient->RemoveShapeFromBuffer( aIOR ); } + // clear buffer also for sub-meshes + std::map::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 @@ -3041,7 +3025,6 @@ void SMESH_Mesh_i::CheckGeomGroupModif() //============================================================================= SMESH::SMESH_Group_ptr SMESH_Mesh_i::ConvertToStandalone( SMESH::SMESH_GroupBase_ptr theGroup ) - throw (SALOME::SALOME_Exception) { SMESH::SMESH_Group_var aGroup; @@ -3164,7 +3147,7 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::createSubMesh( GEOM::GEOM_Object_ptr theS // register CORBA object for persistence int nextId = _gen_i->RegisterObject( subMesh ); if(MYDEBUG) { MESSAGE( "Add submesh to map with id = "<< nextId); } - else { nextId = 0; } // avoid "unused variable" warning + else { (void)nextId; } // avoid "unused variable" warning // to track changes of GEOM groups if ( subMeshId > 0 ) @@ -3343,7 +3326,6 @@ void SMESH_Mesh_i::removeGroup( const int theId ) //================================================================================ SMESH::log_array * SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) - throw(SALOME::SALOME_Exception) { SMESH::log_array_var aLog; @@ -3396,7 +3378,7 @@ SMESH::log_array * SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) */ //================================================================================ -void SMESH_Mesh_i::ClearLog() throw(SALOME::SALOME_Exception) +void SMESH_Mesh_i::ClearLog() { SMESH_TRY; _impl->ClearLog(); @@ -3409,7 +3391,7 @@ void SMESH_Mesh_i::ClearLog() throw(SALOME::SALOME_Exception) */ //================================================================================ -CORBA::Long SMESH_Mesh_i::GetId()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::GetId() { return _id; } @@ -3424,12 +3406,17 @@ namespace { 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 ); + } }; } @@ -3510,7 +3497,6 @@ void SMESH_Mesh_i::SetImpl(::SMESH_Mesh * impl) //============================================================================= SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor() - throw (SALOME::SALOME_Exception) { SMESH::SMESH_MeshEditor_var aMeshEdVar; @@ -3539,7 +3525,6 @@ SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor() //============================================================================= SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditPreviewer() - throw (SALOME::SALOME_Exception) { SMESH::SMESH_MeshEditor_var aMeshEdVar; @@ -3563,7 +3548,7 @@ SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditPreviewer() */ //================================================================================ -CORBA::Boolean SMESH_Mesh_i::HasModificationsToDiscard() throw(SALOME::SALOME_Exception) +CORBA::Boolean SMESH_Mesh_i::HasModificationsToDiscard() { Unexpect aCatch(SALOME_SalomeException); return _impl->HasModificationsToDiscard(); @@ -3611,7 +3596,7 @@ static SALOMEDS::Color getUniqueColor( const std::list& theRese */ //============================================================================= -void SMESH_Mesh_i::SetAutoColor(CORBA::Boolean theAutoColor) throw(SALOME::SALOME_Exception) +void SMESH_Mesh_i::SetAutoColor(CORBA::Boolean theAutoColor) { Unexpect aCatch(SALOME_SalomeException); _impl->SetAutoColor(theAutoColor); @@ -3635,7 +3620,7 @@ void SMESH_Mesh_i::SetAutoColor(CORBA::Boolean theAutoColor) throw(SALOME::SALOM */ //============================================================================= -CORBA::Boolean SMESH_Mesh_i::GetAutoColor() throw(SALOME::SALOME_Exception) +CORBA::Boolean SMESH_Mesh_i::GetAutoColor() { Unexpect aCatch(SALOME_SalomeException); return _impl->GetAutoColor(); @@ -3752,7 +3737,6 @@ void SMESH_Mesh_i::ExportMED(const char* file, CORBA::Long version, CORBA::Boolean overwrite, CORBA::Boolean autoDimension) - throw(SALOME::SALOME_Exception) { //MESSAGE("MED minor version: "<< minor); SMESH_TRY; @@ -3765,7 +3749,7 @@ void SMESH_Mesh_i::ExportMED(const char* file, TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportMED( r'" << file << "', " << "auto_groups=" <NbBiQuadTriangles(); } -CORBA::Long SMESH_Mesh_i::NbQuadrangles()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbQuadrangles() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4561,7 +4534,7 @@ CORBA::Long SMESH_Mesh_i::NbQuadrangles()throw(SALOME::SALOME_Exception) return _impl->NbQuadrangles(); } -CORBA::Long SMESH_Mesh_i::NbBiQuadQuadrangles()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbBiQuadQuadrangles() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4570,7 +4543,7 @@ CORBA::Long SMESH_Mesh_i::NbBiQuadQuadrangles()throw(SALOME::SALOME_Exception) return _impl->NbBiQuadQuadrangles(); } -CORBA::Long SMESH_Mesh_i::NbPolygons() throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbPolygons() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4579,7 +4552,7 @@ CORBA::Long SMESH_Mesh_i::NbPolygons() throw(SALOME::SALOME_Exception) return _impl->NbPolygons(); } -CORBA::Long SMESH_Mesh_i::NbPolygonsOfOrder(SMESH::ElementOrder order) throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbPolygonsOfOrder(SMESH::ElementOrder order) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4589,7 +4562,6 @@ CORBA::Long SMESH_Mesh_i::NbPolygonsOfOrder(SMESH::ElementOrder order) throw(SAL } CORBA::Long SMESH_Mesh_i::NbFacesOfOrder(SMESH::ElementOrder order) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4599,7 +4571,6 @@ CORBA::Long SMESH_Mesh_i::NbFacesOfOrder(SMESH::ElementOrder order) } CORBA::Long SMESH_Mesh_i::NbTrianglesOfOrder(SMESH::ElementOrder order) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4609,7 +4580,6 @@ CORBA::Long SMESH_Mesh_i::NbTrianglesOfOrder(SMESH::ElementOrder order) } CORBA::Long SMESH_Mesh_i::NbQuadranglesOfOrder(SMESH::ElementOrder order) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4620,7 +4590,7 @@ CORBA::Long SMESH_Mesh_i::NbQuadranglesOfOrder(SMESH::ElementOrder order) //============================================================================= -CORBA::Long SMESH_Mesh_i::NbVolumes()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbVolumes() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4629,7 +4599,7 @@ CORBA::Long SMESH_Mesh_i::NbVolumes()throw(SALOME::SALOME_Exception) return _impl->NbVolumes(); } -CORBA::Long SMESH_Mesh_i::NbTetras()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbTetras() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4638,7 +4608,7 @@ CORBA::Long SMESH_Mesh_i::NbTetras()throw(SALOME::SALOME_Exception) return _impl->NbTetras(); } -CORBA::Long SMESH_Mesh_i::NbHexas()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbHexas() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4647,7 +4617,7 @@ CORBA::Long SMESH_Mesh_i::NbHexas()throw(SALOME::SALOME_Exception) return _impl->NbHexas(); } -CORBA::Long SMESH_Mesh_i::NbTriQuadraticHexas()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbTriQuadraticHexas() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4656,7 +4626,7 @@ CORBA::Long SMESH_Mesh_i::NbTriQuadraticHexas()throw(SALOME::SALOME_Exception) return _impl->NbTriQuadraticHexas(); } -CORBA::Long SMESH_Mesh_i::NbPyramids()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbPyramids() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4665,7 +4635,7 @@ CORBA::Long SMESH_Mesh_i::NbPyramids()throw(SALOME::SALOME_Exception) return _impl->NbPyramids(); } -CORBA::Long SMESH_Mesh_i::NbPrisms()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbPrisms() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4674,7 +4644,7 @@ CORBA::Long SMESH_Mesh_i::NbPrisms()throw(SALOME::SALOME_Exception) return _impl->NbPrisms(); } -CORBA::Long SMESH_Mesh_i::NbHexagonalPrisms()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbHexagonalPrisms() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4683,7 +4653,7 @@ CORBA::Long SMESH_Mesh_i::NbHexagonalPrisms()throw(SALOME::SALOME_Exception) return _impl->NbHexagonalPrisms(); } -CORBA::Long SMESH_Mesh_i::NbPolyhedrons()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbPolyhedrons() { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4693,7 +4663,6 @@ CORBA::Long SMESH_Mesh_i::NbPolyhedrons()throw(SALOME::SALOME_Exception) } CORBA::Long SMESH_Mesh_i::NbVolumesOfOrder(SMESH::ElementOrder order) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4703,7 +4672,6 @@ CORBA::Long SMESH_Mesh_i::NbVolumesOfOrder(SMESH::ElementOrder order) } CORBA::Long SMESH_Mesh_i::NbTetrasOfOrder(SMESH::ElementOrder order) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4713,7 +4681,6 @@ CORBA::Long SMESH_Mesh_i::NbTetrasOfOrder(SMESH::ElementOrder order) } CORBA::Long SMESH_Mesh_i::NbHexasOfOrder(SMESH::ElementOrder order) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4723,7 +4690,6 @@ CORBA::Long SMESH_Mesh_i::NbHexasOfOrder(SMESH::ElementOrder order) } CORBA::Long SMESH_Mesh_i::NbPyramidsOfOrder(SMESH::ElementOrder order) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4733,7 +4699,6 @@ CORBA::Long SMESH_Mesh_i::NbPyramidsOfOrder(SMESH::ElementOrder order) } CORBA::Long SMESH_Mesh_i::NbPrismsOfOrder(SMESH::ElementOrder order) - throw(SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4748,7 +4713,7 @@ CORBA::Long SMESH_Mesh_i::NbPrismsOfOrder(SMESH::ElementOrder order) */ //============================================================================= -CORBA::Long SMESH_Mesh_i::NbSubMesh()throw(SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbSubMesh() { Unexpect aCatch(SALOME_SalomeException); return _mapSubMesh_i.size(); @@ -4785,7 +4750,6 @@ SMESH::long_array* SMESH_Mesh_i::GetIDs() //============================================================================= SMESH::long_array* SMESH_Mesh_i::GetElementsId() - throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4814,7 +4778,6 @@ SMESH::long_array* SMESH_Mesh_i::GetElementsId() //============================================================================= SMESH::long_array* SMESH_Mesh_i::GetElementsByType( SMESH::ElementType theElemType ) - throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4854,7 +4817,6 @@ SMESH::long_array* SMESH_Mesh_i::GetElementsByType( SMESH::ElementType theElemTy //============================================================================= SMESH::long_array* SMESH_Mesh_i::GetNodesId() - throw (SALOME::SALOME_Exception) { Unexpect aCatch(SALOME_SalomeException); if ( _preMeshInfo ) @@ -4882,7 +4844,6 @@ SMESH::long_array* SMESH_Mesh_i::GetNodesId() //============================================================================= SMESH::ElementType SMESH_Mesh_i::GetElementType( const CORBA::Long id, const bool iselem ) - throw (SALOME::SALOME_Exception) { SMESH::ElementType type = SMESH::ALL; SMESH_TRY; @@ -4904,7 +4865,6 @@ SMESH::ElementType SMESH_Mesh_i::GetElementType( const CORBA::Long id, const boo //============================================================================= SMESH::EntityType SMESH_Mesh_i::GetElementGeomType( const CORBA::Long id ) - throw (SALOME::SALOME_Exception) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -4923,7 +4883,6 @@ SMESH::EntityType SMESH_Mesh_i::GetElementGeomType( const CORBA::Long id ) //============================================================================= SMESH::GeometryType SMESH_Mesh_i::GetElementShape( const CORBA::Long id ) - throw (SALOME::SALOME_Exception) { if ( _preMeshInfo ) _preMeshInfo->FullLoadFromFile(); @@ -4942,7 +4901,6 @@ SMESH::GeometryType SMESH_Mesh_i::GetElementShape( const CORBA::Long id ) //============================================================================= SMESH::long_array* SMESH_Mesh_i::GetSubMeshElementsId(const CORBA::Long ShapeID) - throw (SALOME::SALOME_Exception) { SMESH::long_array_var aResult = new SMESH::long_array(); @@ -4972,14 +4930,13 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshElementsId(const CORBA::Long ShapeID) //============================================================================= /*! * Return ID of nodes for given sub-mesh - * If param all==true - Return all nodes, else - + * If param all==true - return all nodes, else - * Return only nodes on shapes. */ //============================================================================= SMESH::long_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID, CORBA::Boolean all) - throw (SALOME::SALOME_Exception) { SMESH::long_array_var aResult = new SMESH::long_array(); @@ -5031,7 +4988,6 @@ SMESH::long_array* SMESH_Mesh_i::GetSubMeshNodesId(const CORBA::Long ShapeID, //============================================================================= SMESH::ElementType SMESH_Mesh_i::GetSubMeshElementType(const CORBA::Long ShapeID) - throw (SALOME::SALOME_Exception) { SMESH::ElementType type = SMESH::ALL; @@ -5079,7 +5035,7 @@ CORBA::LongLong SMESH_Mesh_i::GetMeshPtr() //============================================================================= /*! * Get XYZ coordinates of node as list of double - * If there is not node for given ID - Return empty list + * If there is not node for given ID - return empty list */ //============================================================================= @@ -5109,8 +5065,8 @@ SMESH::double_array* SMESH_Mesh_i::GetNodeXYZ(const CORBA::Long id) //============================================================================= /*! - * For given node Return list of IDs of inverse elements - * If there is not node for given ID - Return empty list + * For given node return list of IDs of inverse elements + * If there is not node for given ID - return empty list */ //============================================================================= @@ -5243,8 +5199,8 @@ SMESH::ElementPosition SMESH_Mesh_i::GetElementPosition(CORBA::Long ElemID) //============================================================================= /*! - * If given element is node Return IDs of shape from position - * If there is not node for given ID - Return -1 + * If given element is node return IDs of shape from position + * If there is not node for given ID - return -1 */ //============================================================================= @@ -5271,7 +5227,7 @@ CORBA::Long SMESH_Mesh_i::GetShapeID(const CORBA::Long id) /*! * For given element return ID of result shape after * ::FindShape() from SMESH_MeshEditor - * If there is not element for given ID - Return -1 + * If there is not element for given ID - return -1 */ //============================================================================= @@ -5301,7 +5257,7 @@ CORBA::Long SMESH_Mesh_i::GetShapeIDForElem(const CORBA::Long id) //============================================================================= /*! * Return number of nodes for given element - * If there is not element for given ID - Return -1 + * If there is not element for given ID - return -1 */ //============================================================================= @@ -5322,8 +5278,8 @@ CORBA::Long SMESH_Mesh_i::GetElemNbNodes(const CORBA::Long id) //============================================================================= /*! * Return ID of node by given index for given element - * If there is not element for given ID - Return -1 - * If there is not node for given index - Return -2 + * If there is not element for given ID - return -1 + * If there is not node for given index - return -2 */ //============================================================================= @@ -5691,7 +5647,6 @@ SMESH::double_array* SMESH_Mesh_i::BaryCenter(const CORBA::Long id) SMESH::ListOfGroups* SMESH_Mesh_i::MakeGroupsOfBadInputElements( int theSubShapeID, const char* theGroupName ) - throw ( SALOME::SALOME_Exception ) { Unexpect aCatch(SALOME_SalomeException); @@ -5815,21 +5770,27 @@ void SMESH_Mesh_i::CreateGroupServants() // register CORBA object for persistence int nextId = _gen_i->RegisterObject( groupVar ); if(MYDEBUG) { MESSAGE( "Add group to map with id = "<< nextId); } - else { nextId = 0; } // avoid "unused variable" warning in release mode + else { (void)nextId; } // avoid "unused variable" warning in release mode // publishing the groups in the study GEOM::GEOM_Object_var shapeVar = _gen_i->ShapeToGeomObject( shape ); _gen_i->PublishGroup( aMesh, groupVar, shapeVar, group->GetName()); } + if ( !addedIDs.empty() ) { // python dump - set::iterator id = addedIDs.begin(); - for ( ; id != addedIDs.end(); ++id ) + map::iterator i_grp = _mapGroups.begin(); + for ( int index = 0; i_grp != _mapGroups.end(); ++index, ++i_grp ) { - map::iterator it = _mapGroups.find(*id); - int i = std::distance( _mapGroups.begin(), it ); - TPythonDump() << it->second << " = " << aMesh << ".GetGroups()[ "<< i << " ]"; + set::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; + } } } } @@ -6045,7 +6006,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Mesh_i::GetMesh() //================================================================================ /*! - * \brief Return false if GetMeshInfo() Return incorrect information that may + * \brief Return false if GetMeshInfo() return incorrect information that may * happen if mesh data is not yet fully loaded from the file of study. * * @@ -6425,8 +6386,8 @@ class SMESH_DimHyp //! fields int _dim; //!< a dimension the algo can build (concurrent dimension) int _ownDim; //!< dimension of shape of _subMesh (>=_dim) - TopTools_MapOfShape _shapeMap; - SMESH_subMesh* _subMesh; + TopTools_MapOfShape _shapeMap; //!< [sub-]shapes of dimension == _dim + const SMESH_subMesh* _subMesh; list _hypotheses; //!< algo is first, then its parameters //----------------------------------------------------------------------------- @@ -6440,7 +6401,7 @@ class SMESH_DimHyp const int theDim, const TopoDS_Shape& theShape) { - _subMesh = (SMESH_subMesh*)theSubMesh; + _subMesh = theSubMesh; SetShape( theDim, theShape ); } @@ -6470,7 +6431,7 @@ class SMESH_DimHyp TopTools_MapIteratorOfMapOfShape anItr( theToCheck ); for (; !isShared && anItr.More(); anItr.Next() ) { - const TopoDS_Shape aSubSh = anItr.Key(); + const TopoDS_Shape& aSubSh = anItr.Key(); // check for case when concurrent dimensions are same isShared = theToFind.Contains( aSubSh ); // check for sub-shape with concurrent dimension @@ -6522,9 +6483,11 @@ class SMESH_DimHyp bool isSame = checkAlgo( a1, a2 ); if ( !isSame ) { - if ( !a1 || !a2 ) - return false; // pb? - return a1->GetDim() == a2->GetDim(); // different algorithms of same dim -> concurrency ! + return true; + // commented off for IPAL54678 + // if ( !a1 || !a2 ) + // return false; // pb? + // return a1->GetDim() == a2->GetDim(); // different algorithms of same dim -> concurrency ! } // check hypothesises for concurrence (skip first as algorithm) @@ -6565,8 +6528,12 @@ void addDimHypInstance(const int theDim, const list & theHypList, TDimHypList* theDimHypListArr ) { + if ( !theAlgo->NeedDiscreteBoundary() && + theAlgo->NeedLowerHyps( theDim )) // IPAL54678 + return; TDimHypList& listOfdimHyp = theDimHypListArr[theDim]; - if ( listOfdimHyp.empty() || listOfdimHyp.back()->_subMesh != theSubMesh ) { + if ( listOfdimHyp.empty() || listOfdimHyp.back()->_subMesh != theSubMesh ) + { SMESH_DimHyp* dimHyp = new SMESH_DimHyp( theSubMesh, theDim, theShape ); dimHyp->_hypotheses.push_front(theAlgo); listOfdimHyp.push_back( dimHyp ); @@ -6617,12 +6584,16 @@ void findConcurrents(const SMESH_DimHyp* theDimHyp, } //----------------------------------------------------------------------------- -void unionLists(TListOfInt& theListOfId, +bool unionLists(TListOfInt& theListOfId, TListOfListOfInt& theListOfListOfId, const int theIndx ) { + bool changed = false; + if ( theListOfId.empty() ) + return changed; TListOfListOfInt::iterator it = theListOfListOfId.begin(); - for ( int i = 0; it != theListOfListOfId.end(); it++, i++ ) { + for ( int i = 0; it != theListOfListOfId.end(); it++, i++ ) + { if ( i < theIndx ) continue; //skip already treated lists // check if other list has any same submesh object @@ -6635,11 +6606,15 @@ void unionLists(TListOfInt& theListOfId, TListOfInt::iterator it2 = otherListOfId.begin(); for ( ; it2 != otherListOfId.end(); it2++ ) { if ( find( theListOfId.begin(), theListOfId.end(), (*it2) ) == theListOfId.end() ) + { theListOfId.push_back(*it2); + changed = true; + } } // clear source list otherListOfId.clear(); } + return changed; } //----------------------------------------------------------------------------- @@ -6707,7 +6682,7 @@ CORBA::Boolean SMESH_Mesh_i::IsUnorderedSubMesh(CORBA::Long submeshID) //============================================================================= /*! - * \brief Return submesh objects list in meshing order + * \brief Return sub-mesh objects list in meshing order */ //============================================================================= @@ -6723,10 +6698,15 @@ SMESH::submesh_array_array* SMESH_Mesh_i::GetMeshOrder() TListOfListOfInt allConurrent = findConcurrentSubMeshes(); anOrder.splice( anOrder.end(), allConurrent ); - int listIndx = 0; - TListOfListOfInt::iterator listIt = anOrder.begin(); - for(; listIt != anOrder.end(); listIt++, listIndx++ ) - unionLists( *listIt, anOrder, listIndx + 1 ); + bool changed; + do { + changed = false; + TListOfListOfInt::iterator listIt = anOrder.begin(); + for ( int listIndx = 1; listIt != anOrder.end(); listIt++, listIndx++ ) + if ( unionLists( *listIt, anOrder, listIndx )) + changed = true; + } + while ( changed ); // convert submesh ids into interface instances // and dump command into python @@ -6745,81 +6725,86 @@ TListOfListOfInt SMESH_Mesh_i::findConcurrentSubMeshes() { TListOfListOfInt anOrder; ::SMESH_Mesh& mesh = GetImpl(); - { - // collect submeshes and detect concurrent algorithms and hypothesises - TDimHypList dimHypListArr[4]; // dimHyp list for each shape dimension - - map::iterator i_sm = _mapSubMesh.begin(); - for ( ; i_sm != _mapSubMesh.end(); i_sm++ ) { - ::SMESH_subMesh* sm = (*i_sm).second; - // shape of submesh - const TopoDS_Shape& aSubMeshShape = sm->GetSubShape(); - - // list of assigned hypothesises - const list & hypList = mesh.GetHypothesisList(aSubMeshShape); - // Find out dimensions where the submesh can be concurrent. - // We define the dimensions by algo of each of hypotheses in hypList - list ::const_iterator hypIt = hypList.begin(); - for( ; hypIt != hypList.end(); hypIt++ ) { - SMESH_Algo* anAlgo = 0; - const SMESH_Hypothesis* hyp = dynamic_cast(*hypIt); - if ( hyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO ) - // hyp it-self is algo - anAlgo = (SMESH_Algo*)dynamic_cast(hyp); - else { - // try to find algorithm with help of sub-shapes - TopExp_Explorer anExp( aSubMeshShape, shapeTypeByDim(hyp->GetDim()) ); - for ( ; !anAlgo && anExp.More(); anExp.Next() ) - anAlgo = mesh.GetGen()->GetAlgo( mesh, anExp.Current() ); - } - if (!anAlgo) - continue; // no algorithm assigned to a current submesh - int dim = anAlgo->GetDim(); // top concurrent dimension (see comment to SMESH_DimHyp) - // the submesh can concurrent at (or lower dims if !anAlgo->NeedDiscreteBoundary()) + // collect submeshes and detect concurrent algorithms and hypothesises + TDimHypList dimHypListArr[4]; // dimHyp list for each shape dimension - // create instance of dimension-hypothesis for found concurrent dimension(s) and algorithm - for ( int j = anAlgo->NeedDiscreteBoundary() ? dim : 1, jn = dim; j <= jn; j++ ) - addDimHypInstance( j, aSubMeshShape, anAlgo, sm, hypList, dimHypListArr ); + map::iterator i_sm = _mapSubMesh.begin(); + for ( ; i_sm != _mapSubMesh.end(); i_sm++ ) + { + ::SMESH_subMesh* sm = (*i_sm).second; + // shape of submesh + const TopoDS_Shape& aSubMeshShape = sm->GetSubShape(); + + // list of assigned hypothesises + const list & hypList = mesh.GetHypothesisList(aSubMeshShape); + // Find out dimensions where the submesh can be concurrent. + // We define the dimensions by algo of each of hypotheses in hypList + list ::const_iterator hypIt = hypList.begin(); + for( ; hypIt != hypList.end(); hypIt++ ) + { + SMESH_Algo* anAlgo = 0; + const SMESH_Hypothesis* hyp = dynamic_cast(*hypIt); + if ( hyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO ) + // hyp it-self is algo + anAlgo = (SMESH_Algo*)dynamic_cast(hyp); + else { + // try to find algorithm with help of sub-shapes + TopExp_Explorer anExp( aSubMeshShape, shapeTypeByDim(hyp->GetDim()) ); + for ( ; !anAlgo && anExp.More(); anExp.Next() ) + anAlgo = mesh.GetGen()->GetAlgo( mesh, anExp.Current() ); } - } // end iterations on submesh + if (!anAlgo) + continue; // no algorithm assigned to a current submesh + + int dim = anAlgo->GetDim(); // top concurrent dimension (see comment to SMESH_DimHyp) + // the submesh can concurrent at (or lower dims if !anAlgo->NeedDiscreteBoundary() + // and !anAlgo->NeedLowerHyps( dim )) + + // create instance of dimension-hypothesis for found concurrent dimension(s) and algorithm + for ( int j = anAlgo->NeedDiscreteBoundary() ? dim : 1, jn = dim; j <= jn; j++ ) + addDimHypInstance( j, aSubMeshShape, anAlgo, sm, hypList, dimHypListArr ); + } + } // end iterations on submesh // iterate on created dimension-hypotheses and check for concurrents - for ( int i = 0; i < 4; i++ ) { - const TDimHypList& listOfDimHyp = dimHypListArr[i]; - // check for concurrents in own and other dimensions (step-by-step) - TDimHypList::const_iterator dhIt = listOfDimHyp.begin(); - for ( ; dhIt != listOfDimHyp.end(); dhIt++ ) { - const SMESH_DimHyp* dimHyp = *dhIt; - TDimHypList listOfConcurr; - set setOfConcurrIds; - // looking for concurrents and collect into own list - for ( int j = i; j < 4; j++ ) - findConcurrents( dimHyp, dimHypListArr[j], listOfConcurr, setOfConcurrIds ); - // check if any concurrents found - if ( listOfConcurr.size() > 0 ) { - // add own submesh to list of concurrent - addInOrderOfPriority( dimHyp, listOfConcurr ); - list listOfConcurrIds; - TDimHypList::iterator hypIt = listOfConcurr.begin(); - for ( ; hypIt != listOfConcurr.end(); ++hypIt ) - listOfConcurrIds.push_back( (*hypIt)->_subMesh->GetId() ); - anOrder.push_back( listOfConcurrIds ); - } + for ( int i = 0; i < 4; i++ ) + { + const TDimHypList& listOfDimHyp = dimHypListArr[i]; + // check for concurrents in own and other dimensions (step-by-step) + TDimHypList::const_iterator dhIt = listOfDimHyp.begin(); + for ( ; dhIt != listOfDimHyp.end(); dhIt++ ) + { + const SMESH_DimHyp* dimHyp = *dhIt; + TDimHypList listOfConcurr; + set setOfConcurrIds; + // looking for concurrents and collect into own list + for ( int j = i; j < 4; j++ ) + findConcurrents( dimHyp, dimHypListArr[j], listOfConcurr, setOfConcurrIds ); + // check if any concurrents found + if ( listOfConcurr.size() > 0 ) + { + // add own submesh to list of concurrent + addInOrderOfPriority( dimHyp, listOfConcurr ); + list listOfConcurrIds; + TDimHypList::iterator hypIt = listOfConcurr.begin(); + for ( ; hypIt != listOfConcurr.end(); ++hypIt ) + listOfConcurrIds.push_back( (*hypIt)->_subMesh->GetId() ); + anOrder.push_back( listOfConcurrIds ); } } + } - removeDimHyps(dimHypListArr); + removeDimHyps(dimHypListArr); - // now, minimize the number of concurrent groups - // Here we assume that lists of submeshes can have same submesh - // in case of multi-dimension algorithms, as result - // list with common submesh has to be united into one list - int listIndx = 0; - TListOfListOfInt::iterator listIt = anOrder.begin(); - for(; listIt != anOrder.end(); listIt++, listIndx++ ) - unionLists( *listIt, anOrder, listIndx + 1 ); - } + // now, minimize the number of concurrent groups + // Here we assume that lists of submeshes can have same submesh + // in case of multi-dimension algorithms, as result + // list with common submesh has to be united into one list + int listIndx = 0; + TListOfListOfInt::iterator listIt = anOrder.begin(); + for(; listIt != anOrder.end(); listIt++, listIndx++ ) + unionLists( *listIt, anOrder, listIndx + 1 ); return anOrder; } @@ -6907,7 +6892,8 @@ void SMESH_Mesh_i::convertMeshOrder (const TListOfListOfInt& theIdsOrder, theResOrder.length(nbSet); TListOfListOfInt::const_iterator it = theIdsOrder.begin(); int listIndx = 0; - for( ; it != theIdsOrder.end(); it++ ) { + for( ; it != theIdsOrder.end(); it++ ) + { // translate submesh identificators into submesh objects // takeing into account real number of concurrent lists const TListOfInt& aSubOrder = (*it); @@ -6920,7 +6906,8 @@ void SMESH_Mesh_i::convertMeshOrder (const TListOfListOfInt& theIdsOrder, aResSubSet->length(aSubOrder.size()); TListOfInt::const_iterator subIt = aSubOrder.begin(); int j; - for( j = 0; subIt != aSubOrder.end(); subIt++ ) { + for( j = 0; subIt != aSubOrder.end(); subIt++ ) + { if ( _mapSubMeshIor.find(*subIt) == _mapSubMeshIor.end() ) continue; SMESH::SMESH_subMesh_var subMesh =