#17845 [EDF] Modifications of Automatic meshing

This commit is contained in:
eap 2019-10-22 17:24:35 +03:00
parent 09e26a7d86
commit 5dcb2f2b46
32 changed files with 852 additions and 330 deletions

View File

@ -76,10 +76,11 @@ OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
OPTION(SALOME_BUILD_DOC "Generate SALOME SMESH documentation" ON)
# Advanced options:
OPTION(SALOME_BUILD_GUI "Enable GUI" ON)
OPTION(SALOME_SMESH_USE_CGNS "Enable import/export to CGNS format" OFF)
OPTION(SALOME_SMESH_USE_TBB "Enable parallel computation" OFF)
OPTION(SALOME_SMESH_DYNLOAD_LOCAL "Load plug-ins' symbols locally (Linux only)" ON)
OPTION(SALOME_BUILD_GUI "Enable GUI" ON)
OPTION(SALOME_SMESH_USE_CGNS "Enable import/export to CGNS format" OFF)
OPTION(SALOME_SMESH_USE_TBB "Enable parallel computation" OFF)
OPTION(SALOME_SMESH_DYNLOAD_LOCAL "Load plug-ins' symbols locally (Linux only)" ON)
OPTION(SMESH_USE_MESHGEMS_HYPOSET "Prefer MeshGems algorithms in sets of hypotheses" OFF)
CMAKE_DEPENDENT_OPTION(SALOME_SMESH_BUILD_FRENCH_DOC "Generate SALOME SMESH French documentation" OFF
"SALOME_BUILD_DOC" OFF)
@ -87,6 +88,12 @@ IF(SALOME_SMESH_DYNLOAD_LOCAL)
ADD_DEFINITIONS(-DDYNLOAD_LOCAL)
ENDIF(SALOME_SMESH_DYNLOAD_LOCAL)
IF(SMESH_USE_MESHGEMS_HYPOSET)
SET(SMESH_USE_MESHGEMS_HYPOSET_VAR "true")
ELSE(SMESH_USE_MESHGEMS_HYPOSET)
SET(SMESH_USE_MESHGEMS_HYPOSET_VAR "false")
ENDIF(SMESH_USE_MESHGEMS_HYPOSET)
#On Linux use Fortran to compile MEFISTO2D
IF(NOT WIN32)
ENABLE_LANGUAGE(Fortran)
@ -94,7 +101,7 @@ IF(NOT WIN32)
ADD_DEFINITIONS(-DENABLE_MEFISTO)
ENDIF(NOT WIN32)
MARK_AS_ADVANCED(SALOME_BUILD_GUI SALOME_SMESH_USE_CGNS SALOME_SMESH_USE_TBB SALOME_SMESH_DYNLOAD_LOCAL)
MARK_AS_ADVANCED(SALOME_BUILD_GUI SALOME_SMESH_USE_CGNS SALOME_SMESH_USE_TBB SALOME_SMESH_DYNLOAD_LOCAL SMESH_USE_MESHGEMS_HYPOSET)
# Prerequisites
# =============

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

@ -160,7 +160,6 @@ To construct a mesh:
List of sets of hypotheses. Tag *[custom]* is automatically added to the sets defined by the user.
.. note::
* *"Automatic"* in the names of predefined sets of hypotheses does not actually mean that they are suitable for meshing any geometry.
* The list of sets of hypotheses can be shorter than in the above image depending on the geometry dimension.

View File

@ -101,6 +101,10 @@ General Preferences
* **Default Number of Segments** - defines the default number of segments in :ref:`Number of Segments <number_of_segments_anchor>` hypothesis.
.. _use_meshgems_pref:
* **Use MeshGems meshers when assigning set of hypotheses** - if activated, commercial meshers of MeshGems suite are used instead of a free mesher NETGEN when assigning a set of hypotheses in Create Mesh/Sub-mesh dialog.
* **Mesh loading**
* **No mesh loading from study file at hypothesis modification** - if activated, the mesh data will not be loaded from the study file when a hypothesis is modified. This allows saving time by omitting loading data of a large mesh that is planned to be recomputed with other parameters.

View File

@ -116,6 +116,15 @@ module SMESH
};
typedef sequence<ComputeError> compute_error_array;
/*!
* Way to initialize hypothesis
*/
struct HypInitParams
{
short way; // 0 - by mesh, 1 - by geometry size + prefered parameters, 2 - by averageLength
double averageLength;
boolean quadDominated;
};
interface SMESH_Gen : Engines::EngineComponent, SALOMEDS::Driver
{
@ -175,7 +184,7 @@ module SMESH
in string theLibName,
in SMESH_Mesh theMesh,
in GEOM::GEOM_Object theGeom,
in boolean byMesh)
in HypInitParams theWay)
raises ( SALOME::SALOME_Exception );
/*!

View File

@ -21,7 +21,18 @@
#
SET(SMESH_RESOURCES_FILES
ModuleMesh.png
advanced_mesh_info.png
bare_border_face.png
bare_border_volume.png
copy_mesh.png
copy_mesh_with_geom.png
delete.png
mesh.png
mesh_0D_elem.png
mesh_0D_on_all_nodes.png
mesh_2d_from_3d.png
mesh_add.png
mesh_add_sub.png
mesh_algo_hexa.png
mesh_algo_mefisto.png
@ -29,211 +40,203 @@ SET(SMESH_RESOURCES_FILES
mesh_algo_regular.png
mesh_algo_tetra.png
mesh_angle.png
mesh_angle_measure.png
mesh_area.png
mesh_aspect.png
mesh_aspect_3d.png
mesh_ball.png
mesh_biquad_quadrangle.png
mesh_biquad_triangle.png
mesh_bounding_box.png
mesh_build_compound.png
mesh_choose.png
mesh_choose_all.png
mesh_clear.png
mesh_compute.png
mesh_evaluate.png
mesh_order.png
mesh_conv_to_quad.png
mesh_cutGroups.png
mesh_cutquad.png
mesh_deflection.png
mesh_deleteGroups.png
mesh_diagonal.png
mesh_duplicate_elem_only.png
mesh_duplicate_group_boundary.png
mesh_duplicate_nodes.png
mesh_duplicate_nodes_with_elem.png
mesh_edit.png
mesh_hexa.png
mesh_hypo_area.png
mesh_hypo_length.png
mesh_hypo_segment.png
mesh_hypo_volume.png
mesh_hypo_edit.png
mesh_plus.png
mesh_minus.png
mesh_info.png
advanced_mesh_info.png
standard_mesh_info.png
mesh_edit_group.png
mesh_elem_info.png
mesh_equal_edge.png
mesh_equal_face.png
mesh_equal_node.png
mesh_equal_volume.png
mesh_whatis.png
mesh_init.png
mesh_length.png
mesh_length_2d.png
mesh_evaluate.png
mesh_extmeth_face_offset.png
mesh_extmeth_node_offset.png
mesh_extmeth_surf_offset_smooth.png
mesh_extractGroup.png
mesh_extrusion.png
mesh_extrusionpath.png
mesh_face_groups_by_edges.png
mesh_find_elem_by_point.png
mesh_free_edges.png
mesh_free_edges_2d.png
mesh_free_faces.png
mesh_free_nodes.png
mesh_group.png
mesh_groups_from_gemetry.png
mesh_hexa.png
mesh_hide.png
mesh_hypo_area.png
mesh_hypo_edit.png
mesh_hypo_layer_distribution.png
mesh_hypo_length.png
mesh_hypo_segment.png
mesh_hypo_source_3d.png
mesh_hypo_source_edge.png
mesh_hypo_source_face.png
mesh_hypo_viscous_layers.png
mesh_hypo_volume.png
mesh_info.png
mesh_init.png
mesh_intersectGroups.png
mesh_length.png
mesh_length_2d.png
mesh_line.png
mesh_line_n.png
mesh_make_group.png
mesh_max_element_length_2d.png
mesh_max_element_length_3d.png
mesh_multi_edges.png
mesh_multi_edges_2d.png
mesh_line_n.png
mesh_line.png
mesh_measure_area.png
mesh_measure_basic_props.png
mesh_measure_length.png
mesh_measure_volume.png
mesh_merge_elements.png
mesh_merge_nodes.png
mesh_min_dist.png
mesh_minus.png
mesh_move_node.png
mesh_move_without_node.png
mesh_multi_edges.png
mesh_multi_edges_2d.png
mesh_node_to_point.png
mesh_octahedron.png
mesh_offset.png
mesh_order.png
mesh_orientation.png
mesh.png
mesh_pattern.png
mesh_pentahedron.png
mesh_plugins_meshcut.png
mesh_plus.png
mesh_points.png
mesh_polygon.png
mesh_polyhedron.png
mesh_pyramid_n.png
mesh_precompute.png
mesh_pyramid.png
mesh_quad_n.png
mesh_pyramid_n.png
mesh_quad.png
mesh_quad_edge.png
mesh_quad_hexahedron.png
mesh_quad_n.png
mesh_quad_pentahedron.png
mesh_quad_polygon.png
mesh_quad_pyramid.png
mesh_quad_quadrangle.png
mesh_quad_tetrahedron.png
mesh_quad_triangle.png
mesh_quadrangle_quadpref.png
mesh_quadrangle_quadpref_reversed.png
mesh_quadrangle_reduced.png
mesh_quadrangle_standard.png
mesh_quadrangle_triapref.png
mesh_quality.png
mesh_rem_element.png
mesh_rem_node.png
mesh_rem_orphan_nodes.png
mesh_remove.png
mesh_renumbering_elements.png
mesh_renumbering_nodes.png
mesh_revolution.png
mesh_rotation.png
mesh_sew_bordertoside.png
mesh_sew_conform_freeborders.png
mesh_sew_freeborders.png
mesh_sew_sideelements.png
mesh_shading.png
mesh_show.png
mesh_shrink.png
mesh_skew.png
mesh_smoothing.png
mesh_symmetry_axis.png
mesh_symmetry_plane.png
mesh_symmetry_point.png
mesh_taper.png
mesh_tetra.png
mesh_translation_points.png
mesh_translation_vector.png
mesh_tree_algo.png
mesh_tree_algo_0D.png
mesh_tree_algo_existing_2D.png
mesh_tree_algo_hexa.png
mesh_tree_algo_mefisto.png
mesh_tree_algo_polygon.png
mesh_tree_algo.png
mesh_tree_algo_0D.png
mesh_tree_algo_quad.png
mesh_tree_algo_regular.png
mesh_tree_algo_tetra.png
mesh_tree_hypo_area.png
mesh_tree_hypo_length.png
mesh_tree_hypo.png
mesh_tree_hypo_segment.png
mesh_tree_hypo_volume.png
mesh_tree_hypo_cartesian.png
mesh_tree_mesh.png
mesh_tree_importedmesh.png
mesh_tree_mesh_warn.png
mesh_triangle_n.png
mesh_triquad_hexahedron.png
mesh_triangle.png
mesh_update.png
mesh_vertex_n.png
mesh_vertex.png
mesh_0D_elem.png
mesh_0D_on_all_nodes.png
mesh_volume_3d.png
bare_border_volume.png
bare_border_face.png
over_constrained_volume.png
over_constrained_face.png
mesh_wireframe.png
mesh_points.png
mesh_wrap.png
mesh_group.png
mesh_tree_group.png
mesh_tree_group_on_filter.png
mesh_edit_group.png
mesh_make_group.png
mesh_groups_from_gemetry.png
mesh_union2tri.png
mesh_uniontri.png
mesh_cutquad.png
mesh_smoothing.png
mesh_renumbering_nodes.png
mesh_renumbering_elements.png
mesh_extrusion.png
mesh_extrusionpath.png
mesh_revolution.png
ModuleMesh.png
mesh_unionGroups.png
mesh_intersectGroups.png
mesh_cutGroups.png
mesh_deleteGroups.png
mesh_translation_vector.png
mesh_translation_points.png
mesh_rotation.png
mesh_symmetry_point.png
mesh_symmetry_axis.png
mesh_symmetry_plane.png
mesh_sew_freeborders.png
mesh_sew_conform_freeborders.png
mesh_sew_bordertoside.png
mesh_sew_sideelements.png
mesh_merge_nodes.png
mesh_merge_elements.png
select1.png
open.png
mesh_pattern.png
mesh_pentahedron.png
pattern_sample_2d.png
pattern_sample_3D.png
mesh_add.png
mesh_remove.png
mesh_quad_edge.png
mesh_quad_triangle.png
mesh_quad_quadrangle.png
mesh_quad_polygon.png
mesh_quad_tetrahedron.png
mesh_quad_pyramid.png
mesh_quad_pentahedron.png
mesh_quad_hexahedron.png
mesh_conv_to_quad.png
mesh_tree_hypo_layers_distribution.png
mesh_tree_algo_radial_prism.png
mesh_tree_algo_radial_quadrangle_1D2D.png
mesh_tree_algo_existing_2D.png
mesh_tree_algo_prism.png
mesh_tree_algo_projection_2d.png
mesh_hypo_source_edge.png
mesh_hypo_source_3d.png
mesh_hypo_layer_distribution.png
mesh_hypo_source_face.png
mesh_tree_hypo_source_face.png
mesh_tree_hypo_source_edge.png
mesh_tree_hypo_source_3d_shape.png
mesh_tree_hypo_projection_3d.png
mesh_tree_algo_quad.png
mesh_tree_algo_radial_prism.png
mesh_tree_algo_radial_quadrangle_1D2D.png
mesh_tree_algo_regular.png
mesh_tree_algo_tetra.png
mesh_tree_group.png
mesh_tree_group_on_filter.png
mesh_tree_hypo.png
mesh_tree_hypo_area.png
mesh_tree_hypo_cartesian.png
mesh_tree_hypo_import_source_1d.png
mesh_tree_hypo_import_source_2d.png
mesh_tree_hypo_layers_distribution.png
mesh_tree_hypo_layers_distribution_2d.png
mesh_tree_hypo_length.png
mesh_tree_hypo_projection_2d.png
mesh_tree_hypo_projection_3d.png
mesh_tree_hypo_quadratic.png
mesh_build_compound.png
copy_mesh.png
copy_mesh_with_geom.png
mesh_node_to_point.png
mesh_tree_hypo_segment.png
mesh_tree_hypo_source_3d_shape.png
mesh_tree_hypo_source_edge.png
mesh_tree_hypo_source_face.png
mesh_tree_hypo_viscous_layers.png
mesh_tree_hypo_volume.png
mesh_tree_importedmesh.png
mesh_tree_mesh.png
mesh_tree_mesh_partial.png
mesh_extractGroup.png
mesh_precompute.png
mesh_2d_from_3d.png
mesh_free_faces.png
mesh_tree_mesh_warn.png
mesh_triangle.png
mesh_triangle_n.png
mesh_triquad_hexahedron.png
mesh_union2tri.png
mesh_unionGroups.png
mesh_uniontri.png
mesh_update.png
mesh_vertex.png
mesh_vertex_n.png
mesh_volume_3d.png
mesh_whatis.png
mesh_wireframe.png
mesh_wrap.png
open.png
over_constrained_face.png
over_constrained_volume.png
pattern_sample_2d.png
pattern_sample_3D.png
reorient_faces_face.png
reorient_faces_point.png
reorient_faces_volume.png
scale.png
scale_along_axes.png
split_into_tetra.png
select1.png
split_biquad.png
mesh_duplicate_nodes.png
mesh_duplicate_nodes_with_elem.png
mesh_duplicate_elem_only.png
mesh_duplicate_group_boundary.png
mesh_bounding_box.png
mesh_hypo_viscous_layers.png
mesh_tree_hypo_viscous_layers.png
mesh_min_dist.png
reorient_faces_point.png
reorient_faces_face.png
reorient_faces_volume.png
mesh_ball.png
mesh_measure_basic_props.png
mesh_measure_length.png
mesh_measure_area.png
mesh_measure_volume.png
mesh_extmeth_node_offset.png
mesh_extmeth_surf_offset_smooth.png
mesh_extmeth_face_offset.png
mesh_quality.png
mesh_show.png
mesh_hide.png
mesh_deflection.png
mesh_offset.png
mesh_face_groups_by_edges.png
mesh_angle_measure.png
split_into_tetra.png
standard_mesh_info.png
)
INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA})

View File

@ -76,6 +76,7 @@
<parameter name="info_dump_ctrl" value="true" />
<parameter name="segmentation" value="10"/>
<parameter name="nb_segments_per_edge" value="15"/>
<parameter name="use-meshgems-hypo-sets" value="@SMESH_USE_MESHGEMS_HYPOSET_VAR@"/>
<parameter name="forget_mesh_on_hyp_modif" value="true"/>
<parameter name="quadratic_mode" value="0"/>
<parameter name="max_angle" value="2"/>

View File

@ -590,22 +590,45 @@
<hypotheses-set-group>
<hypotheses-set name="Automatic Tetrahedralization"
hypos="MaxLength"
algos="Regular_1D, @MEFISTO2D_NAME@, NETGEN_3D"/>
<hypotheses-set name="Tetrahedralization"
use-common-size="true"
hypos="MG-CADSurf Parameters"
algos="MG-CADSurf, MG-Tetra"
alt-hypos="NETGEN_Parameters"
alt-algos="NETGEN_2D3D"
intern-edge-hypos="LocalLength"
intern-edge-algos="Regular_1D"/>
<hypotheses-set name="Automatic Hexahedralization"
<hypotheses-set name="Mapped Hexahedralization"
hypos="NumberOfSegments"
algos="Regular_1D, Quadrangle_2D, Hexa_3D"/>
<hypotheses-set name="Automatic Triangulation"
hypos="MaxLength"
algos="Regular_1D, @MEFISTO2D_NAME@"/>
<hypotheses-set name="Free Hexahedralization"
use-common-size="true"
hypos="MG-CADSurf Parameters"
algos="MG-CADSurf, MG-Hexa"
intern-edge-hypos="LocalLength"
intern-edge-algos="Regular_1D"/>
<hypotheses-set name="Automatic Quadrangulation"
<hypotheses-set name="Triangulation"
use-common-size="true"
hypos="MG-CADSurf Parameters"
algos="MG-CADSurf"
alt-hypos="NETGEN_Parameters_2D"
alt-algos="NETGEN_2D"/>
<hypotheses-set name="Mapped Quadrangulation"
hypos="NumberOfSegments"
algos="Regular_1D, Quadrangle_2D"/>
<hypotheses-set name="Free Quadrangulation"
use-common-size="true"
quad-dominated="true"
hypos="MG-CADSurf Parameters"
algos="MG-CADSurf"
alt-hypos="NETGEN_Parameters_2D"
alt-algos="NETGEN_2D"/>
</hypotheses-set-group>
</meshers>

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 B

View File

@ -95,11 +95,18 @@ public:
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape)=0;
enum InitWay { BY_MESH, BY_GEOM, BY_AVERAGE_LENGTH };
struct TDefaults
{
InitWay _way;
double _elemLength;
int _nbSegments;
bool _quadDominated;
double _diagonal;
TopoDS_Shape* _shape; // future shape of the mesh being created
TDefaults():
_way(BY_GEOM), _elemLength(0),_nbSegments(0),_quadDominated(false),_diagonal(0),_shape(0) {}
};
/*!
* \brief Initialize my parameter values by default parameters.

View File

@ -5211,6 +5211,7 @@ void SMESHGUI::createPreferences()
"SMESH", "nb_segments_per_edge" );
setPreferenceProperty( nbSeg, "min", 1 );
setPreferenceProperty( nbSeg, "max", 10000000 );
addPreference( tr( "PREF_USE_MESHGEMS_HYPOSET" ), segGroup, LightApp_Preferences::Bool, "SMESH", "use-meshgems-hypo-sets" );
int loadGroup = addPreference( tr( "SMESH_PREF_MESH_LOADING" ), genTab );
addPreference( tr( "PREF_FORGET_MESH_AT_HYP_MODIF" ), loadGroup, LightApp_Preferences::Bool,

View File

@ -206,7 +206,7 @@ LightApp_Dialog* SMESHGUI_GroupOnShapeOp::dlg() const
*/
//================================================================================
static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
SMESH::ElementType SMESHGUI_GroupOnShapeOp::ElementType(GEOM::GEOM_Object_var geom)
{
if ( !geom->_is_nil() ) {
switch ( geom->GetShapeType() ) {
@ -232,7 +232,7 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
GEOM::ListOfLong_var ids = aGroupOp->GetObjects( geom );
if ( ids->length() && !mainShape->_is_nil() && !aShapeOp->_is_nil() ) {
GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( mainShape, ids[0] );
return elementType( member );
return ElementType( member );
}
}
}
@ -240,7 +240,7 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false );
if ( ids->length() ) {
GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( geom, ids[0] );
return elementType( member );
return ElementType( member );
}
}
}
@ -335,7 +335,7 @@ bool SMESHGUI_GroupOnShapeOp::onApply()
if ( geom->_is_nil() ) continue;
// group type
SMESH::ElementType elemType = isNode ? SMESH::NODE : elementType( geom );
SMESH::ElementType elemType = isNode ? SMESH::NODE : ElementType( geom );
if ( elemType == SMESH::ALL )
continue;

View File

@ -49,6 +49,7 @@ public:
virtual LightApp_Dialog* dlg() const;
static QString GetDefaultName(const QString& theOperation);
static SMESH::ElementType ElementType(GEOM::GEOM_Object_var geom);
public slots:

View File

@ -27,10 +27,11 @@
#include "SMESHGUI.h"
#include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_SpinBox.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESH_Actor.h"
#include "SMESH_TypeDefs.hxx"
// SALOME KERNEL includes
#include <SALOMEDSClient_Study.hxx>
@ -147,10 +148,14 @@ void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
Dlg->setWindowTitle( caption() );
Dlg->setObjectName( theHypName );
Dlg->setHIcon( icon() );
Dlg->setType( type() );
if ( theHypName == HypothesesSet::getCommonHypoSetHypoType() )
Dlg->setType( tr( HypothesesSet::getCommonHypoSetHypoType()) );
else
Dlg->setType( type() );
retrieveParams();
Dlg->show();
Dlg->show(); // w/o this Dlg blocks selection
Dlg->resize( Dlg->minimumSizeHint() );
Dlg->exec(); // w/o this we cant wait until edition ends when applying a hypo-set
}
else {
emit finished( QDialog::Accepted );
@ -671,6 +676,14 @@ SMESHGUI_HypothesisDlg::~SMESHGUI_HypothesisDlg()
delete myCreator;
}
void SMESHGUI_HypothesisDlg::showEvent(QShowEvent *event)
{
// resize( minimumSizeHint() );
// adjustSize();
QtxDialog::showEvent( event );
}
void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
{
if( f )
@ -779,32 +792,44 @@ HypothesisData::HypothesisData( const QString& theTypeName,
{
}
HypothesesSet::HypothesesSet( const QString& theSetName )
: myHypoSetName( theSetName ),
// HypothesesSet::HypothesesSet( const QString& theSetName )
// : myHypoSetName( theSetName ),
// myIsAlgo( false ),
// myIsCustom( false )
// {
// }
HypothesesSet::HypothesesSet( const QString& theSetName,
bool useCommonSize, bool isQuadDominated,
const QStringList& mainHypos, const QStringList& mainAlgos,
const QStringList& altHypos, const QStringList& altAlgos,
const QStringList& intHypos, const QStringList& intAlgos )
: myUseCommonSize( useCommonSize ),
myQuadDominated( isQuadDominated ),
myHypoSetName( theSetName ),
myHypoList({ mainHypos, altHypos, intHypos }),
myAlgoList({ mainAlgos, altAlgos, intAlgos }),
myIsAlgo( false ),
myIsCustom( false )
myIsCustom( false ),
myIndex( 0 )
{
for ( myHypType = MAIN; myHypType < NB_HYP_TYPES; SMESHUtils::Increment( myHypType ))
for ( int isAlgo = myIsAlgo = 0; isAlgo < 2; myIsAlgo = ++isAlgo )
{
QStringList& hyps = *list();
for ( int i = 0; i < hyps.count(); ++i )
hyps[ i ] = hyps[ i ].trimmed();
}
}
HypothesesSet::HypothesesSet( const QString& theSetName,
const QStringList& theHypoList,
const QStringList& theAlgoList )
: myHypoSetName( theSetName ),
myHypoList( theHypoList ),
myAlgoList( theAlgoList ),
myIsAlgo( false ),
myIsCustom( false )
QStringList* HypothesesSet::list( bool is_algo, SetType setType) const
{
}
QStringList* HypothesesSet::list(bool is_algo) const
{
return const_cast<QStringList*>( &( is_algo ? myAlgoList : myHypoList ) );
return const_cast<QStringList*>( &( is_algo ? myAlgoList[setType] : myHypoList[setType] ));
}
QStringList* HypothesesSet::list() const
{
return list( myIsAlgo );
return list( myIsAlgo, myHypType );
}
QString HypothesesSet::name() const
@ -812,23 +837,24 @@ QString HypothesesSet::name() const
return myHypoSetName;
}
void HypothesesSet::set( bool isAlgo, const QStringList& lst )
{
*list(isAlgo) = lst;
}
// void HypothesesSet::set( bool isAlgo, const QStringList& lst )
// {
// *list(isAlgo) = lst;
// }
int HypothesesSet::count( bool isAlgo ) const
{
return list(isAlgo)->count();
}
// int HypothesesSet::count( bool isAlgo, SetType setType ) const
// {
// return list(isAlgo,setType)->count();
// }
bool HypothesesSet::isAlgo() const
{
return myIsAlgo;
}
// bool HypothesesSet::isAlgo() const
// {
// return myIsAlgo;
// }
void HypothesesSet::init( bool isAlgo )
void HypothesesSet::init( bool isAlgo, SetType setType )
{
myHypType = setType;
myIsAlgo = isAlgo;
myIndex = 0;
}
@ -858,16 +884,43 @@ bool HypothesesSet::getIsCustom() const
return myIsCustom;
}
void HypothesesSet::setAlgoAvailable( SetType type, bool isAvailable )
{
if ( MAIN <= type && type < NB_HYP_TYPES )
myIsAlgoAvailable[ type ] = isAvailable;
}
bool HypothesesSet::getAlgoAvailable( SetType type )
{
bool isAva = false;
if ( MAIN <= type && type < NB_HYP_TYPES )
isAva = myIsAlgoAvailable[ type ];
return isAva;
}
HypothesesSet::SetType HypothesesSet::getPreferredHypType()
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int useAltHypos = !resMgr->booleanValue( "SMESH", "use-meshgems-hypo-sets", false );
return ( HypothesesSet::SetType ) useAltHypos;
}
int HypothesesSet::maxDim() const
{
HypothesesSet * thisSet = (HypothesesSet*) this;
int dim = -1;
for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
{
for ( thisSet->init( isAlgo ); thisSet->more(); thisSet->next() )
if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
for ( int i = 0; i < hypData->Dim.count(); ++i )
dim = qMax( dim, hypData->Dim[i] );
}
for ( int setType = 0; setType < 2; ++setType )
for ( int isAlgo = 0; isAlgo < 2; ++isAlgo )
{
for ( thisSet->init( isAlgo, SetType( setType )); thisSet->more(); thisSet->next() )
if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() ))
for ( int i = 0; i < hypData->Dim.count(); ++i )
dim = qMax( dim, hypData->Dim[i] );
}
return dim;
}
const char* HypothesesSet::getCommonHypoSetHypoType()
{
return "AverageLengthForHypoSet";
}

View File

@ -158,6 +158,7 @@ public:
void setHIcon( const QPixmap& );
void setCustomFrame( QFrame* );
void setType( const QString& );
void showEvent(QShowEvent *event);
protected slots:
virtual void accept();
@ -215,32 +216,53 @@ struct HypothesisData
class HypothesesSet
{
public:
HypothesesSet( const QString& );
HypothesesSet( const QString&, const QStringList&, const QStringList& );
enum SetType { MAIN, ALT, INTERN, NB_HYP_TYPES }; //!< hypos/algos type: main, alternative, internal-edges
//HypothesesSet( const QString& );
HypothesesSet( const QString& name,
bool useCommonSize, bool isQuadDominated,
const QStringList& mainHypos, const QStringList& mainAlgos,
const QStringList& altHypos, const QStringList& altAlgos,
const QStringList& intHypos, const QStringList& intAlgos );
QString name() const;
void set( bool, const QStringList& );
int count( bool ) const;
bool toUseCommonSize() const { return myUseCommonSize; }
bool isQuadDominated() const { return myQuadDominated; }
//int count( bool, SetType ) const;
int maxDim() const;
void setIsCustom( bool );
bool getIsCustom() const;
int maxDim() const;
bool isAlgo() const;
void setAlgoAvailable( SetType type, bool isAvailable );
bool getAlgoAvailable( SetType type );
static SetType getPreferredHypType();
static const char* getCommonHypoSetHypoType();
//bool isAlgo() const;
// CASCADE-like iteration
void init( bool );
void init( bool, SetType );
bool more() const;
void next();
QString current() const;
private:
QStringList* list(bool) const;
QStringList* list(bool,SetType) const;
QStringList* list() const;
private:
bool myUseCommonSize; // Average size is asked only and used to create default hypotheses
bool myQuadDominated;
QString myHypoSetName;
QStringList myHypoList, myAlgoList;
QStringList myHypoList[3], myAlgoList[3]; // per SetType
bool myIsAlgoAvailable[3]; // current state depending on geometry etc
// iteration
SetType myHypType;
bool myIsAlgo, myIsCustom;
int myIndex;
};

View File

@ -329,8 +329,7 @@ namespace SMESH
hypoSet != myListOfHypothesesSets.end();
++hypoSet ) {
HypothesesSet* aSet = *hypoSet;
if ( aSet && ( aSet->count( true ) || aSet->count( false )) &&
aSet->maxDim() <= maxDim)
if ( aSet && 0 <= aSet->maxDim() && aSet->maxDim() <= maxDim )
{
aSetNameList.append( mangledHypoSetName( aSet ));
}

View File

@ -34,6 +34,7 @@
#include <QtxToolButton.h>
// Qt includes
#include <QCheckBox>
#include <QComboBox>
#include <QCursor>
#include <QGridLayout>
@ -572,9 +573,12 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh
// mesh type
QLabel* anMeshTypeLbl = new QLabel( tr( "MESH_TYPE" ), this );
myMeshType = new QComboBox( this );
// groups
myCreateGroupsCheck = new QCheckBox( tr( "CREATE_ALL_GROUPS" ), this );
myCreateGroupsCheck->setChecked( true );
// Create tab widget
myTabWg = new QTabWidget( mainFrame() );
myTabs[ Dim0D ] = new SMESHGUI_MeshTab( myTabWg );
myTabs[ Dim1D ] = new SMESHGUI_MeshTab( myTabWg );
@ -608,9 +612,10 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh
aLay->addWidget( objectWg( Geom, Control ), 2, 2 );
aLay->addWidget( anMeshTypeLbl, 3, 0 );
aLay->addWidget( myMeshType, 3, 2 );
aLay->addWidget( myTabWg, 5, 0, 1, 3 );
aLay->addWidget( myHypoSetButton, 6, 0, 1, 3 );
aLay->setRowMinimumHeight( 3, 20 );
aLay->addWidget( myCreateGroupsCheck, 4, 0, 1, 3 );
aLay->addWidget( myTabWg, 6, 0, 1, 3 );
aLay->addWidget( myHypoSetButton, 7, 0, 1, 3 );
aLay->setRowMinimumHeight( 4, 20 );
myMeshType->clear();
@ -658,7 +663,7 @@ void SMESHGUI_MeshDlg::setTitile( const bool theToCreate, const bool theIsMesh )
{
setWindowTitle( tr( theIsMesh ? "EDIT_MESH" : "EDIT_SUBMESH") );
}
myCreateGroupsCheck-> setVisible( theToCreate && theIsMesh );
}
//================================================================================
@ -916,3 +921,14 @@ void SMESHGUI_MeshDlg::setCurrentMeshType( const int theIndex )
else
myMeshType->setCurrentIndex( 0 );
}
//================================================================================
/*!
* \brief Return state of "Create all Groups on Geometry" check-box
*/
//================================================================================
bool SMESHGUI_MeshDlg::toCreateAllGroups()
{
return myCreateGroupsCheck->isChecked();
}

