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;
map< int, TPosInList > sortedPos;
TPosInList smBeg = theListToSort.begin(), smEnd = theListToSort.end();
TListOfListOfInt::const_iterator listIddIt = _mySubMeshOrder.begin();
for( ; listIddIt != _mySubMeshOrder.end(); listIddIt++) {
const TListOfInt& listOfId = *listIddIt;
TListOfListOfInt::const_iterator listIdsIt = _mySubMeshOrder.begin();
for( ; listIdsIt != _mySubMeshOrder.end(); listIdsIt++) {
const TListOfInt& listOfId = *listIdsIt;
TListOfInt::const_iterator idIt = listOfId.begin();
for ( ; idIt != listOfId.end(); idIt++ ) {
if ( SMESH_subMesh * sm = GetSubMeshContaining( *idIt )) {
@ -2035,6 +2035,30 @@ bool SMESH_Mesh::SortByMeshOrder(list<SMESH_subMesh*>& theListToSort) const
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
@ -2043,8 +2067,8 @@ bool SMESH_Mesh::SortByMeshOrder(list<SMESH_subMesh*>& theListToSort) const
*/
//=============================================================================
list<SMESH_subMesh*> SMESH_Mesh::getAncestorsSubMeshes
(const TopoDS_Shape& theSubShape) const
list<SMESH_subMesh*>
SMESH_Mesh::getAncestorsSubMeshes (const TopoDS_Shape& theSubShape) const
{
list<SMESH_subMesh*> listOfSubMesh;
TopTools_ListIteratorOfListOfShape it( GetAncestors( theSubShape ));

View File

@ -319,15 +319,13 @@ public:
void SetMeshOrder(const TListOfListOfInt& theOrder );
const TListOfListOfInt& GetMeshOrder() const;
/*!
* \brief sort submeshes according to stored mesh order
* \param theListToSort in out list to be sorted
* \return FALSE if nothing sorted
*/
// sort submeshes according to stored mesh order
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);
private: