IPAL53870: Dump study script creates an excess sub-mesh

+ Allow Quadratic Mesh hypothesis on sub-meshes for http://www.salome-platform.org/forum/forum_14/325180606/861648983
+ Remove unfeasible controls from Mesh Element Info
This commit is contained in:
eap 2016-12-27 18:55:29 +03:00
parent 92bb7ceb6e
commit b2eb2c3cef
4 changed files with 73 additions and 55 deletions

View File

@ -165,7 +165,6 @@
label-id ="Quadratic Mesh" label-id ="Quadratic Mesh"
icon-id ="mesh_algo_quad.png" icon-id ="mesh_algo_quad.png"
dim ="1" dim ="1"
context ="GLOBAL"
auxiliary="true"/> auxiliary="true"/>
<hypothesis type ="MaxElementArea" <hypothesis type ="MaxElementArea"

View File

@ -1956,70 +1956,85 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
QTreeWidgetItem* cntrItem = createItem( elemItem, Bold ); QTreeWidgetItem* cntrItem = createItem( elemItem, Bold );
cntrItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONTROLS" ) ); cntrItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONTROLS" ) );
//Length //Length
if( e->GetType()==SMDSAbs_Edge){ if( e->GetType()==SMDSAbs_Edge){
afunctor.reset( new SMESH::Controls::Length() ); afunctor.reset( new SMESH::Controls::Length() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision ); afunctor->SetPrecision( cprecision );
QTreeWidgetItem* lenItem = createItem( cntrItem, Bold ); QTreeWidgetItem* lenItem = createItem( cntrItem, Bold );
lenItem->setText( 0, tr( "LENGTH_EDGES" ) ); lenItem->setText( 0, tr( "LENGTH_EDGES" ) );
lenItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); lenItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
} }
if( e->GetType() == SMDSAbs_Face ) { if( e->GetType() == SMDSAbs_Face ) {
//Area //Area
afunctor.reset( new SMESH::Controls::Area() ); afunctor.reset( new SMESH::Controls::Area() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision ); afunctor->SetPrecision( cprecision );
QTreeWidgetItem* areaItem = createItem( cntrItem, Bold ); QTreeWidgetItem* areaItem = createItem( cntrItem, Bold );
areaItem->setText( 0, tr( "AREA_ELEMENTS" ) ); areaItem->setText( 0, tr( "AREA_ELEMENTS" ) );
areaItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue(id) ) ); areaItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue(id) ) );
//Taper //Taper
afunctor.reset( new SMESH::Controls::Taper() ); if ( e->NbNodes() == 4 ) // see SMESH_Controls.cxx
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); {
afunctor->SetPrecision( cprecision ); afunctor.reset( new SMESH::Controls::Taper() );
QTreeWidgetItem* taperlItem = createItem( cntrItem, Bold ); afunctor->SetMesh( actor()->GetObject()->GetMesh() );
taperlItem->setText( 0, tr( "TAPER_ELEMENTS" ) ); afunctor->SetPrecision( cprecision );
taperlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); QTreeWidgetItem* taperlItem = createItem( cntrItem, Bold );
taperlItem->setText( 0, tr( "TAPER_ELEMENTS" ) );
taperlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
//Wraping angle
afunctor.reset( new SMESH::Controls::Warping() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
QTreeWidgetItem* warpItem = createItem( cntrItem, Bold );
warpItem->setText( 0, tr( "WARP_ELEMENTS" ));
warpItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
}
//AspectRatio2D //AspectRatio2D
afunctor.reset( new SMESH::Controls::AspectRatio() ); if ( !e->IsPoly() )
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); {
QTreeWidgetItem* ratlItem = createItem( cntrItem, Bold ); afunctor.reset( new SMESH::Controls::AspectRatio() );
ratlItem->setText( 0, tr( "ASPECTRATIO_ELEMENTS" )); afunctor->SetMesh( actor()->GetObject()->GetMesh() );
ratlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); QTreeWidgetItem* ratlItem = createItem( cntrItem, Bold );
ratlItem->setText( 0, tr( "ASPECTRATIO_ELEMENTS" ));
ratlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
}
//Minimum angle //Minimum angle
afunctor.reset( new SMESH::Controls::MinimumAngle() ); afunctor.reset( new SMESH::Controls::MinimumAngle() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision ); afunctor->SetPrecision( cprecision );
QTreeWidgetItem* minanglItem = createItem( cntrItem, Bold ); QTreeWidgetItem* minanglItem = createItem( cntrItem, Bold );
minanglItem->setText( 0, tr( "MINIMUMANGLE_ELEMENTS" ) ); minanglItem->setText( 0, tr( "MINIMUMANGLE_ELEMENTS" ) );
minanglItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); minanglItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
//Wraping angle //Skew
afunctor.reset( new SMESH::Controls::Warping() ); if ( e->NbNodes() == 3 || e->NbNodes() == 4 )
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); {
afunctor->SetPrecision( cprecision ); afunctor.reset( new SMESH::Controls::Skew() );
QTreeWidgetItem* warpItem = createItem( cntrItem, Bold ); afunctor->SetMesh( actor()->GetObject()->GetMesh() );
warpItem->setText( 0, tr( "WARP_ELEMENTS" )); afunctor->SetPrecision( cprecision );
warpItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); QTreeWidgetItem* skewItem = createItem( cntrItem, Bold );
//Skew skewItem->setText( 0, tr( "SKEW_ELEMENTS" ) );
afunctor.reset( new SMESH::Controls::Skew() ); skewItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); }
afunctor->SetPrecision( cprecision ); //ElemDiam2D
QTreeWidgetItem* skewItem = createItem( cntrItem, Bold ); if ( !e->IsPoly() )
skewItem->setText( 0, tr( "SKEW_ELEMENTS" ) ); {
skewItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); afunctor.reset( new SMESH::Controls::MaxElementLength2D() );
//ElemDiam2D afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor.reset( new SMESH::Controls::MaxElementLength2D() ); QTreeWidgetItem* diamItem = createItem( cntrItem, Bold );
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); diamItem->setText( 0, tr( "MAX_ELEMENT_LENGTH_2D" ));
QTreeWidgetItem* diamItem = createItem( cntrItem, Bold ); diamItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
diamItem->setText( 0, tr( "MAX_ELEMENT_LENGTH_2D" )); }
diamItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
} }
if( e->GetType() == SMDSAbs_Volume ) { if( e->GetType() == SMDSAbs_Volume ) {
//AspectRatio3D if ( !e->IsPoly() )
afunctor.reset( new SMESH::Controls::AspectRatio3D() ); {
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); //AspectRatio3D
QTreeWidgetItem* ratlItem3 = createItem( cntrItem, Bold ); afunctor.reset( new SMESH::Controls::AspectRatio3D() );
ratlItem3->setText( 0, tr( "ASPECTRATIO_3D_ELEMENTS" ) ); afunctor->SetMesh( actor()->GetObject()->GetMesh() );
ratlItem3->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); QTreeWidgetItem* ratlItem3 = createItem( cntrItem, Bold );
ratlItem3->setText( 0, tr( "ASPECTRATIO_3D_ELEMENTS" ) );
ratlItem3->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
}
//Volume //Volume
afunctor.reset( new SMESH::Controls::Volume() ); afunctor.reset( new SMESH::Controls::Volume() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() );
@ -2031,7 +2046,7 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() );
QTreeWidgetItem* diam3Item = createItem( cntrItem, Bold ); QTreeWidgetItem* diam3Item = createItem( cntrItem, Bold );
diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ) ); diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ) );
diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
} }
// gravity center // gravity center

