0021559: EDF 2175 SMESH: Hexa/Tetra mixed meshes

+  // return true if given order of sub-meshes is OK
+  bool IsOrderOK( const SMESH_subMesh* smBefore,
+                  const SMESH_subMesh* smAfter ) const;
This commit is contained in:
eap 2012-09-06 13:49:43 +00:00
parent 4cde840048
commit 2a7bf64d23
2 changed files with 34 additions and 12 deletions

View File

@ -2006,9 +2006,9 @@ bool SMESH_Mesh::SortByMeshOrder(list<SMESH_subMesh*>& theListToSort) const
typedef list<SMESH_subMesh*>::iterator TPosInList; typedef list<SMESH_subMesh*>::iterator TPosInList;
map< int, TPosInList > sortedPos; map< int, TPosInList > sortedPos;
TPosInList smBeg = theListToSort.begin(), smEnd = theListToSort.end(); TPosInList smBeg = theListToSort.begin(), smEnd = theListToSort.end();
TListOfListOfInt::const_iterator listIddIt = _mySubMeshOrder.begin(); TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin();
for( ; listIddIt != _mySubMeshOrder.end(); listIddIt++) { for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++) {
const TListOfInt& listOfId = *listIddIt; const TListOfInt& listOfId = *listIdsIt;
TListOfInt::const_iterator idIt = listOfId.begin(); TListOfInt::const_iterator idIt = listOfId.begin();
for ( ; idIt != listOfId.end(); idIt++ ) { for ( ; idIt != listOfId.end(); idIt++ ) {
if ( SMESH_subMesh * sm = GetSubMeshContaining( *idIt )) { if ( SMESH_subMesh * sm = GetSubMeshContaining( *idIt )) {
@ -2035,6 +2035,30 @@ bool SMESH_Mesh::SortByMeshOrder(list<SMESH_subMesh*>& theListToSort) const
return res; return res;
} }
//================================================================================
/*!
* \brief Return true if given order of sub-meshes is OK
*/
//================================================================================
bool SMESH_Mesh::IsOrderOK( const SMESH_subMesh* smBefore,
const SMESH_subMesh* smAfter ) const
{
TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin();
TListOfInt::const_iterator idBef, idAft;
for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++)
{
const TListOfInt& listOfId = *listIdsIt;
idBef = std::find( listOfId.begin(), listOfId.end(), smBefore->GetId() );
if ( idBef != listOfId.end() )
idAft = std::find( listOfId.begin(), listOfId.end(), smAfter->GetId() );
if ( idAft != listOfId.end () )
return ( std::distance( listOfId.begin(), idBef ) <
std::distance( listOfId.begin(), idAft ) );
}
return true; // no order imposed to given submeshes
}
//============================================================================= //=============================================================================
/*! /*!
* \brief sort submeshes according to stored mesh order * \brief sort submeshes according to stored mesh order
@ -2043,8 +2067,8 @@ bool SMESH_Mesh::SortByMeshOrder(list<SMESH_subMesh*>& theListToSort) const
*/ */
//============================================================================= //=============================================================================
list<SMESH_subMesh*> SMESH_Mesh::getAncestorsSubMeshes list<SMESH_subMesh*>
(const TopoDS_Shape& theSubShape) const SMESH_Mesh::getAncestorsSubMeshes (const TopoDS_Shape& theSubShape) const
{ {
list<SMESH_subMesh*> listOfSubMesh; list<SMESH_subMesh*> listOfSubMesh;
TopTools_ListIteratorOfListOfShape it( GetAncestors( theSubShape )); TopTools_ListIteratorOfListOfShape it( GetAncestors( theSubShape ));

View File

@ -319,15 +319,13 @@ public:
void SetMeshOrder(const TListOfListOfInt& theOrder ); void SetMeshOrder(const TListOfListOfInt& theOrder );
const TListOfListOfInt& GetMeshOrder() const; const TListOfListOfInt& GetMeshOrder() const;
/*! // sort submeshes according to stored mesh order
* \brief sort submeshes according to stored mesh order
* \param theListToSort in out list to be sorted
* \return FALSE if nothing sorted
*/
bool SortByMeshOrder(std::list<SMESH_subMesh*>& theListToSort) const; bool SortByMeshOrder(std::list<SMESH_subMesh*>& theListToSort) const;
// // return true if given order of sub-meshes is OK
bool IsOrderOK( const SMESH_subMesh* smBefore,
const SMESH_subMesh* smAfter ) const;
ostream& Dump(ostream & save); ostream& Dump(ostream & save);
private: private: