From: vsr Date: Mon, 8 Oct 2012 13:15:17 +0000 (+0000) Subject: Merge from V6_main (04/10/2012) X-Git-Tag: V7_0_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=624088f60d511048f87296e3b379f62b140a155a;p=plugins%2Fhexoticplugin.git Merge from V6_main (04/10/2012) --- diff --git a/configure.ac b/configure.ac index 2a0445f..2677c60 100644 --- a/configure.ac +++ b/configure.ac @@ -464,6 +464,7 @@ AC_OUTPUT([ \ src/Makefile \ src/HexoticPlugin/Makefile \ src/GUI/Makefile \ + src/GUI/resources/Makefile \ HexoticPLUGIN_version.h \ doc/Makefile \ doc/salome/Makefile \ diff --git a/doc/salome/gui/HexoticPLUGIN/Makefile.am b/doc/salome/gui/HexoticPLUGIN/Makefile.am index 7c980d3..dd1a988 100755 --- a/doc/salome/gui/HexoticPLUGIN/Makefile.am +++ b/doc/salome/gui/HexoticPLUGIN/Makefile.am @@ -29,16 +29,15 @@ EXTRA_DIST += images input static/footer.html static/doxygen.css guidocdir = $(docdir)/gui/HexoticPLUGIN guidoc_DATA = images/head.png +DOC_PYTHONPATH=$(prefix)/bin/salome:$(SMESH_ROOT_DIR)/bin/salome:$(SMESH_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(MED_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(GEOM_ROOT_DIR)/bin/salome:$(GEOM_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/bin/salome:$(KERNEL_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages +DOC_SMESH_MeshersList=HexoticPLUGIN -usr_docs: doxyfile - echo "===========================================" ; \ - echo "Generating Python interface documentation"; \ - echo "===========================================" ; \ - $(DOXYGEN) doxyfile_py \ - echo "===========================================" ; \ - echo "Generating GUI documentation" ; \ - echo "===========================================" ; \ - $(DOXYGEN) doxyfile ; +smesh.py: $(top_srcdir)/src/HexoticPlugin/HexoticPLUGINDC.py + @PYTHONPATH=$(DOC_PYTHONPATH):${PYTHONPATH} SMESH_MeshersList=$(DOC_SMESH_MeshersList) $(PYTHON) $(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py -d -o $@ HexoticPLUGIN + +usr_docs: doxyfile_py doxyfile smesh.py + @$(DOXYGEN) doxyfile_py ; \ + $(DOXYGEN) doxyfile docs: usr_docs diff --git a/doc/salome/gui/HexoticPLUGIN/doxyfile_py.in b/doc/salome/gui/HexoticPLUGIN/doxyfile_py.in index 3735e28..40dffc8 100755 --- a/doc/salome/gui/HexoticPLUGIN/doxyfile_py.in +++ b/doc/salome/gui/HexoticPLUGIN/doxyfile_py.in @@ -96,7 +96,9 @@ EXAMPLE_RECURSIVE = NO #--------------------------------------------------------------------------- #Input related options #--------------------------------------------------------------------------- -INPUT = @top_srcdir@/src/HexoticPlugin/HexoticPLUGINDC.py +INPUT = @top_srcdir@/src/HexoticPlugin/HexoticPLUGINDC.py \ + smesh.py \ + @SMESH_ROOT_DIR@/bin/salome/smesh_algorithm.py FILE_PATTERNS = IMAGE_PATH = @srcdir@/images RECURSIVE = NO @@ -129,24 +131,24 @@ GENERATE_RTF = NO #--------------------------------------------------------------------------- CLASS_DIAGRAMS = NO HIDE_UNDOC_RELATIONS = NO -HAVE_DOT = NO -CLASS_GRAPH = NO +HAVE_DOT = YES +CLASS_GRAPH = YES COLLABORATION_GRAPH = NO GROUP_GRAPHS = NO UML_LOOK = NO -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = NO -INCLUDED_BY_GRAPH = NO +TEMPLATE_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO -GRAPHICAL_HIERARCHY = NO -DIRECTORY_GRAPH = NO -DOT_IMAGE_FORMAT = jpg +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png DOT_FONTNAME = Arial DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1200 -MAX_DOT_GRAPH_DEPTH = 0 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO GENERATE_LEGEND = NO @@ -156,4 +158,4 @@ DOT_CLEANUP = YES #External reference options #--------------------------------------------------------------------------- GENERATE_TAGFILE = hexoticpluginpy_doc.tag -SEARCHENGINE = YES \ No newline at end of file +SEARCHENGINE = YES diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_basic_subdivisions_4_8.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_basic_subdivisions_4_8.png new file mode 100644 index 0000000..b4f70bf Binary files /dev/null and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_basic_subdivisions_4_8.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png index 40abfed..c479731 100644 Binary files a/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_parameters.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_1.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_1.png new file mode 100644 index 0000000..39c5078 Binary files /dev/null and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_1.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_2.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_2.png new file mode 100644 index 0000000..78382a0 Binary files /dev/null and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_2.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_3.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_3.png new file mode 100644 index 0000000..caa189f Binary files /dev/null and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_3.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_4.png b/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_4.png new file mode 100644 index 0000000..547c07a Binary files /dev/null and b/doc/salome/gui/HexoticPLUGIN/images/hexotic_sd_mode_4.png differ diff --git a/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc b/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc index d42d1f8..bfed6b2 100644 --- a/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc +++ b/doc/salome/gui/HexoticPLUGIN/input/hexotic_hypo.doc @@ -4,7 +4,7 @@ \n Hexotic Parameters hypothesis works only with Hexotic algorithm. This algorithm is a commercial software. -\n To get a licence, visit http://www.distene.com/corp/eval-distene.html +\n To get a licence, visit http://www.distene.com/en/corp/eval-distene.html \image html hexotic_parameters.png @@ -12,12 +12,14 @@ algorithm. This algorithm is a commercial software.
  • Name - allows to define the name of the hypothesis (Hexotic Parameters by default).
  • +
  • Min size - allows defining the minimal size of the elements (overrides "Nb. Hexes Max Level" value).
  • + +
  • Max size - allows defining the maximal size of the elements (overrides "Nb. Hexes Min Level" value).
  • +
  • Nb. Hexes Min Level - allows defining the minimal level of recursive partitioning on the initial octree cube.
  • Nb. Hexes Max Level - allows defining the maximal level of recursive partitioning on the initial octree cube.
  • -
  • Salome Quadrangles - not documented.
  • -
  • Generate smooth meshes no ridges - specifies that the mesher can ignore ridges. A ridge is a geometrical entity (a sharp edge). The resulting meshes will have better quality elements, at the price of "smoothing" out the geometry.
  • @@ -32,8 +34,22 @@ Parameters by default).
  • Working directory - specifies the directory where the input/output files will be created.
  • + +
  • Verbosity - specifies the verbose level to print information on meshing steps. +
  • + +
  • Sub-domains mesh mode - This option allows the user to mesh or not mesh internal subdomains (such as holes), or to mesh non-manifold domains. + +
  • \note If BLSURF is used as 2D algo, and if a GMF file is defined as output file (using SetGMFFile(my2Dmesh.mesh)), then Hexotic will use this file as input. This allows to avoid the reconstruction of the GMF file from the SMESH structure and can improve the global computation time. + +
    See Also a sample TUI Script of the \ref tui_hexotic "creation of an Hexotic mesh" */ diff --git a/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_intarface.doc b/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_intarface.doc deleted file mode 100644 index cb13cae..0000000 --- a/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_intarface.doc +++ /dev/null @@ -1,9 +0,0 @@ -/*! - -\page hexoticplugin_python_intarface_page Python Interface - -Python package \ref HexoticPLUGINDC "HexoticPLUGIN" defines several classes, destined for creation of the 3D meshes. - -Documentation for HexoticPLUGIN package is available in linear form grouped by classes, declared in the HexoticPLUGINDC.py file. - -*/ diff --git a/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_interface.doc b/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_interface.doc new file mode 100644 index 0000000..709680e --- /dev/null +++ b/doc/salome/gui/HexoticPLUGIN/input/hexoticplugin_python_interface.doc @@ -0,0 +1,214 @@ +/*! + +\page hexoticplugin_python_interface_page Python Interface + +Python package HexoticPLUGINDC defines several classes, destined for creation of the 3D meshes. + +Hexotic meshing plugin dynamically adds several methods to the smesh.Mesh class to create meshing algorithms. + +Below you can see an example of usage of the HexoticPlugin Python API for mesh generation: + +\anchor tui_hexotic + +-# \ref tui_hexotic_basic +-# \ref tui_hexotic_sd_mode + -# \ref tui_hexotic_sd_mode1 + -# \ref tui_hexotic_sd_mode2 + -# \ref tui_hexotic_sd_mode3 + -# \ref tui_hexotic_sd_mode4 + +\section tui_hexotic_basic Construction of Mesh using Hexotic algorithm + +\code +import geompy +import smesh + +# create a sphere +sphere = geompy.MakeSphereR(100.) +geompy.addToStudy(sphere, "sphere") + +# create a mesh on the sphere +hexoticMesh = smesh.Mesh(sphere,"sphere: BLSurf and Hexotic mesh") + +# create a BLSurf algorithm for faces +BLSURF = hexoticMesh.Triangle(algo=smesh.BLSURF) +BLSURF.SetGeometricMesh( 1 ) + +# create a Hexotic algorithm for volumes +HEXOTIC = hexoticMesh.Hexahedron(algo=smesh.Hexotic) + +# compute the mesh +hexoticMesh.Compute() + +# Change the level of subdivision +HEXOTIC.SetMinMaxHexes(4, 8) + +# End of script +\endcode + +\image html hexotic_basic_subdivisions_4_8.png Left: Hexotic mesh without hypothesis, right: Hexotic mesh with an hypothesis defined by minl=4 and maxl=8 + +\ref tui_hexotic "Back to top" + +\section tui_hexotic_sd_mode Effect of the sub-domain mode + +This example illustrates the sub-domain mode of Hexotic. + +\subsection tui_hexotic_sd_mode1 Sub-domain mode = 1 + +\code +import SALOMEDS +import geompy +import smesh + +# Create geometry: a box cut by a holed sphere +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +Sphere_1 = geompy.MakeSphereR(75) +Sphere_2 = geompy.MakeSphereR(25) +geompy.TranslateDXDYDZ(Box_1, -100, -100, -100) +Cut_1 = geompy.MakeCut(Sphere_1, Sphere_2) +Cut_2 = geompy.MakeCut(Box_1, Cut_1) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Sphere_1, 'Sphere_1' ) +geompy.addToStudy( Sphere_2, 'Sphere_2' ) +geompy.addToStudy( Cut_1, 'Cut_1' ) +geompy.addToStudy( Cut_2, 'Cut_2' ) + +# Create filters +# aFilter1: elements inside small sphere +aFilter1 = smesh.GetFilterFromCriteria([smesh.GetCriterion(smesh.VOLUME,smesh.FT_BelongToGeom,smesh.FT_Undefined,Sphere_2)]) +# aFilter2: elements inside big sphere and not inside small sphere +aFilter2 = smesh.GetFilterFromCriteria([smesh.GetCriterion(smesh.VOLUME,smesh.FT_BelongToGeom,smesh.FT_Undefined,Sphere_1, smesh.FT_LogicalAND), + smesh.GetCriterion(smesh.VOLUME,smesh.FT_BelongToGeom,smesh.FT_Undefined,Sphere_2, smesh.FT_LogicalNOT)]) +# aFilter3: elements not inside big sphere +aFilter3 = smesh.GetFilterFromCriteria([smesh.GetCriterion(smesh.VOLUME,smesh.FT_BelongToGeom,smesh.FT_Undefined,Sphere_1, smesh.FT_LogicalNOT)]) + +# Create mesh of Cut_2 with sd mode 1 +print "Create mesh of Cut_2 with sd mode 1" +Mesh_hexotic_sd1 = smesh.Mesh(Cut_2, "Mesh_hexotic_sd1") + +# Create the 2D algo: BlSurf with geometrical mesh +Mesh_hexotic_sd1.Triangle(algo=smesh.BLSURF).Parameters().SetGeometricMesh( 1 ) + +# Create the 3D algo: Hexotic with: +# - minl = 4 +# - maxl = 8 +# - sd = 1 +Mesh_hexotic_sd1.Hexahedron(algo=smesh.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 1 ) + +# Create the groups on filters +g1 = Mesh_hexotic_sd1.GroupOnFilter(smesh.VOLUME, 'small sphere', aFilter1 ) +g1.SetColor( SALOMEDS.Color( 1, 0, 0 )) +g2 = Mesh_hexotic_sd1.GroupOnFilter(smesh.VOLUME, 'big sphere - small sphere', aFilter2 ) +g2.SetColor( SALOMEDS.Color( 0, 1, 0 )) +g3 = Mesh_hexotic_sd1.GroupOnFilter(smesh.VOLUME, 'box - big sphere', aFilter3 ) +g3.SetColor( SALOMEDS.Color( 0, 0, 1 )) + +# Compute +Mesh_hexotic_sd1.Compute() + +# End of script +\endcode + +\image html hexotic_sd_mode_1.png Hexotic mesh of a box cut by a holed sphere ( sd = 1 ) + +\ref tui_hexotic "Back to top" + +\subsection tui_hexotic_sd_mode2 Sub-domain mode = 2 + +\code + +# Create mesh of Cut_2 with sd mode 2 +print "Create mesh of Cut_2 with sd mode 2" +Mesh_hexotic_sd2 = smesh.Mesh(Cut_2, "Mesh_hexotic_sd2") + +# Create the 2D algo: BlSurf with geometrical mesh +Mesh_hexotic_sd2.Triangle(algo=smesh.BLSURF).Parameters().SetGeometricMesh( 1 ) + +# Create the 3D algo: Hexotic with: +# - minl = 4 +# - maxl = 8 +# - sd = 2 +Mesh_hexotic_sd2.Hexahedron(algo=smesh.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 2 ) + +# Create the groups on filters +g1 = Mesh_hexotic_sd2.GroupOnFilter(smesh.VOLUME, 'small sphere', aFilter1 ) +g1.SetColor( SALOMEDS.Color( 1, 0, 0 )) +g2 = Mesh_hexotic_sd2.GroupOnFilter(smesh.VOLUME, 'big sphere - small sphere', aFilter2 ) +g2.SetColor( SALOMEDS.Color( 0, 1, 0 )) +g3 = Mesh_hexotic_sd2.GroupOnFilter(smesh.VOLUME, 'box - big sphere', aFilter3 ) +g3.SetColor( SALOMEDS.Color( 0, 0, 1 )) + +# Compute +Mesh_hexotic_sd2.Compute() + +# End of script +\endcode + +\image html hexotic_sd_mode_2.png Hexotic mesh of a box cut by a holed sphere ( sd = 2 ) + +\ref tui_hexotic "Back to top" + +\subsection tui_hexotic_sd_mode3 Sub-domain mode = 3 + +\code + +# Create mesh of Cut_2 with sd mode 3 +print "Create mesh of Cut_2 with sd mode 3" +Mesh_hexotic_sd3 = smesh.Mesh(Cut_2, "Mesh_hexotic_sd3") + +# Create the 2D algo: BlSurf with geometrical mesh +Mesh_hexotic_sd3.Triangle(algo=smesh.BLSURF).Parameters().SetGeometricMesh( 1 ) + +# Create the 3D algo: Hexotic with: +# - minl = 4 +# - maxl = 8 +# - sd = 3 +Mesh_hexotic_sd3.Hexahedron(algo=smesh.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 3 ) + +# Create the groups on filters +g1 = Mesh_hexotic_sd3.GroupOnFilter(smesh.VOLUME, 'small sphere', aFilter1 ) +g1.SetColor( SALOMEDS.Color( 1, 0, 0 )) +g2 = Mesh_hexotic_sd3.GroupOnFilter(smesh.VOLUME, 'big sphere - small sphere', aFilter2 ) +g2.SetColor( SALOMEDS.Color( 0, 1, 0 )) +g3 = Mesh_hexotic_sd3.GroupOnFilter(smesh.VOLUME, 'box - big sphere', aFilter3 ) +g3.SetColor( SALOMEDS.Color( 0, 0, 1 )) + +# Compute +Mesh_hexotic_sd3.Compute() + +# End of script +\endcode + +\image html hexotic_sd_mode_3.png Hexotic mesh of a box cut by a holed sphere ( sd = 3 ) + +\ref tui_hexotic "Back to top" + +\subsection tui_hexotic_sd_mode4 Sub-domain mode = 4 + +\code + +# Create geometry: a box cut by a plane +Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200) +Translation_1 = geompy.MakeTranslation(Box_1, 0, 200, 0) +Partition_1 = geompy.MakePartition([Box_1, Translation_1], [], [], [], geompy.ShapeType["SOLID"], 0, [], 0) +geompy.addToStudy( Box_1, 'Box_1' ) +geompy.addToStudy( Translation_1, 'Translation_1' ) +geompy.addToStudy( Partition_1, 'Partition_1' ) + +# Create mesh of Partition_1 with sd mode 4 (default sd mode in SALOME) +Mesh_hexotic_sd4 = smesh.Mesh(Partition_1, "Mesh_hexotic_sd4") +Mesh_hexotic_sd4.Triangle(algo=smesh.BLSURF) +Mesh_hexotic_sd4.Hexahedron(algo=smesh.Hexotic).SetMinMaxHexes(4, 8).SetHexoticSdMode( 4 ) + +# Compute +Mesh_hexotic_sd4.Compute() + +# End of script +\endcode + +\image html hexotic_sd_mode_4.png Hexotic mesh of a box cut by a plane ( On the left, sd = 3: the internal surface is ignored ; on the right sd = 4: all sub-domains are meshed ) + +\ref tui_hexotic "Back to top" + +*/ diff --git a/doc/salome/gui/HexoticPLUGIN/input/index.doc b/doc/salome/gui/HexoticPLUGIN/input/index.doc index 331bf18..ec94806 100644 --- a/doc/salome/gui/HexoticPLUGIN/input/index.doc +++ b/doc/salome/gui/HexoticPLUGIN/input/index.doc @@ -2,18 +2,18 @@ \mainpage Introduction to HexoticPLUGIN -\n \b HexoticPLUGIN plugin is destined for: +\b HexoticPLUGIN plugin is destined for: +- Meshing 3D geometric entities. +- Generating 3D meshes from 2D meshes, working without geometrical objects. - - +\note HexoticPLUGIN plugin uses DISTENE Hexotic commercial meshing +software and requires a license at the run time (to work within the +Mesh module). To manage parameters of the HexoticPLUGIN use \subpage hexotic_hypo_page. Also all HexoticPLUGIN functionalities are accessible via -\subpage hexoticplugin_python_intarface_page "HexoticPLUGIN Python interface". +\subpage hexoticplugin_python_interface_page "HexoticPLUGIN Python interface". */ diff --git a/idl/HexoticPlugin_Algorithm.idl b/idl/HexoticPlugin_Algorithm.idl index 66bb491..293da24 100644 --- a/idl/HexoticPlugin_Algorithm.idl +++ b/idl/HexoticPlugin_Algorithm.idl @@ -31,7 +31,7 @@ * HexoticPlugin: interfaces to Hexotic related hypotheses and algorithms */ module HexoticPlugin -{ +{ /*! * HexoticPlugin_Hexotic: interface of Hexotic algorithm */ @@ -49,9 +49,12 @@ module HexoticPlugin void SetHexesMaxLevel(in long value); long GetHexesMaxLevel(); + + void SetMinSize(in double value); + double GetMinSize(); - void SetHexoticQuadrangles(in boolean value); - boolean GetHexoticQuadrangles(); + void SetMaxSize(in double value); + double GetMaxSize(); void SetHexoticIgnoreRidges(in boolean value); boolean GetHexoticIgnoreRidges(); @@ -59,14 +62,20 @@ module HexoticPlugin void SetHexoticInvalidElements(in boolean value); boolean GetHexoticInvalidElements(); - void SetHexoticSharpAngleThreshold(in long value); - long GetHexoticSharpAngleThreshold(); + void SetHexoticSharpAngleThreshold(in double value); + double GetHexoticSharpAngleThreshold(); void SetHexoticNbProc(in long value); long GetHexoticNbProc(); void SetHexoticWorkingDirectory(in string path) raises (SALOME::SALOME_Exception); string GetHexoticWorkingDirectory(); + + void SetHexoticSdMode(in long value); + long GetHexoticSdMode(); + + void SetHexoticVerbosity(in long value); + long GetHexoticVerbosity(); }; }; diff --git a/resources/HexoticPLUGIN.xml b/resources/HexoticPLUGIN.xml index fe30c32..cd4d251 100644 --- a/resources/HexoticPLUGIN.xml +++ b/resources/HexoticPLUGIN.xml @@ -46,7 +46,7 @@ dim="3"> Hexotic_3D=Hexahedron(algo=smesh.Hexotic) - Hexotic_Parameters=MinMaxQuad(SetHexesMinLevel(),SetHexesMaxLevel(),SetHexoticQuadrangles()) + Hexotic_Parameters=Parameters() diff --git a/src/GUI/HexoticPLUGIN_images.ts b/src/GUI/HexoticPLUGIN_images.ts index e70321e..78717e0 100644 --- a/src/GUI/HexoticPLUGIN_images.ts +++ b/src/GUI/HexoticPLUGIN_images.ts @@ -2,30 +2,50 @@ - @default - - ICON_DLG_Hexotic_PARAMETERS - mesh_hypo_Hexotic.png - - - ICON_DLG_Hexotic_PARAMETERS_3D - mesh_hypo_Hexotic.png - - - ICON_SMESH_TREE_ALGO_Hexotic_2D3D - mesh_tree_algo_Hexotic.png - - - ICON_SMESH_TREE_ALGO_Hexotic_3D - mesh_tree_algo_Hexotic.png - - - ICON_SMESH_TREE_HYPO_Hexotic_Parameters - mesh_tree_hypo_Hexotic.png - - - ICON_SMESH_TREE_HYPO_Hexotic_Parameters_3D - mesh_tree_hypo_Hexotic.png - + @default + + ICON_DLG_Hexotic_PARAMETERS + mesh_hypo_Hexotic.png + + + ICON_DLG_Hexotic_PARAMETERS_3D + mesh_hypo_Hexotic.png + + + ICON_SMESH_TREE_ALGO_Hexotic_2D3D + mesh_tree_algo_Hexotic.png + + + ICON_SMESH_TREE_ALGO_Hexotic_3D + mesh_tree_algo_Hexotic.png + + + ICON_SMESH_TREE_HYPO_Hexotic_Parameters + mesh_tree_hypo_Hexotic.png + + + ICON_SMESH_TREE_HYPO_Hexotic_Parameters_3D + mesh_tree_hypo_Hexotic.png + + + Hexotic_SD_MODE_GEOM + sd_mode_geom.png + + + Hexotic_SD_MODE_1_PIXMAP + sd_mode_1.png + + + Hexotic_SD_MODE_2_PIXMAP + sd_mode_2.png + + + Hexotic_SD_MODE_3_PIXMAP + sd_mode_3.png + + + Hexotic_SD_MODE_4_PIXMAP + sd_mode_4.png + diff --git a/src/GUI/HexoticPLUGIN_msg_en.ts b/src/GUI/HexoticPLUGIN_msg_en.ts index 362823c..e6bf808 100644 --- a/src/GUI/HexoticPLUGIN_msg_en.ts +++ b/src/GUI/HexoticPLUGIN_msg_en.ts @@ -11,6 +11,22 @@ Hexotic_3D_TITLE Hypothesis Construction + + Hexotic_INPUT_SIZE + Sizes + + + Hexotic_INPUT_LEVEL + Subdivision levels + + + Hexotic_MAX_SIZE + Max size + + + Hexotic_MIN_SIZE + Min size + Hexotic_HEXES_MAX_LEVEL Nb. Hexes Max Level @@ -27,10 +43,6 @@ Hexotic_INVALID_ELEMENTS Authorize invalid elements - - Hexotic_QUADRANGLES - Salome Quadrangles - Hexotic_SHARP_ANGLE_THRESHOLD Sharp angle threshold in degrees @@ -45,7 +57,31 @@ Hexotic_SELECT_DIR - ... + Select ... + + + Hexotic_VERBOSITY + Verbosity + + + Hexotic_SUBDOMAIN_MESH_MODE + Sub-domains mesh mode + + + Hexotic_SD_MODE_1 + Single domain + + + Hexotic_SD_MODE_2 + Cavities ignored + + + Hexotic_SD_MODE_3 + Cavities meshed + + + Hexotic_SD_MODE_4 + Non-manifold geometries diff --git a/src/GUI/HexoticPLUGIN_msg_fr.ts b/src/GUI/HexoticPLUGIN_msg_fr.ts index 73770b5..97930c1 100755 --- a/src/GUI/HexoticPLUGIN_msg_fr.ts +++ b/src/GUI/HexoticPLUGIN_msg_fr.ts @@ -11,6 +11,22 @@ Hexotic_3D_TITLE Construction de l'hypothèse + + Hexotic_INPUT_SIZE + Tailles + + + Hexotic_INPUT_LEVEL + Niveaux de subdivision + + + Hexotic_MAX_SIZE + Taille max + + + Hexotic_MIN_SIZE + Taille min + Hexotic_HEXES_MAX_LEVEL Nb. des hexagones: niveau max @@ -45,7 +61,31 @@ Hexotic_SELECT_DIR - ... + Choisir ... + + + Hexotic_VERBOSITY + Verbosité + + + Hexotic_SUBDOMAIN_MESH_MODE + Mode de maillage des sous-domaines + + + Hexotic_SD_MODE_1 + Domaine unique + + + Hexotic_SD_MODE_2 + Cavités ignorées + + + Hexotic_SD_MODE_3 + Cavités maillées + + + Hexotic_SD_MODE_4 + Géométries "non-manifold" diff --git a/src/GUI/HexoticPluginGUI_Dlg.h b/src/GUI/HexoticPluginGUI_Dlg.h new file mode 100644 index 0000000..e14421b --- /dev/null +++ b/src/GUI/HexoticPluginGUI_Dlg.h @@ -0,0 +1,60 @@ +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : DlgRef.h +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +#ifndef HEXOTICPLUGINGUI_H +#define HEXOTICPLUGINGUI_H + +class QPixmap; + +enum { + SD_MODE_1, + SD_MODE_2, + SD_MODE_3, + SD_MODE_4 +}; + +////////////////////////////////////////// +// HexoticPluginGUI_StdWidget +////////////////////////////////////////// + +#include "ui_HexoticPluginGUI_StdWidget_QTD.h" +#include "HexoticPluginGUI.h" + +class HEXOTICPLUGIN_GUI_EXPORT HexoticPluginGUI_StdWidget : public QWidget, + public Ui::HexoticPluginGUI_StdWidget_QTD +{ + Q_OBJECT + +public: + HexoticPluginGUI_StdWidget( QWidget* = 0, Qt::WindowFlags = 0 ); + ~HexoticPluginGUI_StdWidget(); + +public slots: + void onDirBtnClicked(); + void onSdModeSelected(int sdMode); + +public: + QPixmap imageSdMode; +}; + + +#endif diff --git a/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx b/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx index a1ba5a4..9208a04 100644 --- a/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/HexoticPluginGUI_HypothesisCreator.cxx @@ -23,6 +23,7 @@ // --- // #include "HexoticPluginGUI_HypothesisCreator.h" +#include "HexoticPluginGUI_Dlg.h" #include #include @@ -44,14 +45,6 @@ #include #include -enum Fineness { - VeryCoarse, - Coarse, - Moderate, - Fine, - VeryFine, - UserDefined -}; HexoticPluginGUI_HypothesisCreator::HexoticPluginGUI_HypothesisCreator( const QString& theHypType ) : SMESHGUI_GenericHypothesisCreator( theHypType ), @@ -63,13 +56,33 @@ HexoticPluginGUI_HypothesisCreator::~HexoticPluginGUI_HypothesisCreator() { } -bool HexoticPluginGUI_HypothesisCreator::checkParams() const +bool HexoticPluginGUI_HypothesisCreator::checkParams(QString& msg) const { + msg.clear(); HexoticHypothesisData data_old, data_new; readParamsFromHypo( data_old ); readParamsFromWidgets( data_new ); + bool res = storeParamsToHypo( data_new ); - return res; + if ( !res ) { + storeParamsToHypo( data_old ); + return res; + } + + res = data_new.myMinSize <= data_new.myMaxSize; + if ( !res ) { + msg = tr(QString("Min size (%1) is higher than max size (%2)").arg(data_new.myMinSize).arg(data_new.myMaxSize).toStdString().c_str()); + return res; + } + + res = data_new.myHexesMinLevel == 0 || \ + ( data_new.myHexesMinLevel != 0 && (data_new.myHexesMinLevel < data_new.myHexesMaxLevel) ); + if ( !res ) { + msg = tr(QString("Min hexes level (%1) is higher than max hexes level (%2)").arg(data_new.myHexesMinLevel).arg(data_new.myHexesMaxLevel).toStdString().c_str()); + return res; + } + + return true; } QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() @@ -89,87 +102,110 @@ QFrame* HexoticPluginGUI_HypothesisCreator::buildFrame() int row = 0; myName = 0; if( isCreation() ) { - l->addWidget( new QLabel( tr( "SMESH_NAME" ), GroupC1 ), row, 0, 1, 2 ); + l->addWidget( new QLabel( tr( "SMESH_NAME" ), GroupC1 ), row, 0, 1, 1 ); myName = new QLineEdit( GroupC1 ); - l->addWidget( myName, row++, 2, 1, 1 ); + l->addWidget( myName, row++, 1, 1, 2 ); myName->setMinimumWidth( 150 ); } HexoticPlugin::HexoticPlugin_Hypothesis_var h = HexoticPlugin::HexoticPlugin_Hypothesis::_narrow( initParamsHypothesis() ); - l->addWidget( new QLabel( tr( "Hexotic_HEXES_MIN_LEVEL" ), GroupC1 ), row, 0, 1, 2 ); - myHexesMinLevel = new QtxIntSpinBox( GroupC1 ); - myHexesMinLevel->setMinimum( 3 ); - //myHexesMinLevel->setMinimum( h->GetHexesMinLevel() ); - myHexesMinLevel->setMaximum( 10 ); - myHexesMinLevel->setSingleStep( 1 ); - l->addWidget( myHexesMinLevel, row++, 2, 1, 1 ); - - l->addWidget( new QLabel( tr( "Hexotic_HEXES_MAX_LEVEL" ), GroupC1 ), row, 0, 1, 2 ); - myHexesMaxLevel = new QtxIntSpinBox( GroupC1 ); - myHexesMaxLevel->setMinimum( 3 ); - myHexesMaxLevel->setMaximum( 10 ); - myHexesMaxLevel->setSingleStep( 1 ); - l->addWidget( myHexesMaxLevel, row++, 2, 1, 1 ); - - myHexoticQuadrangles = new QCheckBox( tr( "Hexotic_QUADRANGLES" ), GroupC1 ); - l->addWidget( myHexoticQuadrangles, row++, 0, 1, 3 ); - myIs3D = true; + myStdWidget = new HexoticPluginGUI_StdWidget(GroupC1); + l->addWidget( myStdWidget, row++, 0, 1, 3 ); + myStdWidget->onSdModeSelected(SD_MODE_4); - myHexoticIgnoreRidges = new QCheckBox( tr( "Hexotic_IGNORE_RIDGES" ), GroupC1 ); - l->addWidget( myHexoticIgnoreRidges, row++, 0, 1, 3 ); - - myHexoticInvalidElements = new QCheckBox( tr( "Hexotic_INVALID_ELEMENTS" ), GroupC1 ); - l->addWidget( myHexoticInvalidElements, row++, 0, 1, 3 ); - - l->addWidget( new QLabel( tr( "Hexotic_SHARP_ANGLE_THRESHOLD" ), GroupC1 ), row, 0, 1, 2 ); - myHexoticSharpAngleThreshold = new QtxIntSpinBox( GroupC1 ); - myHexoticSharpAngleThreshold->setMinimum( 0 ); - myHexoticSharpAngleThreshold->setMaximum( 90 ); - myHexoticSharpAngleThreshold->setSingleStep( 1 ); - l->addWidget( myHexoticSharpAngleThreshold, row++, 2, 1, 1 ); - - l->addWidget( new QLabel( tr( "Hexotic_NB_PROC" ), GroupC1 ), row, 0, 1, 2 ); - myHexoticNbProc = new QtxIntSpinBox( GroupC1 ); - myHexoticNbProc->setMinimum( 1 ); - myHexoticNbProc->setMaximum( 256 ); - myHexoticNbProc->setSingleStep( 1 ); - l->addWidget( myHexoticNbProc, row++, 2, 1, 1 ); - - l->addWidget( new QLabel( tr( "Hexotic_WORKING_DIR" ), GroupC1 ), row, 0, 1, 1 ); - QPushButton* dirBtn = new QPushButton( tr( "Hexotic_SELECT_DIR" ), GroupC1 ); - dirBtn->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); - l->addWidget( dirBtn, row, 1, 1, 1 ); - myHexoticWorkingDir = new QLineEdit( GroupC1 ); - l->addWidget( myHexoticWorkingDir, row++, 2, 1, 1 ); - - connect( dirBtn, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) ); - + myIs3D = true; +// resizeEvent(); return fr; } +//================================================================================= +// function : resizeEvent [REDEFINED] +// purpose : +//================================================================================= +void HexoticPluginGUI_HypothesisCreator::resizeEvent(QResizeEvent */*event*/) { + QSize scaledSize = myStdWidget->imageSdMode.size(); + scaledSize.scale(myStdWidget->sdModeLabel->size(), Qt::KeepAspectRatioByExpanding); + if (!myStdWidget->sdModeLabel->pixmap() || scaledSize != myStdWidget->sdModeLabel->pixmap()->size()) + myStdWidget->sdModeLabel->setPixmap(myStdWidget->imageSdMode.scaled(myStdWidget->sdModeLabel->size(), + Qt::KeepAspectRatio, + Qt::SmoothTransformation)); +} + void HexoticPluginGUI_HypothesisCreator::retrieveParams() const { HexoticHypothesisData data; readParamsFromHypo( data ); + printData(data); if( myName ) myName->setText( data.myName ); - myHexesMinLevel->setValue( data.myHexesMinLevel ); - myHexesMaxLevel->setValue( data.myHexesMaxLevel ); - myHexoticSharpAngleThreshold->setValue( data.myHexoticSharpAngleThreshold ); - - myHexoticQuadrangles->setChecked( data.myHexoticQuadrangles ); - myHexoticIgnoreRidges->setChecked( data.myHexoticIgnoreRidges ); - myHexoticInvalidElements->setChecked( data.myHexoticInvalidElements ); - myHexesMinLevel->setEnabled(true); - myHexesMaxLevel->setEnabled(true); - myHexoticSharpAngleThreshold->setEnabled(true); + myStdWidget->myMinSize->setCleared(data.myMinSize == 0); + if (data.myMinSize == 0) + myStdWidget->myMinSize->setText(""); + else + myStdWidget->myMinSize->setValue( data.myMinSize ); + + myStdWidget->myMaxSize->setCleared(data.myMaxSize == 0); + if (data.myMaxSize == 0) + myStdWidget->myMaxSize->setText(""); + else + myStdWidget->myMaxSize->setValue( data.myMaxSize ); + + myStdWidget->myHexesMinLevel->setCleared(data.myHexesMinLevel == 0); + if (data.myHexesMinLevel == 0) + myStdWidget->myHexesMinLevel->setText(""); + else + myStdWidget->myHexesMinLevel->setValue( data.myHexesMinLevel ); + + myStdWidget->myHexesMaxLevel->setCleared(data.myHexesMaxLevel == 0); + if (data.myHexesMaxLevel == 0) + myStdWidget->myHexesMaxLevel->setText(""); + else + myStdWidget->myHexesMaxLevel->setValue( data.myHexesMaxLevel ); + + myStdWidget->myHexoticIgnoreRidges->setChecked( data.myHexoticIgnoreRidges ); + myStdWidget->myHexoticInvalidElements->setChecked( data.myHexoticInvalidElements ); - myHexoticNbProc->setValue( data.myHexoticNbProc ); - myHexoticWorkingDir->setText( data.myHexoticWorkingDir ); + myStdWidget->myHexoticSharpAngleThreshold->setCleared(data.myHexoticSharpAngleThreshold == 0); + if (data.myHexoticSharpAngleThreshold == 0) + myStdWidget->myHexoticSharpAngleThreshold->setText(""); + else + myStdWidget->myHexoticSharpAngleThreshold->setValue( data.myHexoticSharpAngleThreshold ); + + myStdWidget->myHexoticNbProc->setValue( data.myHexoticNbProc ); + myStdWidget->myHexoticWorkingDir->setText( data.myHexoticWorkingDir ); + + myStdWidget->myHexoticVerbosity->setValue( data.myHexoticVerbosity ); + + myStdWidget->myHexoticSdMode->setCurrentIndex(data.myHexoticSdMode); + + std::cout << "myStdWidget->myMinSize->value(): " << myStdWidget->myMinSize->value() << std::endl; + std::cout << "myStdWidget->myMaxSize->value(): " << myStdWidget->myMaxSize->value() << std::endl; + std::cout << "myStdWidget->myHexesMinLevel->value(): " << myStdWidget->myHexesMinLevel->value() << std::endl; + std::cout << "myStdWidget->myHexesMaxLevel->value(): " << myStdWidget->myHexesMaxLevel->value() << std::endl; + std::cout << "myStdWidget->myHexoticSharpAngleThreshold->value(): " << myStdWidget->myHexoticSharpAngleThreshold->value() << std::endl; + +} + +void HexoticPluginGUI_HypothesisCreator::printData( HexoticHypothesisData& data) const +{ + QString valStr; + valStr += tr("Hexotic_MIN_SIZE") + " = " + QString::number( data.myMinSize ) + "; "; + valStr += tr("Hexotic_MAX_SIZE") + " = " + QString::number( data.myMaxSize ) + "; "; + valStr += tr("Hexotic_HEXES_MIN_LEVEL") + " = " + QString::number( data.myHexesMinLevel ) + "; "; + valStr += tr("Hexotic_HEXES_MAX_LEVEL") + " = " + QString::number( data.myHexesMaxLevel ) + "; "; + valStr += tr("Hexotic_IGNORE_RIDGES") + " = " + QString::number( data.myHexoticIgnoreRidges ) + "; "; + valStr += tr("Hexotic_INVALID_ELEMENTS") + " = " + QString::number( data.myHexoticInvalidElements ) + "; "; + valStr += tr("Hexotic_SHARP_ANGLE_THRESHOLD") + " = " + QString::number( data.myHexoticSharpAngleThreshold ) + "; "; + valStr += tr("Hexotic_NB_PROC") + " = " + QString::number( data.myHexoticNbProc ) + "; "; + valStr += tr("Hexotic_WORKING_DIR") + " = " + data.myHexoticWorkingDir + "; "; + valStr += tr("Hexotic_VERBOSITY") + " = " + QString::number( data.myHexoticVerbosity ) + "; "; + valStr += tr("Hexotic_SD_MODE") + " = " + QString::number( data.myHexoticSdMode ) + "; "; + + std::cout << "Data: " << valStr.toStdString() << std::endl; } QString HexoticPluginGUI_HypothesisCreator::storeParams() const @@ -179,14 +215,19 @@ QString HexoticPluginGUI_HypothesisCreator::storeParams() const storeParamsToHypo( data ); QString valStr; - valStr += tr("Hexotic_SEG_MIN_SIZE") + " = " + QString::number( data.myHexesMinLevel ) + "; "; - valStr += tr("Hexotic_SEG_MAX_SIZE") + " = " + QString::number( data.myHexesMaxLevel ) + "; "; - valStr += tr("Hexotic_QUADRANGLES") + " = " + QString::number( data.myHexoticQuadrangles ) + "; "; + valStr += tr("Hexotic_MIN_SIZE") + " = " + QString::number( data.myMinSize ) + "; "; + valStr += tr("Hexotic_MAX_SIZE") + " = " + QString::number( data.myMaxSize ) + "; "; + valStr += tr("Hexotic_HEXES_MIN_LEVEL") + " = " + QString::number( data.myHexesMinLevel ) + "; "; + valStr += tr("Hexotic_HEXES_MAX_LEVEL") + " = " + QString::number( data.myHexesMaxLevel ) + "; "; valStr += tr("Hexotic_IGNORE_RIDGES") + " = " + QString::number( data.myHexoticIgnoreRidges ) + "; "; valStr += tr("Hexotic_INVALID_ELEMENTS") + " = " + QString::number( data.myHexoticInvalidElements ) + "; "; valStr += tr("Hexotic_SHARP_ANGLE_THRESHOLD") + " = " + QString::number( data.myHexoticSharpAngleThreshold ) + "; "; valStr += tr("Hexotic_NB_PROC") + " = " + QString::number( data.myHexoticNbProc ) + "; "; valStr += tr("Hexotic_WORKING_DIR") + " = " + data.myHexoticWorkingDir + "; "; + valStr += tr("Hexotic_VERBOSITY") + " = " + QString::number( data.myHexoticVerbosity) + "; "; + valStr += tr("Hexotic_SD_MODE") + " = " + QString::number( data.myHexoticSdMode) + "; "; + +// std::cout << "Data: " << valStr.toStdString() << std::endl; return valStr; } @@ -198,14 +239,17 @@ bool HexoticPluginGUI_HypothesisCreator::readParamsFromHypo( HexoticHypothesisDa HypothesisData* data = SMESH::GetHypothesisData( hypType() ); h_data.myName = isCreation() && data ? data->Label : ""; + h_data.myMinSize = h->GetMinSize(); + h_data.myMaxSize = h->GetMaxSize(); h_data.myHexesMinLevel = h->GetHexesMinLevel(); h_data.myHexesMaxLevel = h->GetHexesMaxLevel(); - h_data.myHexoticQuadrangles = h->GetHexoticQuadrangles(); h_data.myHexoticIgnoreRidges = h->GetHexoticIgnoreRidges(); h_data.myHexoticInvalidElements = h->GetHexoticInvalidElements(); h_data.myHexoticSharpAngleThreshold = h->GetHexoticSharpAngleThreshold(); h_data.myHexoticNbProc = h->GetHexoticNbProc(); h_data.myHexoticWorkingDir = h->GetHexoticWorkingDirectory(); + h_data.myHexoticVerbosity = h->GetHexoticVerbosity(); + h_data.myHexoticSdMode = h->GetHexoticSdMode()-1; return true; } @@ -216,19 +260,23 @@ bool HexoticPluginGUI_HypothesisCreator::storeParamsToHypo( const HexoticHypothe HexoticPlugin::HexoticPlugin_Hypothesis::_narrow( hypothesis() ); bool ok = true; + try { if( isCreation() ) SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().constData() ); + h->SetMinSize( h_data.myMinSize ); + h->SetMaxSize( h_data.myMaxSize ); h->SetHexesMinLevel( h_data.myHexesMinLevel ); h->SetHexesMaxLevel( h_data.myHexesMaxLevel ); - h->SetHexoticQuadrangles( h_data.myHexoticQuadrangles ); h->SetHexoticIgnoreRidges( h_data.myHexoticIgnoreRidges ); h->SetHexoticInvalidElements( h_data.myHexoticInvalidElements ); h->SetHexoticSharpAngleThreshold( h_data.myHexoticSharpAngleThreshold ); h->SetHexoticNbProc( h_data.myHexoticNbProc ); h->SetHexoticWorkingDirectory( h_data.myHexoticWorkingDir.toLatin1().constData() ); + h->SetHexoticVerbosity( h_data.myHexoticVerbosity ); + h->SetHexoticSdMode( h_data.myHexoticSdMode+1 ); } catch(const SALOME::SALOME_Exception& ex) { @@ -240,15 +288,23 @@ bool HexoticPluginGUI_HypothesisCreator::storeParamsToHypo( const HexoticHypothe bool HexoticPluginGUI_HypothesisCreator::readParamsFromWidgets( HexoticHypothesisData& h_data ) const { - h_data.myName = myName ? myName->text() : ""; - h_data.myHexesMinLevel = myHexesMinLevel->value(); - h_data.myHexesMaxLevel = myHexesMaxLevel->value(); - h_data.myHexoticQuadrangles = myHexoticQuadrangles->isChecked(); - h_data.myHexoticIgnoreRidges = myHexoticIgnoreRidges->isChecked(); - h_data.myHexoticInvalidElements = myHexoticInvalidElements->isChecked(); - h_data.myHexoticSharpAngleThreshold = myHexoticSharpAngleThreshold->value(); - h_data.myHexoticNbProc = myHexoticNbProc->value(); - h_data.myHexoticWorkingDir = myHexoticWorkingDir->text(); + h_data.myName = myName ? myName->text() : ""; + + h_data.myHexoticIgnoreRidges = myStdWidget->myHexoticIgnoreRidges->isChecked(); + h_data.myHexoticInvalidElements = myStdWidget->myHexoticInvalidElements->isChecked(); + + h_data.myHexoticNbProc = myStdWidget->myHexoticNbProc->value(); + h_data.myHexoticWorkingDir = myStdWidget->myHexoticWorkingDir->text(); + h_data.myHexoticVerbosity = myStdWidget->myHexoticVerbosity->value(); + h_data.myHexoticSdMode = myStdWidget->myHexoticSdMode->currentIndex(); + + h_data.myMinSize = myStdWidget->myMinSize->text().isEmpty() ? 0.0 : myStdWidget->myMinSize->value(); + h_data.myMaxSize = myStdWidget->myMaxSize->text().isEmpty() ? 0.0 : myStdWidget->myMaxSize->value(); + h_data.myHexesMinLevel = myStdWidget->myHexesMinLevel->text().isEmpty() ? 0 : myStdWidget->myHexesMinLevel->value(); + h_data.myHexesMaxLevel = myStdWidget->myHexesMaxLevel->text().isEmpty() ? 0 : myStdWidget->myHexesMaxLevel->value(); + h_data.myHexoticSharpAngleThreshold = myStdWidget->myHexoticSharpAngleThreshold->text().isEmpty() ? 0 : myStdWidget->myHexoticSharpAngleThreshold->value(); + + printData(h_data); return true; } @@ -273,10 +329,3 @@ QString HexoticPluginGUI_HypothesisCreator::helpPage() const { return "hexotic_hypo_page.html"; } - -void HexoticPluginGUI_HypothesisCreator::onDirBtnClicked() -{ - QString dir = SUIT_FileDlg::getExistingDirectory( dlg(), myHexoticWorkingDir->text(), QString() ); - if ( !dir.isEmpty() ) - myHexoticWorkingDir->setText( dir ); -} diff --git a/src/GUI/HexoticPluginGUI_HypothesisCreator.h b/src/GUI/HexoticPluginGUI_HypothesisCreator.h index 21cdcd4..7757e93 100644 --- a/src/GUI/HexoticPluginGUI_HypothesisCreator.h +++ b/src/GUI/HexoticPluginGUI_HypothesisCreator.h @@ -33,16 +33,20 @@ class QtxIntSpinBox; class QCheckBox; class QLineEdit; +class HexoticPluginGUI_StdWidget; + typedef struct { QString myName; int myHexesMinLevel, myHexesMaxLevel; - bool myHexoticQuadrangles; + double myMinSize, myMaxSize; bool myHexoticInvalidElements; bool myHexoticIgnoreRidges; - int myHexoticSharpAngleThreshold; + double myHexoticSharpAngleThreshold; int myHexoticNbProc; QString myHexoticWorkingDir; + int myHexoticVerbosity; + int myHexoticSdMode; } HexoticHypothesisData; /*! @@ -56,7 +60,7 @@ public: HexoticPluginGUI_HypothesisCreator( const QString& ); virtual ~HexoticPluginGUI_HypothesisCreator(); - virtual bool checkParams() const; + virtual bool checkParams(QString&) const; virtual QString helpPage() const; protected: @@ -68,24 +72,18 @@ protected: virtual QPixmap icon() const; virtual QString type() const; -protected slots: - void onDirBtnClicked(); - private: bool readParamsFromHypo( HexoticHypothesisData& ) const; bool readParamsFromWidgets( HexoticHypothesisData& ) const; bool storeParamsToHypo( const HexoticHypothesisData& ) const; + void resizeEvent(QResizeEvent *event); + void printData(HexoticHypothesisData&) const; private: - QLineEdit* myName; - QtxIntSpinBox* myHexesMinLevel; - QtxIntSpinBox* myHexesMaxLevel; - QCheckBox* myHexoticQuadrangles; - QCheckBox* myHexoticIgnoreRidges; - QCheckBox* myHexoticInvalidElements; - QtxIntSpinBox* myHexoticSharpAngleThreshold; - QtxIntSpinBox* myHexoticNbProc; - QLineEdit* myHexoticWorkingDir; + +// QWidget* myStdGroup; + QLineEdit* myName; + HexoticPluginGUI_StdWidget* myStdWidget; bool myIs3D; }; diff --git a/src/GUI/HexoticPluginGUI_StdWidget.cxx b/src/GUI/HexoticPluginGUI_StdWidget.cxx new file mode 100644 index 0000000..45ee0cc --- /dev/null +++ b/src/GUI/HexoticPluginGUI_StdWidget.cxx @@ -0,0 +1,95 @@ +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// --- +// File : BLSURFPluginGUI_StdWidget.cxx +// Authors : Gilles DAVID (OCC) +// --- +// + +#include "HexoticPluginGUI_Dlg.h" + +#include +#include +#include +#include + +//using namespace std; + +////////////////////////////////////////// +// HexoticPluginGUI_StdWidget +////////////////////////////////////////// + +HexoticPluginGUI_StdWidget::HexoticPluginGUI_StdWidget( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); + + // Obtain precision from preferences + int precision = SUIT_Session::session()->resourceMgr()->integerValue( "SMESH", "length_precision", -3 ); + + myMinSize->setMinimum(0); + myMinSize->setMaximum(1e15); + myMinSize->setPrecision(precision); +// myMinSize->setSpecialValueText(" "); + + myMaxSize->setMinimum(0); + myMaxSize->setMaximum(1e15); + myMaxSize->setPrecision(precision); +// myMaxSize->setSpecialValueText(" "); + + myHexesMinLevel->setMinimum(0); + myHexesMinLevel->setMaximum(10); +// myHexesMinLevel->setSpecialValueText(" "); + + myHexesMaxLevel->setMinimum(0); + myHexesMaxLevel->setMaximum(10); +// myHexesMaxLevel->setSpecialValueText(" "); + + myHexoticSharpAngleThreshold->setMinimum(0); + myHexoticSharpAngleThreshold->setMaximum(90); + myHexoticSharpAngleThreshold->setPrecision(precision); +// myHexoticSharpAngleThreshold->setSpecialValueText(" "); + + myHexoticNbProc->setMinimum( 1 ); + myHexoticNbProc->setMaximum( 256 ); +// myHexoticNbProc->setSingleStep( 1 ); + + myHexoticSdMode->setCurrentIndex(SD_MODE_4); + + imageSdMode = SUIT_Session::session()->resourceMgr()->loadPixmap("HexoticPLUGIN", tr("Hexotic_SD_MODE_4_PIXMAP")); +} + +HexoticPluginGUI_StdWidget::~HexoticPluginGUI_StdWidget() +{ +} + +void HexoticPluginGUI_StdWidget::onDirBtnClicked() +{ + QString dir = SUIT_FileDlg::getExistingDirectory( this, myHexoticWorkingDir->text(), QString() ); + if ( !dir.isEmpty() ) + myHexoticWorkingDir->setText( dir ); +} + +void HexoticPluginGUI_StdWidget::onSdModeSelected(int sdMode) { + imageSdMode = SUIT_Session::session()->resourceMgr()->loadPixmap("HexoticPLUGIN", tr(QString("Hexotic_SD_MODE_%1_PIXMAP").arg(sdMode+1).toStdString().c_str())); + sdModeLabel->setPixmap(imageSdMode.scaled(sdModeLabel->size(), + Qt::KeepAspectRatio, + Qt::SmoothTransformation)); +} diff --git a/src/GUI/HexoticPluginGUI_StdWidget_QTD.ui b/src/GUI/HexoticPluginGUI_StdWidget_QTD.ui new file mode 100644 index 0000000..c708c4e --- /dev/null +++ b/src/GUI/HexoticPluginGUI_StdWidget_QTD.ui @@ -0,0 +1,264 @@ + + + HexoticPluginGUI_StdWidget_QTD + + + + 0 + + + + + Hexotic_INPUT_SIZE + + + + + + Hexotic_MIN_SIZE + + + + + + + + + + Hexotic_MAX_SIZE + + + + + + + + + + + + + Hexotic_INPUT_LEVEL + + + + + + Hexotic_HEXES_MIN_LEVEL + + + + + + + + + + Hexotic_HEXES_MAX_LEVEL + + + + + + + + + + + + + Hexotic_IGNORE_RIDGES + + + + + + + Hexotic_SHARP_ANGLE_THRESHOLD + + + + + + + + + + Hexotic_NB_PROC + + + + + + + + + + Hexotic_WORKING_DIR + + + + + + + + 0 + 0 + + + + Hexotic_SELECT_DIR + + + + + + + + + + Hexotic_VERBOSITY + + + + + + + 2 + + + 1 + + + + + + + Hexotic_SUBDOMAIN_MESH_MODE + + + + + + 3 + + + 4 + + + + Hexotic_SD_MODE_1 + + + + + Hexotic_SD_MODE_2 + + + + + Hexotic_SD_MODE_3 + + + + + Hexotic_SD_MODE_4 + + + + + + + + + 500 + 250 + + + + + 500 + 250 + + + + + + + true + + + + + + + + + + Hexotic_INVALID_ELEMENTS + + + + + + + + SalomeApp_DoubleSpinBox + QLineEdit +
    SalomeApp_DoubleSpinBox.h
    +
    + + SalomeApp_IntSpinBox + QLineEdit +
    SalomeApp_IntSpinBox.h
    +
    +
    + + myHexoticIgnoreRidges + myHexoticSharpAngleThreshold + myHexoticNbProc + dirBtn + myHexoticWorkingDir + myHexoticVerbosity + myHexoticSdMode + + + + + dirBtn + clicked() + HexoticPluginGUI_StdWidget_QTD + onDirBtnClicked() + + + 261 + 220 + + + 390 + 143 + + + + + myHexoticSdMode + currentIndexChanged(int) + HexoticPluginGUI_StdWidget_QTD + onSdModeSelected(int) + + + 147 + 310 + + + 170 + 258 + + + + + + onDirBtnClicked() + onSdModeSelected(int) + +
    diff --git a/src/GUI/Makefile.am b/src/GUI/Makefile.am index 2aba130..2fb5bc0 100644 --- a/src/GUI/Makefile.am +++ b/src/GUI/Makefile.am @@ -25,20 +25,28 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files -salomeinclude_HEADERS = +salomeinclude_HEADERS = \ + HexoticPluginGUI.h \ + HexoticPluginGUI_Dlg.h \ + HexoticPluginGUI_HypothesisCreator.h # Libraries targets lib_LTLIBRARIES = libHexoticPluginGUI.la dist_libHexoticPluginGUI_la_SOURCES = \ HexoticPluginGUI.cxx \ - HexoticPluginGUI.h \ - HexoticPluginGUI_HypothesisCreator.h \ - HexoticPluginGUI_HypothesisCreator.cxx + HexoticPluginGUI_StdWidget.cxx \ + HexoticPluginGUI_HypothesisCreator.cxx MOC_FILES = \ - HexoticPluginGUI_HypothesisCreator_moc.cxx + HexoticPluginGUI_HypothesisCreator_moc.cxx \ + HexoticPluginGUI_Dlg_moc.cxx +UIC_FILES = \ + ui_HexoticPluginGUI_StdWidget_QTD.h + +BUILT_SOURCES = $(UIC_FILES) + nodist_libHexoticPluginGUI_la_SOURCES = \ $(MOC_FILES) @@ -71,3 +79,7 @@ nodist_salomeres_DATA = \ HexoticPLUGIN_images.qm \ HexoticPLUGIN_msg_en.qm \ HexoticPLUGIN_msg_fr.qm + +SUBDIRS = resources + +DIST_SUBDIRS = resources diff --git a/src/GUI/resources/Makefile.am b/src/GUI/resources/Makefile.am new file mode 100644 index 0000000..cb2a469 --- /dev/null +++ b/src/GUI/resources/Makefile.am @@ -0,0 +1,34 @@ +# Copyright (C) 2007-2012 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# --- +# File : Makefile.am +# Author : Gilles DAVID, EDF (gilles-g.david@edf.fr) +# --- +# +include $(top_srcdir)/adm_local/unix/make_common_starter.am + +if HEXOTICPLUGIN_ENABLE_GUI + dist_salomeres_DATA = \ + sd_mode_geom.png \ + sd_mode_1.png \ + sd_mode_2.png \ + sd_mode_3.png \ + sd_mode_4.png +endif diff --git a/src/GUI/resources/sd_mode_1.png b/src/GUI/resources/sd_mode_1.png new file mode 100644 index 0000000..d0cb509 Binary files /dev/null and b/src/GUI/resources/sd_mode_1.png differ diff --git a/src/GUI/resources/sd_mode_2.png b/src/GUI/resources/sd_mode_2.png new file mode 100644 index 0000000..4d76549 Binary files /dev/null and b/src/GUI/resources/sd_mode_2.png differ diff --git a/src/GUI/resources/sd_mode_3.png b/src/GUI/resources/sd_mode_3.png new file mode 100644 index 0000000..97d5fb7 Binary files /dev/null and b/src/GUI/resources/sd_mode_3.png differ diff --git a/src/GUI/resources/sd_mode_4.png b/src/GUI/resources/sd_mode_4.png new file mode 100644 index 0000000..ccc5940 Binary files /dev/null and b/src/GUI/resources/sd_mode_4.png differ diff --git a/src/GUI/resources/sd_mode_geom.png b/src/GUI/resources/sd_mode_geom.png new file mode 100644 index 0000000..9a5748b Binary files /dev/null and b/src/GUI/resources/sd_mode_geom.png differ diff --git a/src/HexoticPlugin/HexoticPLUGINDC.py b/src/HexoticPlugin/HexoticPLUGINDC.py index 92bdd68..948e294 100644 --- a/src/HexoticPlugin/HexoticPLUGINDC.py +++ b/src/HexoticPlugin/HexoticPLUGINDC.py @@ -17,7 +17,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from smesh import Mesh_Algorithm, AssureGeomPublished +## +# @package HexoticPLUGINDC +# Python API for the Hexotic meshing plug-in module. + +from smesh_algorithm import Mesh_Algorithm +from smesh import AssureGeomPublished # import HexoticPlugin module if possible noHexoticPlugin = 0 @@ -27,28 +32,78 @@ except ImportError: noHexoticPlugin = 1 pass +#---------------------------- +# Mesh algo type identifiers +#---------------------------- + +## Algorithm type: Hexotic hexahedron 3D algorithm, see Hexotic_Algorithm Hexotic = "Hexotic_3D" +#---------------------------- +# Algorithms +#---------------------------- ## Defines a hexahedron 3D algorithm # +# It is created by calling smesh.Mesh.Hexahedron( smesh.Hexotic, geom=0 ) class Hexotic_Algorithm(Mesh_Algorithm): + ## name of the dynamic method in smesh.Mesh class + # @internal meshMethod = "Hexahedron" + ## type of algorithm used with helper function in smesh.Mesh class + # @internal algoType = Hexotic + ## doc string of the method in smesh.Mesh class + # @internal + docHelper = "Creates hexahedron 3D algorithm for volumes" ## Private constructor. + # @param mesh parent mesh object algorithm is assigned to + # @param geom geometry (shape/sub-shape) algorithm is assigned to; + # if it is @c 0 (default), the algorithm is assigned to the main shape def __init__(self, mesh, geom=0): Mesh_Algorithm.__init__(self) if noHexoticPlugin: print "Warning: HexoticPlugin module unavailable" self.Create(mesh, geom, Hexotic, "libHexoticEngine.so") + self.params = None pass - ## Defines "MinMaxQuad" hypothesis to give three hexotic parameters + ## Defines "SetMinMaxHexes" hypothesis to give two hexotic parameters + # @param min minimal level of recursive partitioning on the initial octree cube + # @param max maximal level of recursive partitioning on the initial octree cube + # @return hypothesis object + def SetMinMaxHexes(self, min=3, max=8): + self.Parameters().SetHexesMinLevel(min) + self.Parameters().SetHexesMaxLevel(max) + return self.Parameters() + + ## Defines "SetMinMaxSize" hypothesis to give two hexotic parameters + # @param min minimal element's size + # @param max maximal element's size + # @return hypothesis object + def SetMinMaxSize(self, min, max): + self.Parameters().SetMinSize(min) + self.Parameters().SetMaxSize(max) + return self.Parameters() + + ## (OBSOLETE) Defines "MinMaxQuad" hypothesis to give three hexotic parameters + # @param min minimal level of recursive partitioning on the initial octree cube + # @param max maximal level of recursive partitioning on the initial octree cube + # @param quad not documented + # @return hypothesis object def MinMaxQuad(self, min=3, max=8, quad=True): - self.params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so", - UseExisting=0) - self.params.SetHexesMinLevel(min) - self.params.SetHexesMaxLevel(max) - self.params.SetHexoticQuadrangles(quad) + print "WARNING: Function MinMaxQuad is deprecated, use SetMinMaxHexes instead" + return self.SetMinMaxHexes(min, max) + + ## Defines hypothesis having several parameters + # @return hypothesis object + def Parameters(self): + if not self.params: + self.params = self.Hypothesis("Hexotic_Parameters", [], + "libHexoticEngine.so", UseExisting=0) + pass return self.params + + + pass # end of Hexotic_Algorithm class diff --git a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx index ceba57e..8ee7dba 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hexotic.cxx @@ -45,13 +45,14 @@ #define DUMP(txt) #endif -#include -#include #include +#include #include -#include -#include "SMESH_HypoFilter.hxx" #include +#include +#include +#include +#include #include #include @@ -627,7 +628,8 @@ static bool readResult(std::string theFile, SMESHDS_Mesh* theMesh, const int nbShape, const TopoDS_Shape* tabShape, - double** tabBox) + double** tabBox, + const int sdMode) { // --------------------------------- // Optimisation of the plugin ... @@ -670,6 +672,7 @@ static bool readResult(std::string theFile, TopoDS_Shape *tabCorner, *tabEdge; const int nbDomains = countShape( theMesh, TopAbs_SHELL ); + MESSAGE("Nb domains in the meshed shape: " << nbDomains ); const int holeID = -1; // tabID = new int[nbShape]; @@ -847,7 +850,7 @@ static bool readResult(std::string theFile, else { shapeID = tabID[0]; } - if ( shapeID != holeID ) + if ( (sdMode == 4 && shapeID != holeID) || sdMode != 2 ) aHexoticElement = theMesh->AddVolume( node[0], node[3], node[2], node[1], node[4], node[7], node[6], node[5] ); break; } @@ -910,11 +913,12 @@ static bool readResult(std::string theFile, //purpose : //======================================================================= -static bool readResult(std::string theFile, +static bool readResult(std::string theFile, #ifdef WITH_SMESH_CANCEL_COMPUTE - HexoticPlugin_Hexotic* theAlgo, + HexoticPlugin_Hexotic* theAlgo, #endif - SMESH_MesherHelper* theHelper) + SMESH_MesherHelper* theHelper, + const int sdMode) { SMESHDS_Mesh* theMesh = theHelper->GetMeshDS(); @@ -1078,12 +1082,15 @@ void HexoticPlugin_Hexotic::SetParameters(const HexoticPlugin_Hypothesis* hyp) { if (hyp) { _hexesMinLevel = hyp->GetHexesMinLevel(); _hexesMaxLevel = hyp->GetHexesMaxLevel(); - _hexoticQuadrangles = hyp->GetHexoticQuadrangles(); + _hexesMinSize = hyp->GetMinSize(); + _hexesMaxSize = hyp->GetMaxSize(); _hexoticIgnoreRidges = hyp->GetHexoticIgnoreRidges(); _hexoticInvalidElements = hyp->GetHexoticInvalidElements(); _hexoticSharpAngleThreshold = hyp->GetHexoticSharpAngleThreshold(); _hexoticNbProc = hyp->GetHexoticNbProc(); _hexoticWorkingDirectory = hyp->GetHexoticWorkingDirectory(); + _hexoticVerbosity = hyp->GetHexoticVerbosity(); + _hexoticSdMode = hyp->GetHexoticSdMode(); } else { cout << std::endl; @@ -1091,12 +1098,15 @@ void HexoticPlugin_Hexotic::SetParameters(const HexoticPlugin_Hypothesis* hyp) { cout << "=======" << std::endl; _hexesMinLevel = hyp->GetDefaultHexesMinLevel(); _hexesMaxLevel = hyp->GetDefaultHexesMaxLevel(); - _hexoticQuadrangles = hyp->GetDefaultHexoticQuadrangles(); + _hexesMinSize = hyp->GetDefaultMinSize(); + _hexesMaxSize = hyp->GetDefaultMaxSize(); _hexoticIgnoreRidges = hyp->GetDefaultHexoticIgnoreRidges(); _hexoticInvalidElements = hyp->GetDefaultHexoticInvalidElements(); _hexoticSharpAngleThreshold = hyp->GetDefaultHexoticSharpAngleThreshold(); _hexoticNbProc = hyp->GetDefaultHexoticNbProc(); _hexoticWorkingDirectory = hyp->GetDefaultHexoticWorkingDirectory(); + _hexoticVerbosity = hyp->GetDefaultHexoticVerbosity(); + _hexoticSdMode = hyp->GetDefaultHexoticSdMode(); } } @@ -1140,30 +1150,37 @@ std::string HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiStri cout << std::endl; cout << "Hexotic execution..." << std::endl; cout << _name << " parameters :" << std::endl; + cout << " " << _name << " Verbosity = " << _hexoticVerbosity << std::endl; cout << " " << _name << " Segments Min Level = " << _hexesMinLevel << std::endl; cout << " " << _name << " Segments Max Level = " << _hexesMaxLevel << std::endl; - cout << " " << "Salome Quadrangles : " << (_hexoticQuadrangles ? "yes":"no") << std::endl; + cout << " " << _name << " Segments Min Size = " << _hexesMinSize << std::endl; + cout << " " << _name << " Segments Max Size = " << _hexesMaxSize << std::endl; cout << " " << "Hexotic can ignore ridges : " << (_hexoticIgnoreRidges ? "yes":"no") << std::endl; cout << " " << "Hexotic authorize invalide elements : " << ( _hexoticInvalidElements ? "yes":"no") << std::endl; cout << " " << _name << " Sharp angle threshold = " << _hexoticSharpAngleThreshold << " degrees" << std::endl; cout << " " << _name << " Number of threads = " << _hexoticNbProc << std::endl; cout << " " << _name << " Working directory = \"" << _hexoticWorkingDirectory << "\"" << std::endl; + cout << " " << _name << " Sub. Dom mode = " << _hexoticSdMode << std::endl; TCollection_AsciiString run_Hexotic( "hexotic" ); TCollection_AsciiString minl = " -minl ", maxl = " -maxl ", angle = " -ra "; + TCollection_AsciiString mins = " -mins ", maxs = " -maxs "; TCollection_AsciiString in = " -in ", out = " -out "; TCollection_AsciiString ignoreRidges = " -nr ", invalideElements = " -inv "; TCollection_AsciiString subdom = " -sd ", sharp = " -sharp "; TCollection_AsciiString proc = " -nproc "; + TCollection_AsciiString verb = " -v "; - TCollection_AsciiString minLevel, maxLevel, sharpAngle, mode, subdivision, nbproc; + TCollection_AsciiString minLevel, maxLevel, minSize, maxSize, sharpAngle, mode, nbproc, verbosity; minLevel = _hexesMinLevel; maxLevel = _hexesMaxLevel; + minSize = _hexesMinSize; + maxSize = _hexesMaxSize; sharpAngle = _hexoticSharpAngleThreshold; - mode = 4; - subdivision = 3; + mode = _hexoticSdMode; nbproc = _hexoticNbProc; + verbosity = _hexoticVerbosity; if (_hexoticIgnoreRidges) run_Hexotic += ignoreRidges; @@ -1171,12 +1188,25 @@ std::string HexoticPlugin_Hexotic::getHexoticCommand(const TCollection_AsciiStri if (_hexoticInvalidElements) run_Hexotic += invalideElements; - run_Hexotic += angle + sharpAngle + minl + minLevel + maxl + maxLevel + in + Hexotic_In + out + Hexotic_Out; + if (_hexesMinSize > 0) + run_Hexotic += mins + minSize; + + if (_hexesMaxSize > 0) + run_Hexotic += maxs + maxSize; + + if (_hexesMinLevel > 0) + run_Hexotic += minl + minLevel; + + if (_hexesMaxLevel > 0) + run_Hexotic += maxl + maxLevel; + + if (_hexoticSharpAngleThreshold > 0) + run_Hexotic += angle + sharpAngle; + + run_Hexotic += in + Hexotic_In + out + Hexotic_Out; run_Hexotic += subdom + mode; run_Hexotic += proc + nbproc; - // run_Hexotic += subdom + mode + invalideElements; - // run_Hexotic += subdom + mode + ignoreRidges; - // run_Hexotic += subdom + mode + sharp + subdivision; + run_Hexotic += verb + verbosity; return run_Hexotic.ToCString(); } @@ -1289,7 +1319,7 @@ bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh& theMesh, std::string run_Hexotic = getHexoticCommand(Hexotic_In, Hexotic_Out); - run_Hexotic += std::string(" 1>") + aLogFileName.ToCString(); // dump into file + run_Hexotic += std::string(" 1 > ") + aLogFileName.ToCString(); // dump into file cout << std::endl; cout << "Hexotic command : " << run_Hexotic << std::endl; @@ -1323,7 +1353,7 @@ bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh& theMesh, #ifdef WITH_SMESH_CANCEL_COMPUTE this, #endif - meshDS, _nbShape, tabShape, tabBox ); + meshDS, _nbShape, tabShape, tabBox, _hexoticSdMode ); if(Ok) hexahedraMessage = "success"; else @@ -1393,7 +1423,7 @@ bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHel Hexotic_Out = aTmpDir + "Hexotic_Out.mesh"; std::string run_Hexotic = getHexoticCommand(Hexotic_In, Hexotic_Out); - run_Hexotic += std::string(" 1>") + aLogFileName.ToCString(); // dump into file + run_Hexotic += std::string(" 1 > ") + aLogFileName.ToCString(); // dump into file cout << std::endl; cout << "Hexotic command : " << run_Hexotic << std::endl; @@ -1426,7 +1456,7 @@ bool HexoticPlugin_Hexotic::Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHel #ifdef WITH_SMESH_CANCEL_COMPUTE this, #endif - aHelper ); + aHelper, _hexoticSdMode ); if(Ok) hexahedraMessage = "success"; else diff --git a/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx b/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx index 893c0e0..dae3a5b 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx +++ b/src/HexoticPlugin/HexoticPlugin_Hexotic.hxx @@ -27,7 +27,7 @@ #include "HexoticPlugin_Defs.hxx" -#include "SMESH_3D_Algo.hxx" +#include "SMESH_Algo.hxx" #include "SMESH_Mesh.hxx" #include "Utils_SALOME_Exception.hxx" @@ -82,13 +82,16 @@ private: int _nbShape; int _hexesMinLevel; int _hexesMaxLevel; - bool _hexoticQuadrangles; + double _hexesMinSize; + double _hexesMaxSize; bool _hexoticIgnoreRidges; bool _hexoticInvalidElements; bool _hexoticFilesKept; int _hexoticSharpAngleThreshold; int _hexoticNbProc; std::string _hexoticWorkingDirectory; + int _hexoticVerbosity; + int _hexoticSdMode; SMDS_MeshNode** _tabNode; #ifdef WITH_BLSURFPLUGIN diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx index 8f8c83d..29a828b 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis.cxx @@ -37,12 +37,15 @@ HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis (int hypId, int studyId, : SMESH_Hypothesis(hypId, studyId, gen), _hexesMinLevel( GetDefaultHexesMinLevel() ), _hexesMaxLevel( GetDefaultHexesMaxLevel() ), - _hexoticQuadrangles( GetDefaultHexoticQuadrangles() ), + _minSize( GetDefaultMinSize() ), + _maxSize( GetDefaultMaxSize() ), _hexoticIgnoreRidges( GetDefaultHexoticIgnoreRidges() ), _hexoticInvalidElements( GetDefaultHexoticInvalidElements() ), _hexoticSharpAngleThreshold( GetDefaultHexoticSharpAngleThreshold() ), _hexoticNbProc( GetDefaultHexoticNbProc() ), - _hexoticWorkingDirectory( GetDefaultHexoticWorkingDirectory() ) + _hexoticWorkingDirectory( GetDefaultHexoticWorkingDirectory() ), + _hexoticSdMode(GetDefaultHexoticSdMode()), + _hexoticVerbosity(GetDefaultHexoticVerbosity()) { MESSAGE("HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis"); _name = "Hexotic_Parameters"; @@ -69,9 +72,16 @@ void HexoticPlugin_Hypothesis::SetHexesMaxLevel(int theVal) { } } -void HexoticPlugin_Hypothesis::SetHexoticQuadrangles(bool theVal) { - if (theVal != _hexoticQuadrangles) { - _hexoticQuadrangles = theVal; +void HexoticPlugin_Hypothesis::SetMinSize(double theVal) { + if (theVal != _minSize) { + _minSize = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +void HexoticPlugin_Hypothesis::SetMaxSize(double theVal) { + if (theVal != _maxSize) { + _maxSize = theVal; NotifySubMeshesHypothesisModification(); } } @@ -90,7 +100,7 @@ void HexoticPlugin_Hypothesis::SetHexoticInvalidElements(bool theVal) { } } -void HexoticPlugin_Hypothesis::SetHexoticSharpAngleThreshold(int theVal) { +void HexoticPlugin_Hypothesis::SetHexoticSharpAngleThreshold(double theVal) { if (theVal != _hexoticSharpAngleThreshold) { _hexoticSharpAngleThreshold = theVal; NotifySubMeshesHypothesisModification(); @@ -112,6 +122,20 @@ void HexoticPlugin_Hypothesis::SetHexoticWorkingDirectory(const std::string& pat } } +void HexoticPlugin_Hypothesis::SetHexoticSdMode(int theVal) { + if (theVal != _hexoticSdMode) { + _hexoticSdMode = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +void HexoticPlugin_Hypothesis::SetHexoticVerbosity(int theVal) { + if (theVal != _hexoticVerbosity) { + _hexoticVerbosity = theVal; + NotifySubMeshesHypothesisModification(); + } +} + //============================================================================= /*! * @@ -119,25 +143,20 @@ void HexoticPlugin_Hypothesis::SetHexoticWorkingDirectory(const std::string& pat //============================================================================= std::ostream& HexoticPlugin_Hypothesis::SaveTo(std::ostream& save) { - /*save << _hexesMinLevel << " " << _hexesMaxLevel; - save << " " << (int)_hexoticQuadrangles; - save << " " << (int)_hexoticIgnoreRidges; - save << " " << (int)_hexoticInvalidElements; - save << " " << _hexoticSharpAngleThreshold; - std::cout <GetImpl()->SetHexesMinLevel(theValue); - SMESH::TPythonDump() << _this() << ".SetHexesMinLevel( " << theValue << " )"; + if (theValue != oldValue) + SMESH::TPythonDump() << _this() << ".SetHexesMinLevel( " << theValue << " )"; } void HexoticPlugin_Hypothesis_i::SetHexesMaxLevel (CORBA::Long theValue) { // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel"); ASSERT(myBaseImpl); + CORBA::Long oldValue = GetHexesMaxLevel(); this->GetImpl()->SetHexesMaxLevel(theValue); - SMESH::TPythonDump() << _this() << ".SetHexesMaxLevel( " << theValue << " )"; + if (theValue != oldValue) + SMESH::TPythonDump() << _this() << ".SetHexesMaxLevel( " << theValue << " )"; } -void HexoticPlugin_Hypothesis_i::SetHexoticQuadrangles (CORBA::Boolean theValue) +void HexoticPlugin_Hypothesis_i::SetMinSize (CORBA::Double theValue) { - // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticQuadrangles"); + // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel"); + ASSERT(myBaseImpl); + CORBA::Double oldValue = GetMinSize(); + this->GetImpl()->SetMinSize(theValue); + if (theValue != oldValue) + SMESH::TPythonDump() << _this() << ".SetMinSize( " << theValue << " )"; +} + +void HexoticPlugin_Hypothesis_i::SetMaxSize (CORBA::Double theValue) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel"); ASSERT(myBaseImpl); - this->GetImpl()->SetHexoticQuadrangles(theValue); - SMESH::TPythonDump() << _this() << ".SetHexoticQuadrangles( " << theValue << " )"; + CORBA::Double oldValue = GetMaxSize(); + this->GetImpl()->SetMaxSize(theValue); + if (theValue != oldValue) + SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theValue << " )"; } void HexoticPlugin_Hypothesis_i::SetHexoticIgnoreRidges (CORBA::Boolean theValue) { // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticIgnoreRidges"); ASSERT(myBaseImpl); + CORBA::Boolean oldValue = GetHexoticIgnoreRidges(); this->GetImpl()->SetHexoticIgnoreRidges(theValue); - SMESH::TPythonDump() << _this() << ".SetHexoticIgnoreRidges( " << theValue << " )"; + if (theValue != oldValue) + SMESH::TPythonDump() << _this() << ".SetHexoticIgnoreRidges( " << theValue << " )"; } void HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements (CORBA::Boolean theValue) { // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements"); ASSERT(myBaseImpl); + CORBA::Boolean oldValue = GetHexoticInvalidElements(); this->GetImpl()->SetHexoticInvalidElements(theValue); - SMESH::TPythonDump() << _this() << ".SetHexoticInvalidElements( " << theValue << " )"; + if (theValue != oldValue) + SMESH::TPythonDump() << _this() << ".SetHexoticInvalidElements( " << theValue << " )"; } -void HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold (CORBA::Long theValue) +void HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold (CORBA::Double theValue) { // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold"); ASSERT(myBaseImpl); + CORBA::Double oldValue = GetHexoticSharpAngleThreshold(); this->GetImpl()->SetHexoticSharpAngleThreshold(theValue); - SMESH::TPythonDump() << _this() << ".SetHexoticSharpAngleThreshold( " << theValue << " )"; + if (theValue != oldValue) + SMESH::TPythonDump() << _this() << ".SetHexoticSharpAngleThreshold( " << theValue << " )"; } void HexoticPlugin_Hypothesis_i::SetHexoticNbProc (CORBA::Long theValue) { // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticNbProc"); ASSERT(myBaseImpl); + CORBA::Long oldValue = GetHexoticNbProc(); this->GetImpl()->SetHexoticNbProc(theValue); - SMESH::TPythonDump() << _this() << ".SetHexoticNbProc( " << theValue << " )"; + if (theValue != oldValue) + SMESH::TPythonDump() << _this() << ".SetHexoticNbProc( " << theValue << " )"; } void HexoticPlugin_Hypothesis_i::SetHexoticWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception ) @@ -136,7 +163,13 @@ void HexoticPlugin_Hypothesis_i::SetHexoticWorkingDirectory(const char* path) th if (!path ) THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM ); + ASSERT(myBaseImpl); string file(path); + string oldValue(GetHexoticWorkingDirectory()); + bool doDump = false; + if (oldValue != file) + doDump = true; + const char lastChar = *file.rbegin(); #ifdef WIN32 if ( lastChar != '\\' ) file += '\\'; @@ -146,21 +179,44 @@ void HexoticPlugin_Hypothesis_i::SetHexoticWorkingDirectory(const char* path) th file += "Hexotic_In.mesh"; SMESH_Mesh_i::PrepareForWriting (file.c_str()); - ASSERT(myBaseImpl); this->GetImpl()->SetHexoticWorkingDirectory(path); - SMESH::TPythonDump() << _this() << ".SetHexoticWorkingDirectory( '" << path << "' )"; + if (doDump) + SMESH::TPythonDump() << _this() << ".SetHexoticWorkingDirectory( '" << path << "' )"; +} + +void HexoticPlugin_Hypothesis_i::SetHexoticSdMode (CORBA::Long theValue) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticSdMode"); + ASSERT(myBaseImpl); + CORBA::Long oldValue = GetHexoticSdMode(); + this->GetImpl()->SetHexoticSdMode(theValue); + if (theValue != oldValue) + SMESH::TPythonDump() << _this() << ".SetHexoticSdMode( " << theValue << " )"; +} + +void HexoticPlugin_Hypothesis_i::SetHexoticVerbosity (CORBA::Long theValue) +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::SetVerbosity"); + ASSERT(myBaseImpl); + CORBA::Long oldValue = GetHexoticVerbosity(); + this->GetImpl()->SetHexoticVerbosity(theValue); + if (theValue != oldValue) + SMESH::TPythonDump() << _this() << ".SetHexoticVerbosity( " << theValue << " )"; } //============================================================================= /*! * HexoticPlugin_Hypothesis_i::GetHexesMinLevel * HexoticPlugin_Hypothesis_i::GetHexesMaxLevel - * HexoticPlugin_Hypothesis_i::GetHexoticQuadrangles + * HexoticPlugin_Hypothesis_i::GetMinSize + * HexoticPlugin_Hypothesis_i::GetMaxSize * HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges * HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements * HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold * HexoticPlugin_Hypothesis_i::GetHexoticNbProc * HexoticPlugin_Hypothesis_i::GetHexoticWorkingDirectory + * HexoticPlugin_Hypothesis_i::GetHexoticSdMode + * HexoticPlugin_Hypothesis_i::GetVerbosity */ //============================================================================= @@ -178,11 +234,18 @@ CORBA::Long HexoticPlugin_Hypothesis_i::GetHexesMaxLevel() return this->GetImpl()->GetHexesMaxLevel(); } -CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticQuadrangles() +CORBA::Double HexoticPlugin_Hypothesis_i::GetMinSize() { - // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticQuadrangles"); + // MESSAGE("HexoticPlugin_Hypothesis_i::GetMinSize"); ASSERT(myBaseImpl); - return this->GetImpl()->GetHexoticQuadrangles(); + return this->GetImpl()->GetMinSize(); +} + +CORBA::Double HexoticPlugin_Hypothesis_i::GetMaxSize() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetMaxSize"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetMaxSize(); } CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges() @@ -199,7 +262,7 @@ CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements() return this->GetImpl()->GetHexoticInvalidElements(); } -CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold() +CORBA::Double HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold() { // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold"); ASSERT(myBaseImpl); @@ -219,6 +282,20 @@ char* HexoticPlugin_Hypothesis_i::GetHexoticWorkingDirectory() return CORBA::string_dup( this->GetImpl()->GetHexoticWorkingDirectory().c_str() ); } +CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticSdMode () +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticSdMode"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetHexoticSdMode(); +} + +CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticVerbosity() +{ + // MESSAGE("HexoticPlugin_Hypothesis_i::GetVerbosity"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetHexoticVerbosity(); +} + //============================================================================= /*! * HexoticPlugin_Hypothesis_i::GetImpl diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx index a6377be..6013484 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.hxx @@ -54,8 +54,11 @@ class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis_i: void SetHexesMaxLevel(CORBA::Long theVal); CORBA::Long GetHexesMaxLevel(); - void SetHexoticQuadrangles(CORBA::Boolean theVal); - CORBA::Boolean GetHexoticQuadrangles(); + void SetMinSize(CORBA::Double theVal); + CORBA::Double GetMinSize(); + + void SetMaxSize(CORBA::Double theVal); + CORBA::Double GetMaxSize(); void SetHexoticIgnoreRidges(CORBA::Boolean theVal); CORBA::Boolean GetHexoticIgnoreRidges(); @@ -63,8 +66,8 @@ class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis_i: void SetHexoticInvalidElements(CORBA::Boolean theVal); CORBA::Boolean GetHexoticInvalidElements(); - void SetHexoticSharpAngleThreshold(CORBA::Long theVal); - CORBA::Long GetHexoticSharpAngleThreshold(); + void SetHexoticSharpAngleThreshold(CORBA::Double theVal); + CORBA::Double GetHexoticSharpAngleThreshold(); void SetHexoticNbProc(CORBA::Long theVal); CORBA::Long GetHexoticNbProc(); @@ -72,6 +75,12 @@ class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hypothesis_i: void SetHexoticWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception ); char* GetHexoticWorkingDirectory(); + void SetHexoticSdMode(CORBA::Long value); + CORBA::Long GetHexoticSdMode(); + + void SetHexoticVerbosity(CORBA::Long theVal); + CORBA::Long GetHexoticVerbosity(); + // Get implementation ::HexoticPlugin_Hypothesis* GetImpl();