View File

@ -37,14 +37,15 @@
#include <QStringList>
#include <QMap>
class SMESHGUI_MeshTab;
class QAction;
class QCheckBox;
class QComboBox;
class QListWidget;
class QMenu;
class QTabWidget;
class QToolButton;
class QtxToolButton;
class SMESHGUI_MeshTab;
/*!
* \brief Dialog for mech creation or editing
@ -84,6 +85,8 @@ public:
void setCurrentMeshType( const int );
int currentMeshType();
bool toCreateAllGroups();
signals:
void hypoSet( const QString& );
void geomSelectionByMesh( bool );
@ -101,6 +104,7 @@ private slots:
QToolButton* myHypoSetButton;
QMenu* myGeomPopup;
QComboBox* myMeshType;
QCheckBox* myCreateGroupsCheck;
};
/*!

View File

@ -27,6 +27,7 @@
#include "SMESHGUI.h"
#include "SMESHGUI_GEOMGenUtils.h"
#include "SMESHGUI_GroupOnShapeDlg.h"
#include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI_MeshDlg.h"
@ -34,26 +35,30 @@
#include "SMESHGUI_ShapeByMeshDlg.h"
#include "SMESHGUI_Utils.h"
#include "SMESH_NumberFilter.hxx"
#include "SMESH_TypeDefs.hxx"
#include "SMESH_TypeFilter.hxx"
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
// SALOME GEOM includes
#include <GEOM_SelectionFilter.h>
#include <GEOMBase.h>
#include <GeometryGUI.h>
#include <GEOM_wrap.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_SelectionFilter.h>
#include <GEOM_wrap.hxx>
#include <GeometryGUI.h>
// SALOME GUI includes
#include <SalomeApp_Tools.h>
#include <SalomeApp_Application.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_UpdateFlags.h>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
#include <SUIT_Session.h>
#include <SALOME_InteractiveObject.hxx>
#include <SALOME_ListIO.hxx>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Tools.h>
// SALOME KERNEL includes
#include <SALOMEDS_SComponent.hxx>
@ -62,16 +67,16 @@
#include <SALOMEDS_wrap.hxx>
// Qt includes
#include <QStringList>
#include <QLineEdit>
#include <QApplication>
#include <QLineEdit>
#include <QStringList>
// OCCT includes
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS.hxx>
//================================================================================
/*!
@ -183,6 +188,8 @@ bool SMESHGUI_MeshOp::onApply()
SUIT_MessageBox::warning( myDlg, tr( "SMESH_ERROR" ), aMess );
}
myHypoSet = 0;
return aResult;
}
@ -257,6 +264,7 @@ void SMESHGUI_MeshOp::startOperation()
selectionDone();
myHypoSet = 0;
myHasConcurrentSubBefore = false;
myObjectToSelect.clear();
}
@ -1022,8 +1030,9 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim,
*/
//================================================================================
SMESH::SMESH_Hypothesis_var
SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
const QString& aServerLib ) const
SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
const QString& aServerLib,
const SMESH::HypInitParams* aParams ) const
{
if ( aHypType.isEmpty() || aServerLib.isEmpty() )
return SMESH::SMESH_Hypothesis::_nil();
@ -1083,18 +1092,42 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
}
}
SMESH::HypInitParams initParams;
enum { BY_MESH, BY_GEOM, BY_AVERAGE_LENGTH }; // same as ::SMESH_Hypothesis::InitWay
if ( aParams )
{
initParams = *aParams;
}
else
{
initParams.way = isSubMesh ? BY_MESH : BY_GEOM;
}
SMESH::SMESH_Hypothesis_var hyp =
SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toUtf8().data(),
aServerLib.toUtf8().data(),
aMesh,
aGeomVar,
/*byMesh = */isSubMesh);
if ( hyp->_is_nil() && isSubMesh )
initParams );
if ( hyp->_is_nil() && initParams.way == BY_MESH )
{
initParams.way = BY_GEOM;
hyp = SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(),
aServerLib.toUtf8().data(),
aMesh,
aGeomVar,
/*byMesh = */false);
initParams );
}
if ( hyp->_is_nil() && initParams.way == BY_GEOM )
{
initParams.way = BY_AVERAGE_LENGTH;
initParams.averageLength = 1.;
hyp = SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(),
aServerLib.toUtf8().data(),
aMesh,
aGeomVar,
initParams );
}
return hyp;
}
@ -1221,25 +1254,14 @@ namespace
//================================================================================
/*!
* Create hypothesis and update dialog.
* \param theDim - dimension of hypothesis to be created
* \param theType - hypothesis category (algorithm, hypothesis, additional hypothesis)
* \param theTypeName - specifies hypothesis to be created
* \brief Return names of all existing hypotheses
*/
//================================================================================
void SMESHGUI_MeshOp::createHypothesis(const int theDim,
const int theType,
const QString& theTypeName)
QStringList SMESHGUI_MeshOp::getHypoNames()
{
HypothesisData* aData = SMESH::GetHypothesisData(theTypeName);
if (!aData)
return;
myDim = theDim;
myType = theType;
// get a unique hyp name
QStringList aHypNames;
TDim2Type2HypList::const_iterator aDimIter = myExistingHyps.begin();
for ( ; aDimIter != myExistingHyps.end(); aDimIter++) {
const TType2HypList& aType2HypList = aDimIter.value();
@ -1254,7 +1276,30 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
}
}
}
QString aHypName = GetUniqueName( aHypNames, aData->Label);
return aHypNames;
}
//================================================================================
/*!
* Create hypothesis and update dialog.
* \param theDim - dimension of hypothesis to be created
* \param theType - hypothesis category (algorithm, hypothesis, additional hypothesis)
* \param theTypeName - specifies hypothesis to be created
*/
//================================================================================
void SMESHGUI_MeshOp::createHypothesis(const int theDim,
const int theType,
const QString& theTypeName)
{
HypothesisData* aData = SMESH::GetHypothesisData(theTypeName);
if (!aData)
return;
myDim = theDim;
myType = theType;
// get a unique hyp name
QString aHypName = GetUniqueName( getHypoNames(), aData->Label);
// existing hypos
bool dialog = false;
@ -1655,6 +1700,179 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
return;
}
//================================================================================
/*!
* \brief Create a sub-mesh on internal edges in the case where the global algorithm
* is of type 1D-2D[-3D] so that the internal edges would remain not meshed.
*/
//================================================================================
void SMESHGUI_MeshOp::createSubMeshOnInternalEdges( SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theMainShape )
{
if ( theMesh->_is_nil() || theMainShape->_is_nil() )
return;
if ( isAccessibleDim( 1 ))
return; // global 1D algorithm is/can be assigned
const HypothesesSet::SetType internSet = HypothesesSet::INTERN;
bool toCreate = true;
bool toCreateMandatory = ( myHypoSet &&
myAverageSize > 0 &&
( myHypoSet->init( /*algo=*/ true, internSet ), myHypoSet->more()) &&
( myHypoSet->init( /*algo=*/false, internSet ), myHypoSet->more()));
if ( !toCreateMandatory ) // ask the user
toCreate = false; // can't pass both mesh and geometry to Create Submesh operation (so far?)
// toCreate = SUIT_MessageBox::warning( SMESHGUI::desktop(),
// QObject::tr("SMESH_WRN_WARNING"),
// QObject::tr("SMESH_CREATE_SUBMESH_ON_INTERNAL_EDGES"),
// QObject::tr("SMESH_BUT_YES"),
// QObject::tr("SMESH_BUT_NO"), 1, 0);
if ( !toCreate )
return;
TopoDS_Shape shape;
if ( !GEOMBase::GetShape( theMainShape, shape ))
return;
std::vector< TopoDS_Shape > internalEdges;
for ( TopExp_Explorer edge( shape, TopAbs_EDGE, TopAbs_WIRE ); edge.More(); edge.Next() )
internalEdges.push_back( edge.Current() );
if ( internalEdges.empty() )
return;
TopTools_IndexedMapOfShape shapeIDs;
TopExp::MapShapes( shape, shapeIDs );
std::set< int > intIDSet;
for ( size_t i = 0; i < internalEdges.size(); ++i )
intIDSet.insert( shapeIDs.FindIndex( internalEdges[ i ]));
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
if (geomGen->_is_nil()) return;
GEOM::GEOM_Object_var edgeGroup;
GEOM::GEOM_IShapesOperations_wrap sOp = geomGen->GetIShapesOperations();
GEOM::GEOM_IGroupOperations_wrap gOp = geomGen->GetIGroupOperations();
GEOM::ListOfGO_var geomGroups = sOp->GetExistingSubObjects( theMainShape,
/*groupsOnly=*/true );
for ( CORBA::ULong i = 0; i < geomGroups->length(); ++i )
{
GEOM::ListOfLong_var ids = gOp->GetObjects( geomGroups[ i ]);
std::set< int > idSet( & ids[0], & ids[0] + ids->length() );
if ( idSet == intIDSet )
{
edgeGroup = geomGroups[ i ];
break;
}
}
if ( edgeGroup->_is_nil() )
{
GEOM::GEOM_Object_var edgeGroup = gOp->CreateGroup( theMainShape, TopAbs_EDGE );
GEOM::ListOfLong_var edgeIDs = new GEOM::ListOfLong;
edgeIDs->length( internalEdges.size() );
std::set< int >::iterator id = intIDSet.begin();
for ( size_t i = 0; i < intIDSet.size(); ++i, ++id )
edgeIDs[ i ] = *id;
gOp->UnionIDs( edgeGroup, edgeIDs );
SALOMEDS::SObject_wrap so = geomGen->AddInStudy( edgeGroup, "Internal edges", theMainShape );
}
if ( !toCreateMandatory )
{
// show Create Sub-mesh dislog
// _PTR(SObject) aMeshSO = SMESH::FindSObject( theMesh );
// selectionMgr()->clearFilters();
// selectObject( pSubmesh );
// SMESHGUI::GetSMESHGUI()->switchToOperation( SMESHOp::OpEditMeshOrSubMesh );
return;
}
// create a sub-mesh using myAverageSize w/o GUI
SMESH::SMESH_subMesh_var subMesh = theMesh->GetSubMesh( edgeGroup, "" );
for ( int isAlgo = 1; isAlgo >= 0; --isAlgo )
for ( myHypoSet->init( isAlgo, internSet ); myHypoSet->more(); myHypoSet->next() )
{
QString aHypoTypeName = myHypoSet->current();
HypothesisData* aHypData = SMESH::GetHypothesisData( aHypoTypeName );
if ( !aHypData )
continue;
myDim = aHypData->Dim[0];
if ( myDim != 1 )
continue;
// create or/and set
SMESH::SMESH_Hypothesis_var newHypo;
if ( isAlgo )
{
myAvailableHypData[ myDim ][ Algo ].clear();
myAvailableHypData[ myDim ][ Algo ] << aHypData;
QStringList hypList; hypList << aHypoTypeName;
myDlg->tab( myDim )->setAvailableHyps( Algo, hypList );
setCurrentHyp( myDim, Algo, 0 );
newHypo = getAlgo( myDim );
}
else
{
SMESH::HypInitParams params = { 2, myAverageSize, false };
newHypo = getInitParamsHypothesis( aHypData->TypeName, aHypData->ServerLibName, & params );
QString hypName = GetUniqueName( getHypoNames(), aHypData->Label );
SALOMEDS::SObject_wrap so =
SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(), newHypo,
hypName.toUtf8().data() );
}
SMESH::AddHypothesisOnSubMesh( subMesh, newHypo );
}
return;
}
//================================================================================
/*!
* \brief Ask the user to enter an average size which will be used to create
* hypotheses of a hypo-set basing on this size
* \param [out] averageSize - average element size
* \return bool - false if the user canceled the dialog
*/
//================================================================================
bool SMESHGUI_MeshOp::getAverageSize( double & averageSize )
{
HypothesisData* hypData = SMESH::GetHypothesisData( "MaxLength" );
if ( !hypData )
return false;
SMESH::SMESH_Hypothesis_var hyp = getInitParamsHypothesis( hypData->TypeName,
hypData->ServerLibName );
if ( hyp->_is_nil() )
return false;
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( hypData->TypeName );
if ( !aCreator )
return false;
initHypCreator( aCreator );
myDlg->setEnabled( false );
aCreator->edit( hyp.in(), HypothesesSet::getCommonHypoSetHypoType(),
dlg(), this, SLOT( onHypoEdited( int )));
StdMeshers::StdMeshers_MaxLength_var lenHyp = StdMeshers::StdMeshers_MaxLength::_narrow( hyp );
if ( lenHyp->_is_nil() )
return false;
averageSize = lenHyp->GetLength();
return true;
}
//================================================================================
/*!
* \brief Creates and selects hypothesis of hypotheses set
@ -1664,6 +1882,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
{
HypothesesSet* aHypoSet = SMESH::GetHypothesesSet(theSetName);
myHypoSet = aHypoSet;
if (!aHypoSet)
return;
@ -1676,38 +1895,68 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
onAlgoSelected( -1, dim );
}
HypothesesSet::SetType setType = aHypoSet->getPreferredHypType();
if ( !aHypoSet->getAlgoAvailable( setType ))
{
setType = setType == HypothesesSet::ALT ? HypothesesSet::MAIN : HypothesesSet::ALT;
if ( !aHypoSet->getAlgoAvailable( setType ))
return;
}
myAverageSize = -1;
if ( aHypoSet->toUseCommonSize() && !getAverageSize( myAverageSize ))
return;
for ( int isAlgo = 1; isAlgo >= 0; --isAlgo )
for ( aHypoSet->init( isAlgo ); aHypoSet->more(); aHypoSet->next() )
for ( aHypoSet->init( isAlgo, setType ); aHypoSet->more(); aHypoSet->next() )
{
QString aHypoTypeName = aHypoSet->current();
HypothesisData* aHypData = SMESH::GetHypothesisData( aHypoTypeName );
if (!aHypData)
continue;
int aDim = aHypData->Dim[0];
myDim = aHypData->Dim[0];
// create or/and set
if ( isAlgo )
{
int index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
int index = myAvailableHypData[myDim][Algo].indexOf( aHypData );
if ( index >= 0 )
{
setCurrentHyp( aDim, Algo, index );
onAlgoSelected( index, aDim );
setCurrentHyp( myDim, Algo, index );
onAlgoSelected( index, myDim );
}
}
else
{
bool mainHyp = true;
int index = myAvailableHypData[aDim][MainHyp].indexOf( aHypData );
myType = MainHyp;
int index = myAvailableHypData[myDim][MainHyp].indexOf( aHypData );
if ( index < 0 )
{
mainHyp = false;
index = myAvailableHypData[aDim][AddHyp].indexOf( aHypData );
myType = AddHyp;
index = myAvailableHypData[myDim][AddHyp].indexOf( aHypData );
}
if ( index >= 0 )
createHypothesis( aDim, mainHyp ? MainHyp : AddHyp, aHypoTypeName );
{
if ( myAverageSize > 0 )
{
SMESH::HypInitParams params = { 2, myAverageSize, aHypoSet->isQuadDominated() };
SMESH::SMESH_Hypothesis_var hyp =
getInitParamsHypothesis( aHypData->TypeName, aHypData->ServerLibName, & params );
QString hypName = GetUniqueName( getHypoNames(), aHypData->Label );
SALOMEDS::SObject_wrap so =
SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(), hyp,
hypName.toUtf8().data() );
onHypoCreated(2);
}
else
{
createHypothesis( myDim, myType, aHypoTypeName );
}
}
}
}
return;
}
@ -1755,7 +2004,7 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
namePrefix += "_";
}
QStringList::Iterator it = aList.begin();
for ( int i = 0; it!=aList.end(); it++, ++i )
for ( int i = 0; it != aList.end(); it++, ++i )
{
QString aGeomEntry = *it;
_PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toUtf8().data() );
@ -1801,7 +2050,34 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
if ( !anAlgoVar->_is_nil() )
SMESH::AddHypothesisOnMesh( aMesh, anAlgoVar );
}
if ( myDlg->toCreateAllGroups() && !aGeomVar->_is_nil() )
{
// Create groups on all geom groups
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
GEOM::ListOfGO_var geomGroups = op->GetExistingSubObjects( aGeomVar,
/*groupsOnly=*/true );
SMESH::SMESH_GroupOnGeom_var meshGroup;
for ( CORBA::ULong iG = 0; iG < geomGroups->length(); ++iG )
{
SMESH::ElementType elemType = SMESHGUI_GroupOnShapeOp::ElementType( geomGroups[ iG ] );
if ( elemType == SMESH::ALL )
continue;
CORBA::String_var name = geomGroups[ iG ]->GetName();
meshGroup = aMesh->CreateGroupFromGEOM( elemType, name, geomGroups[ iG ]);
if ( elemType != SMESH::NODE )
meshGroup = aMesh->CreateGroupFromGEOM( SMESH::NODE, name, geomGroups[ iG ]);
}
}
createSubMeshOnInternalEdges( aMesh, aGeomVar );
}
return true;
}
@ -2435,6 +2711,12 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
}
}
if ( aSubMeshVar->_is_nil() )
{
GEOM::GEOM_Object_var mainGeom = aMesh->GetShapeToMesh();
createSubMeshOnInternalEdges( aMesh, mainGeom );
}
myHasConcurrentSubBefore =
checkSubMeshConcurrency( aMesh, aSubMeshVar, /*askUser=*/!myHasConcurrentSubBefore );
@ -2635,23 +2917,29 @@ void SMESHGUI_MeshOp::updateHypoSets()
for ( ; inHypoSetName != aHypothesesSetsList.end(); ++inHypoSetName )
{
HypothesesSet* currentHypoSet = SMESH::GetHypothesesSet( *inHypoSetName );
bool isAvailable = false;
for ( currentHypoSet->init( true ); currentHypoSet->more(); currentHypoSet->next() )
HypothesesSet::SetType sType;
for ( sType = HypothesesSet::MAIN; sType <= HypothesesSet::ALT; SMESHUtils::Increment( sType ))
{
isAvailable = false;
if ( HypothesisData* algoDataIn = SMESH::GetHypothesisData( currentHypoSet->current() )) {
for (int i = SMESH::DIM_0D; i <= myMaxShapeDim; i++) {
int aCurrentAvailableAlgo = myAvailableHypData[i][Algo].indexOf( algoDataIn );
if ( aCurrentAvailableAlgo > -1 ) {
isAvailable = true;
break;
bool isAvailable = false;
for ( currentHypoSet->init( true, sType ); currentHypoSet->more(); currentHypoSet->next() )
{
isAvailable = false;
if ( HypothesisData* algoDataIn = SMESH::GetHypothesisData( currentHypoSet->current() )) {
for ( int dim = SMESH::DIM_0D; dim <= myMaxShapeDim; dim++) {
int aCurrentAvailableAlgo = myAvailableHypData[dim][Algo].indexOf( algoDataIn );
if ( aCurrentAvailableAlgo > -1 ) {
isAvailable = true;
break;
}
}
if ( !isAvailable )
break;
}
if ( !isAvailable )
break;
}
currentHypoSet->setAlgoAvailable( sType, isAvailable );
}
if ( isAvailable )
if ( currentHypoSet->getAlgoAvailable( HypothesesSet::MAIN ) ||
currentHypoSet->getAlgoAvailable( HypothesesSet::ALT ))
aFilteredHypothesesSetsList.append( *inHypoSetName );
}
myDlg->setHypoSets( aFilteredHypothesesSetsList );

View File

@ -121,6 +121,8 @@ private:
bool createMesh( QString&, QStringList& );
bool createSubMesh( QString&, QStringList& );
bool editMeshOrSubMesh( QString& );
void createSubMeshOnInternalEdges( SMESH::SMESH_Mesh_ptr mesh,
GEOM::GEOM_Object_ptr mainShape );
bool checkSubMeshConcurrency( SMESH::SMESH_Mesh_ptr mesh,
SMESH::SMESH_subMesh_ptr submesh,
bool askUser=false);
@ -137,8 +139,10 @@ private:
int find( const SMESH::SMESH_Hypothesis_var&,
const THypList& ) const;
SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString&,
const QString& ) const;
const QString&,
const SMESH::HypInitParams* prm=0) const;
void initHypCreator( SMESHGUI_GenericHypothesisCreator* aCreator );
bool getAverageSize( double & averageSize );
bool isSubshapeOk() const;
char* isSubmeshIgnored() const;
_PTR(SObject) getSubmeshByGeom() const;
@ -146,6 +150,7 @@ private:
void updateMeshTypeList();
void updateHypoSets();
void setFilteredAlgoData();
QStringList getHypoNames();
private:
@ -172,6 +177,9 @@ private:
bool myIgnoreAlgoSelection;
int myDim, myType, myMaxShapeDim;
HypothesesSet* myHypoSet; // applied hypo-set
double myAverageSize; // entered at hypo-set processing
QString myObjectToSelect;
};

