0022364: EDF SMESH: Create Mesh dialog box improvement: hide inapplicable algorithms/hypotheses

0022365: EDF SMESH: Create Mesh dialog box improvement: hide algorithms depending on a mesh type
This commit is contained in:
imn 2014-02-28 18:58:28 +04:00
parent e3e68f1be2
commit e26ffcc005
7 changed files with 48 additions and 25 deletions

View File

@ -668,5 +668,12 @@ int SMESHGUI_MeshDlg::currentMeshType( )
{ {
return myMeshType->currentIndex( ); return myMeshType->currentIndex( );
} }
//================================================================================
/*!
* \brief Set current index types of mesh
*/
//================================================================================
void SMESHGUI_MeshDlg::setCurrentMeshType( const int theIndex )
{
myMeshType->setCurrentIndex( theIndex );
}

View File

@ -76,6 +76,7 @@ public:
int getActiveObject(); int getActiveObject();
void setAvailableMeshType(const QStringList& ); void setAvailableMeshType(const QStringList& );
int currentMeshType(); int currentMeshType();
void setCurrentMeshType( const int );
signals: signals:
void hypoSet( const QString& ); void hypoSet( const QString& );

View File

@ -688,10 +688,13 @@ void SMESHGUI_MeshOp::selectionDone()
myDlg->adjustSize(); myDlg->adjustSize();
readMesh(); readMesh();
} }
int curIndex = myDlg->currentMeshType( );
QStringList TypeMeshList; QStringList TypeMeshList;
createMeshTypeList( TypeMeshList ); createMeshTypeList( TypeMeshList );
setAvailableMeshType( TypeMeshList ); setAvailableMeshType( TypeMeshList );
setFilteredAlgoData( myMaxShapeDim, myDlg->currentMeshType( )); curIndex =( curIndex >= TypeMeshList.count() ) ? 0 : curIndex;
myDlg->setCurrentMeshType( curIndex );
setFilteredAlgoData( myMaxShapeDim, curIndex);
} }
catch ( const SALOME::SALOME_Exception& S_ex ) catch ( const SALOME::SALOME_Exception& S_ex )
{ {
@ -1421,7 +1424,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
// check that algorithms of other dimentions are compatible with // check that algorithms of other dimentions are compatible with
// the selected one // the selected one
if ( !algoData ) { // all algos becomes available if ( !algoData ) { // all algos becomes available
if (myDlg->currentMeshType() == MT_ANY) if (myDlg->currentMeshType() == MT_ANY || aDim == SMESH::DIM_1D || aDim == SMESH::DIM_0D)
availableHyps( aDim, Algo, anAvailable, myAvailableHypData[ aDim ][ Algo ]); availableHyps( aDim, Algo, anAvailable, myAvailableHypData[ aDim ][ Algo ]);
else{ else{
anAvailable.clear(); anAvailable.clear();

View File

@ -1563,15 +1563,23 @@ class Mesh:
if not geom: if not geom:
geom = self.mesh.GetShapeToMesh() geom = self.mesh.GetShapeToMesh()
pass pass
AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName()) hyp_name = hyp.GetName()
status = self.mesh.AddHypothesis(geom, hyp) lib_name = hyp.GetLibName()
isAlgo = hyp._narrow( SMESH_Algo )
hyp_name = GetName( hyp )
geom_name = "" geom_name = ""
if geom: if geom:
geom_name = GetName( geom ) geom_name = geom.GetName()
TreatHypoStatus( status, hyp_name, geom_name, isAlgo ) isApplicable = True
return status isAlgo = hyp._narrow( SMESH_Algo )
if self.mesh.HasShapeToMesh():
isApplicable = self.smeshpyD.IsApplicable(hyp_name, lib_name, geom, not geom.IsSame( self.mesh.GetShapeToMesh() ) )
if isApplicable:
AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName())
status = self.mesh.AddHypothesis(geom, hyp)
TreatHypoStatus( status, hyp_name, geom_name, isAlgo )
return status
else:
TreatHypoStatus( HYP_BAD_GEOMETRY, hyp_name, geom_name, isAlgo )
return HYP_BAD_GEOMETRY
## Return True if an algorithm of hypothesis is assigned to a given shape ## Return True if an algorithm of hypothesis is assigned to a given shape
# @param hyp a hypothesis to check # @param hyp a hypothesis to check

View File

@ -208,8 +208,7 @@ class Mesh_Algorithm:
pass pass
self.subm = mesh.mesh.GetSubMesh(geom, algo.GetName()) self.subm = mesh.mesh.GetSubMesh(geom, algo.GetName())
self.algo = algo self.algo = algo
status = mesh.mesh.AddHypothesis(self.geom, self.algo) status = mesh.AddHypothesis(self.geom, self.algo)
TreatHypoStatus( status, algo.GetName(), name, True )
return return
def CompareHyp (self, hyp, args): def CompareHyp (self, hyp, args):

View File

@ -760,18 +760,20 @@ bool StdMeshers_Hexa_3D::IsApplicable( const TopoDS_Shape & aShape, bool toCheck
if ( !exp0.More() ) return false; if ( !exp0.More() ) return false;
for ( ; exp0.More(); exp0.Next() ) for ( ; exp0.More(); exp0.Next() )
{ {
nbFoundShells = 1; nbFoundShells = 0;
isCurShellApp = false; isCurShellApp = false;
for (TopExp_Explorer exp1( exp0.Current(), TopAbs_SHELL ); exp1.More(); exp1.Next(), ++nbFoundShells){ TopExp_Explorer exp1( exp0.Current(), TopAbs_SHELL );
if ( nbFoundShells == 2 ) { for ( ; exp1.More(); exp1.Next(), ++nbFoundShells)
if ( toCheckAll ) return false; if ( nbFoundShells == 2 ) break;
break; if ( nbFoundShells == 2){
} if ( toCheckAll ) return false;
const TopoDS_Shell& shell = TopoDS::Shell(exp1.Current()); continue;
isCurShellApp = SMESH_Block::FindBlockShapes(shell, theVertex0, theVertex1, theShapeIDMap ); }
if ( toCheckAll && !isCurShellApp ) return false; exp1.Init( exp0.Current(), TopAbs_SHELL );
} const TopoDS_Shell& shell = TopoDS::Shell(exp1.Current());
if( !toCheckAll && isCurShellApp ) return true; isCurShellApp = SMESH_Block::FindBlockShapes(shell, theVertex0, theVertex1, theShapeIDMap );
if ( toCheckAll && !isCurShellApp ) return false;
if ( !toCheckAll && isCurShellApp ) return true;
} }
return toCheckAll; return toCheckAll;
}; };

View File

@ -625,7 +625,10 @@ bool StdMeshers_RadialPrism_3D::IsApplicable( const TopoDS_Shape & aShape, bool
} }
shell[ nbShells-1 ] = It.Value(); shell[ nbShells-1 ] = It.Value();
} }
if ( nbShells != 2 ) continue; if ( nbShells != 2 ) {
if ( toCheckAll ) return false;
continue;
}
int nbFaces1 = SMESH_MesherHelper:: Count( shell[0], TopAbs_FACE, 0 ); int nbFaces1 = SMESH_MesherHelper:: Count( shell[0], TopAbs_FACE, 0 );
int nbFaces2 = SMESH_MesherHelper:: Count( shell[1], TopAbs_FACE, 0 ); int nbFaces2 = SMESH_MesherHelper:: Count( shell[1], TopAbs_FACE, 0 );