View File

@ -2048,7 +2048,7 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
{ {
addCmd = *cmd; addCmd = *cmd;
cmd = addHypCmds.erase( cmd ); cmd = addHypCmds.erase( cmd );
if ( !theGen->IsToKeepAllCommands() && CanClear() ) { if ( !theGen->IsToKeepAllCommands() /*&& CanClear()*/ ) {
addCmd->Clear(); addCmd->Clear();
theCommand->Clear(); theCommand->Clear();
} }
@ -3474,28 +3474,31 @@ bool _pySegmentLengthAroundVertexHyp::Addition2Creation( const Handle(_pyCommand
_pyID vertex = theCmd->GetArg( 1 ); _pyID vertex = theCmd->GetArg( 1 );
// the problem here is that segment algo will not be found // the problem here is that segment algo can be not found
// by pyHypothesis::Addition2Creation() for <vertex>, so we try to find // by pyHypothesis::Addition2Creation() for <vertex>, so we try to find
// geometry where segment algorithm is assigned // geometry where segment algorithm is assigned
Handle(_pyHypothesis) algo;
_pyID geom = vertex; _pyID geom = vertex;
Handle(_pyHypothesis) algo = theGen->FindAlgo( geom, theMeshID, this );
while ( algo.IsNull() && !geom.IsEmpty()) { while ( algo.IsNull() && !geom.IsEmpty()) {
// try to find geom as a father of <vertex> // try to find geom as a father of <vertex>
geom = FatherID( geom ); geom = FatherID( geom );
algo = theGen->FindAlgo( geom, theMeshID, this ); algo = theGen->FindAlgo( geom, theMeshID, this );
} }
if ( algo.IsNull() ) if ( algo.IsNull() || geom.IsEmpty() )
return false; // also possible to find geom as brother of veretex... return false; // also possible to find geom as brother of veretex...
// set geom instead of vertex // set geom instead of vertex
theCmd->SetArg( 1, geom ); theCmd->SetArg( 1, geom );
// set vertex as a second arg
if ( myCurCrMethod->myArgs.size() < 1) setCreationArg( 1, "1" ); // :(
setCreationArg( 2, vertex );
// mesh.AddHypothesis(vertex, SegmentLengthAroundVertex) --> // mesh.AddHypothesis(vertex, SegmentLengthAroundVertex) -->
// theMeshID.LengthNearVertex( length, vertex ) // SegmentLengthAroundVertex = Regular_1D.LengthNearVertex( length )
return _pyHypothesis::Addition2Creation( theCmd, theMeshID ); if ( _pyHypothesis::Addition2Creation( theCmd, theMeshID ))
{
// set vertex as a second arg
theCmd->SetArg( 2, vertex );
return true;
}
} }
return false; return false;
} }

View File

@ -381,6 +381,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
pass pass
# 0D algorithm # 0D algorithm
if self.geom is None: if self.geom is None:
self.geom = store_geom
raise RuntimeError, "Attemp to create SegmentAroundVertex_0D algoritm on None shape" raise RuntimeError, "Attemp to create SegmentAroundVertex_0D algoritm on None shape"
from salome.smesh.smeshBuilder import AssureGeomPublished, GetName, TreatHypoStatus from salome.smesh.smeshBuilder import AssureGeomPublished, GetName, TreatHypoStatus
AssureGeomPublished( self.mesh, self.geom ) AssureGeomPublished( self.mesh, self.geom )