View File

@ -201,14 +201,26 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&,
{
if (atts.value("name") != "")
{
QString hypos = atts.value("hypos").remove( ' ' );
QString algos = atts.value("algos").remove( ' ' );
bool useCommonSize = ( atts.value("use-common-size") == "true" );
bool isQuadDominated = ( atts.value("quad-dominated") == "true" );
QString hypos = atts.value("hypos");
QString algos = atts.value("algos");
QString altHypos = atts.value("alt-hypos");
QString altAlgos = atts.value("alt-algos");
QString intHypos = atts.value("intern-edge-hypos");
QString intAlgos = atts.value("intern-edge-algos");
bool badSet = hypos.contains( BAD_HYP_FLAG ) || algos.contains( BAD_HYP_FLAG );
if ( !badSet )
myListOfHypothesesSets.append( new HypothesesSet ( atts.value("name"),
hypos.split( ',', QString::SkipEmptyParts ),
algos.split( ',', QString::SkipEmptyParts ) ) );
myListOfHypothesesSets.append
( new HypothesesSet ( atts.value("name"),
useCommonSize, isQuadDominated,
hypos.split ( ',', QString::SkipEmptyParts ),
algos.split ( ',', QString::SkipEmptyParts ),
altHypos.split( ',', QString::SkipEmptyParts ),
altAlgos.split( ',', QString::SkipEmptyParts ),
intHypos.split( ',', QString::SkipEmptyParts ),
intAlgos.split( ',', QString::SkipEmptyParts )));
}
}
else if ( qName == "python-wrap" ||

View File

@ -4659,6 +4659,10 @@ Please, create VTK viewer and try again</translation>
<source>PREF_NB_SEGMENTS</source>
<translation>Default Number of Segments</translation>
</message>
<message>
<source>PREF_USE_MESHGEMS_HYPOSET</source>
<translation>Use MeshGems meshers when assigning set of hypotheses</translation>
</message>
<message>
<source>SMESH_PREF_MESH_LOADING</source>
<translation>Mesh loading</translation>
@ -6516,6 +6520,10 @@ Please specify them and try again</translation>
<source>NAME</source>
<translation>Name</translation>
</message>
<message>
<source>CREATE_ALL_GROUPS</source>
<translation>Create all Groups on Geometry</translation>
</message>
</context>
<context>
<name>SMESHGUI_MeshOp</name>
@ -8480,4 +8488,11 @@ red in the Object Browser.</translation>
<translation>Option value</translation>
</message>
</context>
<context>
<name>SMESHGUI_GenericHypothesisCreator</name>
<message>
<source>AverageLengthForHypoSet</source>
<translation>Mean Size</translation>
</message>
</context>
</TS>

View File

@ -764,14 +764,16 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::CreateHypothesis( const char* theHypNam
//================================================================================
SMESH::SMESH_Hypothesis_ptr
SMESH_Gen_i::GetHypothesisParameterValues (const char* theHypType,
const char* theLibName,
SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theGeom,
CORBA::Boolean byMesh)
SMESH_Gen_i::GetHypothesisParameterValues (const char* theHypType,
const char* theLibName,
SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theGeom,
const SMESH::HypInitParams& theParams)
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
const bool byMesh = ( theParams.way == ::SMESH_Hypothesis::BY_MESH );
if ( byMesh && CORBA::is_nil( theMesh ) )
return SMESH::SMESH_Hypothesis::_nil();
if ( byMesh && CORBA::is_nil( theGeom ) )
@ -826,17 +828,23 @@ SMESH_Gen_i::GetHypothesisParameterValues (const char* theHypType,
if ( hyp->SetParametersByMesh( mesh, shape ))
return SMESH::SMESH_Hypothesis::_duplicate( tmpHyp );
}
else {
double diagonal = 0;
if ( mesh )
diagonal = mesh->GetShapeDiagonalSize();
else
diagonal = ::SMESH_Mesh::GetShapeDiagonalSize( shape );
else
{
::SMESH_Hypothesis::TDefaults dflts;
dflts._elemLength = diagonal / myGen.GetBoundaryBoxSegmentation();
dflts._nbSegments = myGen.GetDefaultNbSegments();
dflts._shape = &shape;
// let the temporary hypothesis initialize it's values
dflts._way = ( ::SMESH_Hypothesis::InitWay) theParams.way;
dflts._nbSegments = myGen.GetDefaultNbSegments();
dflts._elemLength = theParams.averageLength;
dflts._quadDominated = theParams.quadDominated;
if ( theParams.way == ::SMESH_Hypothesis::BY_GEOM )
{
if ( mesh )
dflts._diagonal = mesh->GetShapeDiagonalSize();
else
dflts._diagonal = ::SMESH_Mesh::GetShapeDiagonalSize( shape );
dflts._elemLength = dflts._diagonal / myGen.GetBoundaryBoxSegmentation();
dflts._shape = &shape;
}
// let the hypothesis initialize it's values
if ( hyp->SetParametersByDefaults( dflts, mesh ))
return SMESH::SMESH_Hypothesis::_duplicate( tmpHyp );
}

View File

@ -164,11 +164,11 @@ public:
throw ( SALOME::SALOME_Exception );
// Return hypothesis of given type holding parameter values of the existing mesh
SMESH::SMESH_Hypothesis_ptr GetHypothesisParameterValues (const char* theHypType,
const char* theLibName,
SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theGeom,
CORBA::Boolean byMesh)
SMESH::SMESH_Hypothesis_ptr GetHypothesisParameterValues (const char* theHypType,
const char* theLibName,
SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theGeom,
const SMESH::HypInitParams& theWay)
throw ( SALOME::SALOME_Exception );
/*

View File

@ -839,21 +839,25 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SMESH::SMESH_Mesh_ptr theMesh,
SetName( aRootSO, aRootNames[aType] );
// Add new group to corresponding sub-tree
int isEmpty = false;
int isEmpty = ( theMesh->NbNodes() == 0 );
std::string pm[2] = { "ICON_SMESH_TREE_GROUP", "ICON_SMESH_TREE_MESH_WARN" };
if ( SMESH::DownCast< SMESH_GroupOnFilter_i* > ( theGroup ))
if ( !isEmpty )
{
pm[0] = "ICON_SMESH_TREE_GROUP_ON_FILTER";
}
else if ( SMESH::DownCast< SMESH_Group_i* > ( theGroup ))
{
if ( theGroup->GetType() == SMESH::NODE )
isEmpty = ( theMesh->NbNodes() == 0 );
else
if ( SMESH::DownCast< SMESH_GroupOnFilter_i* > ( theGroup )) // on filter
{
SMESH::array_of_ElementType_var allElemTypes = theMesh->GetTypes();
for ( size_t i =0; i < allElemTypes->length() && isEmpty; ++i )
isEmpty = ( allElemTypes[i] != theGroup->GetType() );
pm[0] = "ICON_SMESH_TREE_GROUP_ON_FILTER";
if ( theGroup->GetType() != SMESH::NODE )
{
isEmpty = true;
SMESH::array_of_ElementType_var allElemTypes = theMesh->GetTypes();
for ( size_t i =0; i < allElemTypes->length() && isEmpty; ++i )
isEmpty = ( allElemTypes[i] != theGroup->GetType() );
}
}
else // standalone or on geometry
{
isEmpty = ( theGroup->Size() == 0 );
}
}
aGroupSO = publish ( theGroup, aRootSO, 0, pm[isEmpty].c_str() );
@ -873,14 +877,14 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SMESH::SMESH_Mesh_ptr theMesh,
//=======================================================================
//function : PublishHypothesis
//purpose :
//purpose :
//=======================================================================
SALOMEDS::SObject_ptr
SMESH_Gen_i::PublishHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp,
const char* theName)
SMESH_Gen_i::PublishHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp,
const char* theName)
{
if(MYDEBUG) MESSAGE("PublishHypothesis")
if(MYDEBUG) MESSAGE("PublishHypothesis");
if ( !myIsEnablePublish )
return SALOMEDS::SObject::_nil();
if (theHyp->_is_nil())

View File

@ -174,10 +174,11 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
hyp.SetLength(length)
if not UseExisting:
# set preestimated length
import SMESH
gen = self.mesh.smeshpyD
initHyp = gen.GetHypothesisParameterValues("MaxLength", "libStdMeshersEngine.so",
self.mesh.GetMesh(), self.mesh.GetShape(),
False) # <- byMesh
SMESH.HypInitParams( 1, 1.0, False ))
preHyp = initHyp._narrow(StdMeshers.StdMeshers_MaxLength)
if preHyp:
hyp.SetPreestimatedLength( preHyp.GetPreestimatedLength() )

View File

@ -1250,6 +1250,27 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
return hyp
def GetHypothesisParameterValues( self, hypType, libName, mesh, shape, initParams ):
"""
Create hypothesis initialized according to parameters
Parameters:
hypType (string): hypothesis type
libName (string): plug-in library name
mesh: optional mesh by which a hypotheses can initialize self
shape: optional geometry by size of which a hypotheses can initialize self
initParams: structure SMESH.HypInitParams defining how to initialize a hypothesis
Returns:
created hypothesis instance
"""
if isinstance( mesh, Mesh ):
mesh = mesh.GetMesh()
if isinstance( initParams, (bool,int)):
initParams = SMESH.HypInitParams( not initParams, 1.0, not mesh )
return SMESH._objref_SMESH_Gen.GetHypothesisParameterValues(self, hypType, libName,
mesh, shape, initParams )
def GetMeshInfo(self, obj):
"""
Get the mesh statistic.

View File

@ -841,7 +841,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
item.myName = tr("SMESH_USE_PREESTIMATED_LENGTH");
p.append( item );
QCheckBox* aQCheckBox = new QCheckBox(dlg());
if ( !noPreestimatedAtEdition && h->HavePreestimatedLength() ) {
if ( h->HavePreestimatedLength() ) {
aQCheckBox->setChecked( h->GetUsePreestimatedLength() );
connect( aQCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( onValueChanged() ) );
}

View File

@ -183,6 +183,14 @@
<source>ICON_SMESH_TREE_HYPO_Geometric1D</source>
<translation>mesh_tree_hypo_length.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_HYPO_ImportSource1D</source>
<translation>mesh_tree_hypo_import_source_1d.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_HYPO_ImportSource2D</source>
<translation>mesh_tree_hypo_import_source_2d.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_HYPO_AutomaticLength</source>
<translation>mesh_tree_hypo_length.png</translation>
@ -191,6 +199,10 @@
<source>ICON_SMESH_TREE_HYPO_Deflection1D</source>
<translation>mesh_tree_hypo_length.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_HYPO_FixedPoints1D</source>
<translation>mesh_tree_hypo_length.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_HYPO_Adaptive1D</source>
<translation>mesh_tree_hypo_length.png</translation>
@ -199,6 +211,10 @@
<source>ICON_SMESH_TREE_HYPO_LayerDistribution</source>
<translation>mesh_tree_hypo_layers_distribution.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_HYPO_LayerDistribution2D</source>
<translation>mesh_tree_hypo_layers_distribution_2d.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_HYPO_LengthFromEdges</source>
<translation>mesh_tree_hypo_area.png</translation>
@ -229,7 +245,7 @@
</message>
<message>
<source>ICON_SMESH_TREE_HYPO_NumberOfLayers2D</source>
<translation>mesh_tree_hypo_layers_distribution.png</translation>
<translation>mesh_tree_hypo_layers_distribution_2d.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_HYPO_NumberOfSegments</source>