From: Christophe Bourcier Date: Tue, 13 Feb 2018 10:37:01 +0000 (+0100) Subject: Fix advanced option not taken into account X-Git-Tag: V8_5_0a1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=be3f23623b1f74f9125fd7eaee46d1a20d51e081;p=plugins%2Fhybridplugin.git Fix advanced option not taken into account --- diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx index 3d99a62..e1a9483 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx @@ -1979,7 +1979,11 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* const char* value[] = { "yes" , "no" }; cmd << " --smooth_normals " << value[ res ]; } - + + // options as text + if ( hyp && !hyp->myTextOption.empty() ) { + cmd += " " + hyp->myTextOption; + } #ifdef WIN32 cmd << " < NUL"; #endif diff --git a/tests/test_advanced_text_option.py b/tests/test_advanced_text_option.py new file mode 100644 index 0000000..f4f7687 --- /dev/null +++ b/tests/test_advanced_text_option.py @@ -0,0 +1,126 @@ +# -*- coding: utf-8 -*- + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +### +### GEOM component +### + +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS + + +geompy = geomBuilder.New(theStudy) + +O = geompy.MakeVertex(0, 0, 0) +OX = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ = geompy.MakeVectorDXDYDZ(0, 0, 1) +O_1 = geompy.MakeVertex(0, 0, 0) +OX_1 = geompy.MakeVectorDXDYDZ(1, 0, 0) +OY_1 = geompy.MakeVectorDXDYDZ(0, 1, 0) +OZ_1 = geompy.MakeVectorDXDYDZ(0, 0, 1) +Cylinder_1 = geompy.MakeCylinderRH(0.5, 5) +Cylinder_2 = geompy.MakeCylinderRH(0.3, 3) +Rotation_1 = geompy.MakeRotation(Cylinder_2, OY_1, -90*math.pi/180.0) +Translation_1 = geompy.MakeTranslation(Rotation_1, 0, 0, 1.5) +piquage = geompy.MakeFuseList([Cylinder_1, Translation_1], True, True) +[Outlet] = geompy.SubShapes(piquage, [15]) +[Inlet_z,Inlet_x] = geompy.SubShapes(piquage, [3, 22]) +[corner] = geompy.SubShapes(piquage, [14]) +[geomObj_1] = geompy.SubShapeAll(Outlet, geompy.ShapeType["FACE"]) +[geomObj_2] = geompy.SubShapeAll(Inlet_z, geompy.ShapeType["FACE"]) +[geomObj_3] = geompy.SubShapeAll(Inlet_x, geompy.ShapeType["FACE"]) +geomObj_4 = geompy.MakeVertex(0, 0, 0) +geomObj_5 = geompy.MakeVectorDXDYDZ(1, 0, 0) +geomObj_6 = geompy.MakeVectorDXDYDZ(0, 1, 0) +geomObj_7 = geompy.MakeVectorDXDYDZ(0, 0, 1) +Wall = geompy.CreateGroup(piquage, geompy.ShapeType["FACE"]) +geompy.UnionIDs(Wall, [7, 17]) +[geomObj_8,geomObj_9] = geompy.SubShapeAll(Wall, geompy.ShapeType["SHAPE"]) +[geomObj_10,geomObj_11] = geompy.SubShapeAll(Wall, geompy.ShapeType["SHAPE"]) +[geomObj_12,geomObj_13] = geompy.SubShapeAll(Wall, geompy.ShapeType["FACE"]) +[geomObj_14,geomObj_15] = geompy.SubShapeAll(Wall, geompy.ShapeType["SHAPE"]) +geompy.addToStudy( O, 'O' ) +geompy.addToStudy( OX, 'OX' ) +geompy.addToStudy( OY, 'OY' ) +geompy.addToStudy( OZ, 'OZ' ) +geompy.addToStudy( O_1, 'O' ) +geompy.addToStudy( OX_1, 'OX' ) +geompy.addToStudy( OY_1, 'OY' ) +geompy.addToStudy( OZ_1, 'OZ' ) +geompy.addToStudy( Cylinder_1, 'Cylinder_1' ) +geompy.addToStudy( Cylinder_2, 'Cylinder_2' ) +geompy.addToStudy( Rotation_1, 'Rotation_1' ) +geompy.addToStudy( Translation_1, 'Translation_1' ) +geompy.addToStudy( piquage, 'piquage' ) +geompy.addToStudyInFather( piquage, Outlet, 'Outlet' ) +geompy.addToStudyInFather( piquage, Inlet_z, 'Inlet_z' ) +geompy.addToStudyInFather( piquage, Inlet_x, 'Inlet_x' ) +geompy.addToStudyInFather( piquage, corner, 'corner' ) +geompy.addToStudyInFather( piquage, Wall, 'Wall' ) + +### +### SMESH component +### + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder + +smesh = smeshBuilder.New(theStudy) + +Mesh_with_imprinting_set_by_groups = smesh.Mesh(piquage) +NETGEN_2D_1 = Mesh_with_imprinting_set_by_groups.Triangle(algo=smeshBuilder.NETGEN_1D2D) +NETGEN_Parameters_2D = NETGEN_2D_1.Parameters() +NETGEN_Parameters_2D.SetMinSize( 0.01 ) +NETGEN_Parameters_2D.SetLocalSizeOnShape(corner, 0.01) +NETGEN_Parameters_2D.SetFineness( 5 ) +NETGEN_Parameters_2D.SetGrowthRate( 0.1 ) +NETGEN_Parameters_2D.SetNbSegPerEdge( 2 ) +NETGEN_Parameters_2D.SetNbSegPerRadius( 3 ) +#Mesh_with_imprinting_set_by_groups.Triangle(algo=smeshBuilder.MG_CADSurf) +HYBRID_3D_2_2 = Mesh_with_imprinting_set_by_groups.Tetrahedron(algo=smeshBuilder.HYBRID) +HYBRID_Parameters_2 = HYBRID_3D_2_2.Parameters() +HYBRID_Parameters_2.SetElementGeneration( 0 ) +HYBRID_Parameters_2.SetHeightFirstLayer( 0.01 ) +HYBRID_Parameters_2.SetBoundaryLayersProgression( 1.1 ) +HYBRID_Parameters_2.SetNbOfBoundaryLayers( 3 ) +HYBRID_Parameters_2.SetFacesWithLayers( [ 7, 17 ] ) +HYBRID_Parameters_2.SetFacesWithImprinting( [ 22, 3, 15 ] ) +HYBRID_Parameters_2.SetLayersOnAllWrap( 0 ) +isDone = Mesh_with_imprinting_set_by_groups.Compute() + +if not isDone: + raise Exception("Problem in mesh generation") + +Nb_elems_0 = Mesh_with_imprinting_set_by_groups.NbVolumes() + +print "Nb_elems_0: ", Nb_elems_0 + +Inlet_x_3 = Mesh_with_imprinting_set_by_groups.GroupOnGeom(Inlet_x,'Inlet_x',SMESH.FACE) +Inlet_z_3 = Mesh_with_imprinting_set_by_groups.GroupOnGeom(Inlet_z,'Inlet_z',SMESH.FACE) +Outlet_3 = Mesh_with_imprinting_set_by_groups.GroupOnGeom(Outlet,'Outlet',SMESH.FACE) +Wall_3 = Mesh_with_imprinting_set_by_groups.GroupOnGeom(Wall,'Wall',SMESH.FACE) + +# Add an advanced option as text +HYBRID_Parameters_2.SetAdvancedOption( '--boundary_layer_height_relative_to_local_surface_size yes' ) +isDone = Mesh_with_imprinting_set_by_groups.Compute() + +if not isDone: + raise Exception("Problem in mesh generation") + +Nb_elems_1 = Mesh_with_imprinting_set_by_groups.NbVolumes() + +print "Nb_elems_1: ", Nb_elems_1 + +# Check that the number of elements is changed by the option +assert Nb_elems_1> 1.5*Nb_elems_0, "Advanced option as text does not work" + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(True)