From: eap Date: Tue, 16 Sep 2008 14:38:08 +0000 (+0000) Subject: [SALOME platform 0013410]: SubMesh not taken into account with Netgen 1D-2D et 1D... X-Git-Tag: V4_1_4a1~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b27af1c2d250f1572f08df6869ce30281b42712c;p=modules%2Fsmesh.git [SALOME platform 0013410]: SubMesh not taken into account with Netgen 1D-2D et 1D-2D-3D const SMESH_Hypothesis * GetHypothesis(const TopoDS_Shape & aSubShape, const SMESH_HypoFilter& aFilter, - const bool andAncestors) const; + const bool andAncestors, + TopoDS_Shape* assignedTo=0) const; --- diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index 497bf9990..02383cb28 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -109,7 +109,7 @@ SMESH_Mesh::~SMESH_Mesh() INFOS("SMESH_Mesh::~SMESH_Mesh"); // delete groups - map < int, SMESH_Group * >::iterator itg; + std::map < int, SMESH_Group * >::iterator itg; for (itg = _mapGroup.begin(); itg != _mapGroup.end(); itg++) { SMESH_Group *aGroup = (*itg).second; delete aGroup; @@ -135,12 +135,12 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape) { // removal of a shape to mesh, delete objects referring to sub-shapes: // - sub-meshes - map ::iterator i_sm = _mapSubMesh.begin(); + std::map ::iterator i_sm = _mapSubMesh.begin(); for ( ; i_sm != _mapSubMesh.end(); ++i_sm ) delete i_sm->second; _mapSubMesh.clear(); // - groups on geometry - map ::iterator i_gr = _mapGroup.begin(); + std::map ::iterator i_gr = _mapGroup.begin(); while ( i_gr != _mapGroup.end() ) { if ( dynamic_cast( i_gr->second->GetGroupDS() )) { _myMeshDS->RemoveGroup( i_gr->second->GetGroupDS() ); @@ -332,10 +332,10 @@ int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName) } // Reading groups (sub-meshes are out of scope of MED import functionality) - list aGroupNames = myReader.GetGroupNamesAndTypes(); + std::list aGroupNames = myReader.GetGroupNamesAndTypes(); if(MYDEBUG) MESSAGE("MEDToMesh - Nb groups = "<::iterator name_type = aGroupNames.begin(); + std::list::iterator name_type = aGroupNames.begin(); for ( ; name_type != aGroupNames.end(); name_type++ ) { SMESH_Group* aGroup = AddGroup( name_type->second, name_type->first.c_str(), anId ); if ( aGroup ) { @@ -585,7 +585,7 @@ SMESH_Hypothesis::Hypothesis_Status */ //============================================================================= -const list& +const std::list& SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const throw(SALOME_Exception) { @@ -596,24 +596,28 @@ SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const //======================================================================= /*! * \brief Return the hypothesis assigned to the shape - * \param aSubShape - the shape to check - * \param aFilter - the hypothesis filter - * \param andAncestors - flag to check hypos assigned to ancestors of the shape - * \retval SMESH_Hypothesis* - the first hypo passed through aFilter + * \param aSubShape - the shape to check + * \param aFilter - the hypothesis filter + * \param andAncestors - flag to check hypos assigned to ancestors of the shape + * \param assignedTo - to return the shape the found hypo is assigned to + * \retval SMESH_Hypothesis* - the first hypo passed through aFilter */ //======================================================================= const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubShape, const SMESH_HypoFilter& aFilter, - const bool andAncestors) const + const bool andAncestors, + TopoDS_Shape* assignedTo) const { { - const list& hypList = _myMeshDS->GetHypothesis(aSubShape); - list::const_iterator hyp = hypList.begin(); + const std::list& hypList = _myMeshDS->GetHypothesis(aSubShape); + std::list::const_iterator hyp = hypList.begin(); for ( ; hyp != hypList.end(); hyp++ ) { const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp ); - if ( aFilter.IsOk( h, aSubShape)) + if ( aFilter.IsOk( h, aSubShape)) { + if ( assignedTo ) *assignedTo = aSubShape; return h; + } } } if ( andAncestors ) @@ -621,12 +625,14 @@ const SMESH_Hypothesis * SMESH_Mesh::GetHypothesis(const TopoDS_Shape & aSubS TopTools_ListIteratorOfListOfShape it( GetAncestors( aSubShape )); for (; it.More(); it.Next() ) { - const list& hypList = _myMeshDS->GetHypothesis(it.Value()); - list::const_iterator hyp = hypList.begin(); + const std::list& hypList = _myMeshDS->GetHypothesis(it.Value()); + std::list::const_iterator hyp = hypList.begin(); for ( ; hyp != hypList.end(); hyp++ ) { const SMESH_Hypothesis * h = cSMESH_Hyp( *hyp ); - if (aFilter.IsOk( h, it.Value() )) + if (aFilter.IsOk( h, it.Value() )) { + if ( assignedTo ) *assignedTo = it.Value(); return h; + } } } } @@ -656,7 +662,7 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape, bool mainHypFound = false; // fill in hypTypes - list::const_iterator hyp; + std::list::const_iterator hyp; for ( hyp = aHypList.begin(); hyp != aHypList.end(); hyp++ ) { if ( hypTypes.insert( (*hyp)->GetName() ).second ) nbHyps++; @@ -666,7 +672,7 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape, // get hypos from aSubShape { - const list& hypList = _myMeshDS->GetHypothesis(aSubShape); + const std::list& hypList = _myMeshDS->GetHypothesis(aSubShape); for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ ) if ( aFilter.IsOk (cSMESH_Hyp( *hyp ), aSubShape) && ( cSMESH_Hyp(*hyp)->IsAuxiliary() || !mainHypFound ) && @@ -688,7 +694,7 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape, { if ( !map.Add( it.Value() )) continue; - const list& hypList = _myMeshDS->GetHypothesis(it.Value()); + const std::list& hypList = _myMeshDS->GetHypothesis(it.Value()); for ( hyp = hypList.begin(); hyp != hypList.end(); hyp++ ) if (aFilter.IsOk( cSMESH_Hyp( *hyp ), it.Value() ) && ( cSMESH_Hyp(*hyp)->IsAuxiliary() || !mainHypFound ) && @@ -710,7 +716,7 @@ int SMESH_Mesh::GetHypotheses(const TopoDS_Shape & aSubShape, */ //============================================================================= -const list & SMESH_Mesh::GetLog() throw(SALOME_Exception) +const std::list & SMESH_Mesh::GetLog() throw(SALOME_Exception) { Unexpect aCatch(SalomeException); if(MYDEBUG) MESSAGE("SMESH_Mesh::GetLog"); @@ -808,19 +814,19 @@ throw(SALOME_Exception) */ //================================================================================ -list +std::list SMESH_Mesh::GetGroupSubMeshesContaining(const TopoDS_Shape & aSubShape) const throw(SALOME_Exception) { Unexpect aCatch(SalomeException); - list found; + std::list found; SMESH_subMesh * subMesh = GetSubMeshContaining(aSubShape); if ( !subMesh ) return found; // submeshes of groups have max IDs, so search from the map end - map::const_reverse_iterator i_sm; + std::map::const_reverse_iterator i_sm; for ( i_sm = _mapSubMesh.rbegin(); i_sm != _mapSubMesh.rend(); ++i_sm) { SMESHDS_SubMesh * ds = i_sm->second->GetSubMeshDS(); if ( ds && ds->IsComplexSubmesh() ) { @@ -978,9 +984,9 @@ bool SMESH_Mesh::GetAutoColor() throw(SALOME_Exception) bool SMESH_Mesh::HasDuplicatedGroupNamesMED() { set aGroupNames; - for ( map::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) { + for ( std::map::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) { SMESH_Group* aGroup = it->second; - string aGroupName = aGroup->GetName(); + std::string aGroupName = aGroup->GetName(); aGroupName.resize(MAX_MED_GROUP_NAME_LENGTH); if (!aGroupNames.insert(aGroupName).second) return true; @@ -1018,7 +1024,7 @@ void SMESH_Mesh::ExportMED(const char *file, set aGroupNames; char aString [256]; int maxNbIter = 10000; // to guarantee cycle finish - for ( map::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) { + for ( std::map::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) { SMESH_Group* aGroup = it->second; SMESHDS_GroupBase* aGroupDS = aGroup->GetGroupDS(); if ( aGroupDS ) { @@ -1058,11 +1064,11 @@ void SMESH_Mesh::ExportUNV(const char *file) throw(SALOME_Exception) myWriter.SetMeshId(_idDoc); // myWriter.SetGroups(_mapGroup); - for ( map::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) { + for ( std::map::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) { SMESH_Group* aGroup = it->second; SMESHDS_GroupBase* aGroupDS = aGroup->GetGroupDS(); if ( aGroupDS ) { - string aGroupName = aGroup->GetName(); + std::string aGroupName = aGroup->GetName(); aGroupDS->SetStoreName( aGroupName.c_str() ); myWriter.AddGroup( aGroupDS ); } @@ -1312,10 +1318,10 @@ SMESH_Group* SMESH_Mesh::GetGroup (const int theGroupID) */ //============================================================================= -list SMESH_Mesh::GetGroupIds() const +std::list SMESH_Mesh::GetGroupIds() const { - list anIds; - for ( map::const_iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) + std::list anIds; + for ( std::map::const_iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) anIds.push_back( it->first ); return anIds; @@ -1380,7 +1386,7 @@ ostream& SMESH_Mesh::Dump(ostream& save) save << clause << ".1) Number of " << orderStr << " triangles: \t" << nb3 << endl; save << clause << ".2) Number of " << orderStr << " quadrangles:\t" << nb4 << endl; if ( nb3 + nb4 != NbFaces(order) ) { - map myFaceMap; + std::map myFaceMap; SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator(); while( itFaces->more( ) ) { int nbNodes = itFaces->next()->NbNodes(); @@ -1405,7 +1411,7 @@ ostream& SMESH_Mesh::Dump(ostream& save) save << clause << ".3) Number of " << orderStr << " prisms: \t" << nb6 << endl; save << clause << ".4) Number of " << orderStr << " pyramids:\t" << nb5 << endl; if ( nb8 + nb4 + nb5 + nb6 != NbVolumes(order) ) { - map myVolumesMap; + std::map myVolumesMap; SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator(); while( itVolumes->more( ) ) { int nbNodes = itVolumes->next()->NbNodes(); diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx index 46ef2a959..5fb1c0ab4 100644 --- a/src/SMESH/SMESH_Mesh.hxx +++ b/src/SMESH/SMESH_Mesh.hxx @@ -109,7 +109,8 @@ public: const SMESH_Hypothesis * GetHypothesis(const TopoDS_Shape & aSubShape, const SMESH_HypoFilter& aFilter, - const bool andAncestors) const; + const bool andAncestors, + TopoDS_Shape* assignedTo=0) const; int GetHypotheses(const TopoDS_Shape & aSubShape, const SMESH_HypoFilter& aFilter, @@ -248,8 +249,8 @@ protected: std::list _subMeshesUsingHypothesisList; SMESHDS_Document * _myDocument; SMESHDS_Mesh * _myMeshDS; - map _mapSubMesh; - map _mapGroup; + std::map _mapSubMesh; + std::map _mapGroup; SMESH_Gen * _gen; bool _isAutoColor;