0022367: EDF SMESH: Notification on concurrent algorithms/hypotheses

This commit is contained in:
eap 2014-02-14 16:05:31 +04:00
parent 8b7d977779
commit 53fcb605c1
4 changed files with 78 additions and 12 deletions

View File

@ -827,6 +827,11 @@ module SMESH
* Methods to set meshing order of submeshes * Methods to set meshing order of submeshes
*/ */
/*!
* \brief Return \c true if a meshing order not yet set for a concurrent sub-mesh
*/
boolean IsUnorderedSubMesh(in long submeshID);
/*! /*!
* \brief Return submesh objects list in meshing order * \brief Return submesh objects list in meshing order
*/ */

View File

@ -295,6 +295,7 @@ bool SMESHGUI_MeshOrderMgr::SetMeshOrder( const ListListId& theListListIds )
_PTR(SObject) aSmObj = smIter->Value(); _PTR(SObject) aSmObj = smIter->Value();
SMESH::SMESH_subMesh_var sm = SMESH::SMESH_subMesh_var sm =
SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( aSmObj ); SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( aSmObj );
if ( !sm->_is_nil() )
mapOfSubMesh[ sm->GetId() ] = SMESH::SMESH_subMesh::_duplicate(sm); mapOfSubMesh[ sm->GetId() ] = SMESH::SMESH_subMesh::_duplicate(sm);
} }
} }

View File

@ -5100,8 +5100,37 @@ void findCommonSubMesh (list<const SMESH_subMesh*>& theSubMeshList,
//theCommon.insert( theSubMesh ); //theCommon.insert( theSubMesh );
} }
//-----------------------------------------------------------------------------
bool isSubMeshInList ( int smID, const TListOfListOfInt& smLists )
{
TListOfListOfInt::const_iterator listsIt = smLists.begin();
for ( ; listsIt != smLists.end(); ++listsIt )
{
const TListOfInt& smIDs = *listsIt;
if ( std::find( smIDs.begin(), smIDs.end(), smID ) != smIDs.end() )
return true;
}
return false;
}
} // namespace } // namespace
//=============================================================================
/*!
* \brief Return \c true if a meshing order not yet set for a concurrent sub-mesh
*/
//=============================================================================
CORBA::Boolean SMESH_Mesh_i::IsUnorderedSubMesh(CORBA::Long submeshID)
{
TListOfListOfInt anOrder = GetImpl().GetMeshOrder(); // already defined order
if ( isSubMeshInList( submeshID, anOrder ))
return false;
TListOfListOfInt allConurrent = findConcurrentSubMeshes();
return isSubMeshInList( submeshID, allConurrent );
}
//============================================================================= //=============================================================================
/*! /*!
* \brief Return submesh objects list in meshing order * \brief Return submesh objects list in meshing order
@ -5116,10 +5145,33 @@ SMESH::submesh_array_array* SMESH_Mesh_i::GetMeshOrder()
if ( !aMeshDS ) if ( !aMeshDS )
return aResult._retn(); return aResult._retn();
::SMESH_Mesh& mesh = GetImpl(); TListOfListOfInt anOrder = GetImpl().GetMeshOrder(); // already defined order
TListOfListOfInt anOrder = mesh.GetMeshOrder(); // is there already defined order? TListOfListOfInt allConurrent = findConcurrentSubMeshes();
if ( !anOrder.size() ) { anOrder.splice( anOrder.end(), allConurrent );
int listIndx = 0;
TListOfListOfInt::iterator listIt = anOrder.begin();
for(; listIt != anOrder.end(); listIt++, listIndx++ )
unionLists( *listIt, anOrder, listIndx + 1 );
// convert submesh ids into interface instances
// and dump command into python
convertMeshOrder( anOrder, aResult, false );
return aResult._retn();
}
//=============================================================================
/*!
* \brief Finds concurrent sub-meshes
*/
//=============================================================================
TListOfListOfInt SMESH_Mesh_i::findConcurrentSubMeshes()
{
TListOfListOfInt anOrder;
::SMESH_Mesh& mesh = GetImpl();
{
// collect submeshes and detect concurrent algorithms and hypothesises // collect submeshes and detect concurrent algorithms and hypothesises
TDimHypList dimHypListArr[4]; // dimHyp list for each shape dimension TDimHypList dimHypListArr[4]; // dimHyp list for each shape dimension
@ -5194,11 +5246,8 @@ SMESH::submesh_array_array* SMESH_Mesh_i::GetMeshOrder()
for(; listIt != anOrder.end(); listIt++, listIndx++ ) for(; listIt != anOrder.end(); listIt++, listIndx++ )
unionLists( *listIt, anOrder, listIndx + 1 ); unionLists( *listIt, anOrder, listIndx + 1 );
} }
// convert submesh ids into interface instances
// and dump command into python
convertMeshOrder( anOrder, aResult, false );
return aResult._retn(); return anOrder;
} }
//============================================================================= //=============================================================================
@ -5287,7 +5336,8 @@ void SMESH_Mesh_i::convertMeshOrder (const TListOfListOfInt& theIdsOrder,
SMESH::submesh_array_var aResSubSet = new SMESH::submesh_array(); SMESH::submesh_array_var aResSubSet = new SMESH::submesh_array();
aResSubSet->length(aSubOrder.size()); aResSubSet->length(aSubOrder.size());
TListOfInt::const_iterator subIt = aSubOrder.begin(); TListOfInt::const_iterator subIt = aSubOrder.begin();
for( int j = 0; subIt != aSubOrder.end(); subIt++ ) { int j;
for( j = 0; subIt != aSubOrder.end(); subIt++ ) {
if ( _mapSubMeshIor.find(*subIt) == _mapSubMeshIor.end() ) if ( _mapSubMeshIor.find(*subIt) == _mapSubMeshIor.end() )
continue; continue;
SMESH::SMESH_subMesh_var subMesh = SMESH::SMESH_subMesh_var subMesh =
@ -5301,6 +5351,7 @@ void SMESH_Mesh_i::convertMeshOrder (const TListOfListOfInt& theIdsOrder,
} }
if ( theIsDump ) if ( theIsDump )
aPythonDump << " ]"; aPythonDump << " ]";
if ( j > 1 )
theResOrder[ listIndx++ ] = aResSubSet; theResOrder[ listIndx++ ] = aResSubSet;
} }
// correct number of lists // correct number of lists

View File

@ -585,6 +585,10 @@ public:
*/ */
SMESH::string_array* GetLastParameters(); SMESH::string_array* GetLastParameters();
/*!
* \brief Return \c true if a meshing order not yet set for a concurrent sub-mesh
*/
CORBA::Boolean IsUnorderedSubMesh(CORBA::Long submeshID);
/*! /*!
* \brief Return submesh objects list in meshing order * \brief Return submesh objects list in meshing order
*/ */
@ -653,6 +657,11 @@ private:
SMESH::submesh_array_array& theSubMeshOrder, SMESH::submesh_array_array& theSubMeshOrder,
const bool theIsDump); const bool theIsDump);
/*!
* \brief Finds concurrent sub-meshes
*/
TListOfListOfInt findConcurrentSubMeshes();
private: private:
static int _idGenerator; static int _idGenerator;