From 1ac0bec50b2d526a4033dba027c1662212a14795 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Wed, 9 Dec 2015 22:37:03 +0100 Subject: [PATCH] ajout test maillage du cas avec digue --- doc/salome/examples/CMakeLists.txt | 1 + .../examples/h013_caseDigueManualMesh.py | 514 ++++++++++++++++++ 2 files changed, 515 insertions(+) create mode 100644 doc/salome/examples/h013_caseDigueManualMesh.py diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt index f5217591..d1b65c88 100644 --- a/doc/salome/examples/CMakeLists.txt +++ b/doc/salome/examples/CMakeLists.txt @@ -32,6 +32,7 @@ SET(EXAMPLES_TESTS h010_normalCaseManualMesh.py h011_normalCaseManualInterpolZ.py h012_caseDigueManual.py + h013_caseDigueManualMesh.py ) SET(HYDRO_SAMPLES diff --git a/doc/salome/examples/h013_caseDigueManualMesh.py b/doc/salome/examples/h013_caseDigueManualMesh.py new file mode 100644 index 00000000..8dac9e6f --- /dev/null +++ b/doc/salome/examples/h013_caseDigueManualMesh.py @@ -0,0 +1,514 @@ +# -*- coding: utf-8 -*- + +import os +HYDRO_SAMPLES = os.path.join( os.environ["HYDRO_ROOT_DIR"], "bin/salome/test/HYDRO") + +import sys +import salome + +salome.salome_init() +theStudy = salome.myStudy + +#---------------------- +# --- HYDRO +#---------------------- + +from HYDROPy import * +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) + +hydro_doc.SetLocalCS( 430000, 6.35e+06 ) + +garonne_ign_01 = hydro_doc.CreateObject( KIND_IMAGE ) +garonne_ign_01.SetName( "garonne_ign_01" ) + +garonne_ign_01.SetZLevel( 0 ) + + +garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" )) + +garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ), + QPoint( 1325, 85 ) ) + +garonne_ign_01.SetGlobalPoints( 1, + QPointF( 471562, 6.36775e+06 ), + QPointF( 489400, 6.37702e+06 ) ) + +garonne_ign_01.Update() + +garonne_ign_02 = hydro_doc.CreateObject( KIND_IMAGE ) +garonne_ign_02.SetName( "garonne_ign_02" ) + +garonne_ign_02.SetZLevel( 1 ) + + +garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" )) + +garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ), + QPoint( 784, 481 ) ) + +garonne_ign_02.SetGlobalPoints( 3, + QPointF( 631, 95 ), + QPointF( 26, 129 ) ) +garonne_ign_02.SetTrsfReferenceImage( garonne_ign_01 ) + +garonne_ign_02.Update() + +garonne = hydro_doc.CreateObject( KIND_POLYLINEXY ) +garonne.SetName( "garonne" ) + +garonne.SetZLevel( 2 ) + +garonne.AddSection( "Section_1", 1, 1 ) +garonne.AddPoint( 0, gp_XY( 38191.48, 33184.55 ) ) +garonne.AddPoint( 0, gp_XY( 38553.78, 33013.53 ) ) +garonne.AddPoint( 0, gp_XY( 38993.90, 32767.64 ) ) +garonne.AddPoint( 0, gp_XY( 39678.58, 32533.58 ) ) +garonne.AddPoint( 0, gp_XY( 40240.26, 32305.27 ) ) +garonne.AddPoint( 0, gp_XY( 40717.94, 32193.70 ) ) +garonne.AddPoint( 0, gp_XY( 41361.00, 32464.18 ) ) +garonne.AddPoint( 0, gp_XY( 41831.41, 32626.69 ) ) +garonne.AddPoint( 0, gp_XY( 41950.14, 32618.24 ) ) +garonne.AddPoint( 0, gp_XY( 42524.97, 32419.61 ) ) +garonne.AddPoint( 0, gp_XY( 42909.80, 32291.33 ) ) +garonne.AddPoint( 0, gp_XY( 43177.03, 32269.95 ) ) +garonne.AddPoint( 0, gp_XY( 43465.65, 32344.78 ) ) +garonne.AddPoint( 0, gp_XY( 43754.27, 32152.37 ) ) +garonne.AddPoint( 0, gp_XY( 44128.40, 31842.37 ) ) +garonne.AddPoint( 0, gp_XY( 44003.90, 31269.93 ) ) +garonne.AddPoint( 0, gp_XY( 44010.82, 30869.63 ) ) +garonne.AddPoint( 0, gp_XY( 44064.26, 30655.84 ) ) +garonne.AddPoint( 0, gp_XY( 44434.73, 30366.18 ) ) +garonne.AddPoint( 0, gp_XY( 45208.04, 30484.81 ) ) +garonne.AddPoint( 0, gp_XY( 45705.01, 30287.34 ) ) +garonne.AddPoint( 0, gp_XY( 45933.89, 30046.87 ) ) +garonne.AddPoint( 0, gp_XY( 46127.34, 29490.68 ) ) +garonne.AddPoint( 0, gp_XY( 46111.60, 29226.08 ) ) +garonne.AddPoint( 0, gp_XY( 46228.62, 28784.05 ) ) +garonne.AddPoint( 0, gp_XY( 46247.64, 28449.75 ) ) +garonne.AddPoint( 0, gp_XY( 46108.48, 28086.94 ) ) +garonne.AddPoint( 0, gp_XY( 45618.52, 27553.74 ) ) +garonne.AddPoint( 0, gp_XY( 45276.77, 27042.78 ) ) +garonne.AddPoint( 0, gp_XY( 45001.89, 26273.15 ) ) +garonne.AddPoint( 0, gp_XY( 45167.76, 25975.34 ) ) +garonne.AddPoint( 0, gp_XY( 46018.15, 25848.84 ) ) +garonne.AddPoint( 0, gp_XY( 46378.94, 25872.21 ) ) +garonne.AddPoint( 0, gp_XY( 46885.57, 25937.64 ) ) +garonne.AddPoint( 0, gp_XY( 47278.36, 25782.88 ) ) +garonne.AddPoint( 0, gp_XY( 47153.86, 25728.04 ) ) +garonne.AddPoint( 0, gp_XY( 46987.51, 25749.97 ) ) +garonne.AddPoint( 0, gp_XY( 46658.26, 25715.71 ) ) +garonne.AddPoint( 0, gp_XY( 45650.76, 25634.46 ) ) +garonne.AddPoint( 0, gp_XY( 45122.63, 25748.21 ) ) +garonne.AddPoint( 0, gp_XY( 44797.63, 26325.09 ) ) +garonne.AddPoint( 0, gp_XY( 45114.51, 27168.75 ) ) +garonne.AddPoint( 0, gp_XY( 45508.28, 27713.21 ) ) +garonne.AddPoint( 0, gp_XY( 45994.19, 28382.53 ) ) +garonne.AddPoint( 0, gp_XY( 45927.01, 29201.34 ) ) +garonne.AddPoint( 0, gp_XY( 45756.39, 29859.47 ) ) +garonne.AddPoint( 0, gp_XY( 45390.76, 30151.97 ) ) +garonne.AddPoint( 0, gp_XY( 45039.85, 30120.84 ) ) +garonne.AddPoint( 0, gp_XY( 44513.26, 30084.28 ) ) +garonne.AddPoint( 0, gp_XY( 43923.42, 30426.28 ) ) +garonne.AddPoint( 0, gp_XY( 43768.81, 30934.29 ) ) +garonne.AddPoint( 0, gp_XY( 43820.10, 31425.20 ) ) +garonne.AddPoint( 0, gp_XY( 43854.78, 31801.12 ) ) +garonne.AddPoint( 0, gp_XY( 43479.64, 32053.54 ) ) +garonne.AddPoint( 0, gp_XY( 42923.47, 32051.85 ) ) +garonne.AddPoint( 0, gp_XY( 42493.64, 32187.97 ) ) +garonne.AddPoint( 0, gp_XY( 42074.27, 32302.91 ) ) +garonne.AddPoint( 0, gp_XY( 41624.75, 32330.93 ) ) +garonne.AddPoint( 0, gp_XY( 41325.93, 32187.97 ) ) +garonne.AddPoint( 0, gp_XY( 40879.52, 31987.29 ) ) +garonne.AddPoint( 0, gp_XY( 40308.78, 32018.46 ) ) +garonne.AddPoint( 0, gp_XY( 39782.86, 32207.17 ) ) +garonne.AddPoint( 0, gp_XY( 38814.10, 32560.43 ) ) +garonne.AddPoint( 0, gp_XY( 38302.17, 32903.70 ) ) + +garonne.Update() + + +domaine = hydro_doc.CreateObject( KIND_POLYLINEXY ) +domaine.SetName( "domaine" ) + +domaine.SetZLevel( 3 ) + +domaine.AddSection( "Section_1", 0, 1 ) +domaine.AddPoint( 0, gp_XY( 39901.15, 34762.30 ) ); +domaine.AddPoint( 0, gp_XY( 38086.50, 29964.69 ) ); +domaine.AddPoint( 0, gp_XY( 44835.83, 24264.97 ) ); +domaine.AddPoint( 0, gp_XY( 46758.56, 25021.86 ) ); +domaine.AddPoint( 0, gp_XY( 46757.20, 26601.21 ) ); +domaine.AddPoint( 0, gp_XY( 48566.45, 30152.81 ) ); +domaine.AddPoint( 0, gp_XY( 45532.36, 33239.83 ) ); +domaine.AddPoint( 0, gp_XY( 43548.77, 34048.39 ) ); + +domaine.Update() + + +lit_majeur = hydro_doc.CreateObject( KIND_POLYLINEXY ) +lit_majeur.SetName( "lit_majeur" ) + +lit_majeur.SetZLevel( 7 ) + +lit_majeur.AddSection( "Section_1", 1, 1 ) +lit_majeur.AddPoint( 0, gp_XY( 41225.22, 34118.46 ) ) +lit_majeur.AddPoint( 0, gp_XY( 41716.41, 33705.87 ) ) +lit_majeur.AddPoint( 0, gp_XY( 42384.43, 33293.27 ) ) +lit_majeur.AddPoint( 0, gp_XY( 42561.26, 32684.19 ) ) +lit_majeur.AddPoint( 0, gp_XY( 42875.62, 32369.83 ) ) +lit_majeur.AddPoint( 0, gp_XY( 43700.82, 32350.18 ) ) +lit_majeur.AddPoint( 0, gp_XY( 44526.02, 31662.51 ) ) +lit_majeur.AddPoint( 0, gp_XY( 45370.87, 31819.69 ) ) +lit_majeur.AddPoint( 0, gp_XY( 46274.66, 31682.16 ) ) +lit_majeur.AddPoint( 0, gp_XY( 46981.97, 31328.50 ) ) +lit_majeur.AddPoint( 0, gp_XY( 47021.27, 30719.43 ) ) +lit_majeur.AddPoint( 0, gp_XY( 47217.74, 30051.41 ) ) +lit_majeur.AddPoint( 0, gp_XY( 47846.46, 29560.22 ) ) +lit_majeur.AddPoint( 0, gp_XY( 48730.61, 28735.02 ) ) +lit_majeur.AddPoint( 0, gp_XY( 48809.20, 27732.99 ) ) +lit_majeur.AddPoint( 0, gp_XY( 49143.21, 27163.21 ) ) +lit_majeur.AddPoint( 0, gp_XY( 49654.05, 26829.20 ) ) +lit_majeur.AddPoint( 0, gp_XY( 49693.34, 25355.63 ) ) +lit_majeur.AddPoint( 0, gp_XY( 48612.72, 23214.04 ) ) +lit_majeur.AddPoint( 0, gp_XY( 47453.51, 23115.80 ) ) +lit_majeur.AddPoint( 0, gp_XY( 46471.13, 24176.77 ) ) +lit_majeur.AddPoint( 0, gp_XY( 45960.29, 25257.39 ) ) +lit_majeur.AddPoint( 0, gp_XY( 44899.32, 25591.40 ) ) +lit_majeur.AddPoint( 0, gp_XY( 44270.60, 26573.78 ) ) +lit_majeur.AddPoint( 0, gp_XY( 43248.92, 27909.82 ) ) +lit_majeur.AddPoint( 0, gp_XY( 42757.73, 28243.83 ) ) +lit_majeur.AddPoint( 0, gp_XY( 42266.54, 28342.07 ) ) +lit_majeur.AddPoint( 0, gp_XY( 41736.06, 28106.30 ) ) +lit_majeur.AddPoint( 0, gp_XY( 41402.05, 28833.26 ) ) +lit_majeur.AddPoint( 0, gp_XY( 40910.86, 28911.85 ) ) +lit_majeur.AddPoint( 0, gp_XY( 40576.85, 29324.45 ) ) +lit_majeur.AddPoint( 0, gp_XY( 40144.60, 29599.51 ) ) +lit_majeur.AddPoint( 0, gp_XY( 39024.69, 30130.00 ) ) +lit_majeur.AddPoint( 0, gp_XY( 38612.09, 30365.77 ) ) +lit_majeur.AddPoint( 0, gp_XY( 38828.21, 33391.50 ) ) + +lit_majeur.Update() + +axeDigue = hydro_doc.CreateObject( KIND_POLYLINEXY ); +axeDigue.SetName( "axeDigue" ); + +axeDigue.SetZLevel( 8 ); + +axeDigue.AddSection( "Section_1", 1, 0 ); +axeDigue.AddPoint( 0, gp_XY( 40961.39, 31800.95 ) ); +axeDigue.AddPoint( 0, gp_XY( 41296.95, 31992.70 ) ); +axeDigue.AddPoint( 0, gp_XY( 41656.48, 31872.85 ) ); +axeDigue.AddPoint( 0, gp_XY( 42004.02, 31441.42 ) ); +axeDigue.AddPoint( 0, gp_XY( 42123.86, 31021.97 ) ); +axeDigue.AddPoint( 0, gp_XY( 42579.27, 30926.10 ) ); +axeDigue.AddPoint( 0, gp_XY( 43082.60, 30638.48 ) ); +axeDigue.AddPoint( 0, gp_XY( 43130.54, 30075.22 ) ); +axeDigue.AddPoint( 0, gp_XY( 43538.00, 29763.63 ) ); +axeDigue.AddPoint( 0, gp_XY( 44053.33, 29787.60 ) ); +axeDigue.AddPoint( 0, gp_XY( 44736.43, 29847.52 ) ); + +axeDigue.Update(); + + +Cloud_02 = hydro_doc.CreateObject( KIND_BATHYMETRY ) +Cloud_02.SetName( "Cloud_02" ) + +Cloud_02.SetAltitudesInverted( 0 ) +Cloud_02.ImportFromFile( os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz" )) + +Cloud_02.Update() + + +garonne_point_L93 = hydro_doc.CreateObject( KIND_BATHYMETRY ) +garonne_point_L93.SetName( "garonne_point_L93" ) + +garonne_point_L93.SetAltitudesInverted( 0 ) +garonne_point_L93.ImportFromFile( os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz" )) + +garonne_point_L93.Update() + + +altitudeDigue = hydro_doc.CreateObject( KIND_PROFILE ); +altitudeDigue.SetName( "altitudeDigue" ); + +profile_points = [ gp_XY( 1, 35 ), + gp_XY( 6000, 40 ) ]; +altitudeDigue.SetParametricPoints( profile_points ); + +altitudeDigue.Update(); + + +sectionDigue = hydro_doc.CreateObject( KIND_PROFILE ); +sectionDigue.SetName( "sectionDigue" ); + +profile_points = [ gp_XY( -10, -10 ), + gp_XY( -8, -1 ), + gp_XY( 0, 0 ), + gp_XY( 8, -1 ), + gp_XY( 10, -10 ) ]; +sectionDigue.SetParametricPoints( profile_points ); + +sectionDigue.Update(); + + +axe3DDigue = hydro_doc.CreateObject( KIND_POLYLINE ); +axe3DDigue.SetName( "axe3DDigue" ); + +axe3DDigue.SetPolylineXY( axeDigue ); +axe3DDigue.SetProfileUZ( sectionDigue.GetProfileUZ() ); + +axe3DDigue.Update(); + + +litMineur = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE ) +litMineur.SetName( "litMineur" ) + +litMineur.SetZLevel( 6 ) + +litMineur.SetAltitudeObject( garonne_point_L93 ) +litMineur.SetPolyline( garonne ) + +litMineur.Update() + + +litMajeur = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE ) +litMajeur.SetName( "litMajeur" ) + +litMajeur.SetZLevel( 5 ) + +litMajeur.SetFillingColor( QColor( 0, 170, 127, 255 ) ) + +litMajeur.SetAltitudeObject( Cloud_02 ) +litMajeur.SetPolyline( lit_majeur ) + +litMajeur.Update() + + +domaineEtendu = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE ) +domaineEtendu.SetName( "domaineEtendu" ) + +domaineEtendu.SetZLevel( 4 ) + +domaineEtendu.SetFillingColor( QColor( 201, 203, 55, 255 ) ) + +domaineEtendu.SetAltitudeObject( Cloud_02 ) +domaineEtendu.SetPolyline( domaine ) + +domaineEtendu.Update() + + +digue = hydro_doc.CreateObject( KIND_DIGUE ); +digue.SetName( "digue" ); + +digue.SetZLevel( 9 ); + +digue.SetGuideLine( axe3DDigue ); +digue.SetProfile( sectionDigue ); +digue.SetEquiDistance( 50 ); + +digue.Update(); + + +# Calculation case +garonne_2 = hydro_doc.CreateObject( KIND_CALCULATION ) +garonne_2.SetName( "garonne_2" ) + +garonne_2.SetAssignmentMode( HYDROData_CalculationCase.MANUAL ) +garonne_2.AddGeometryObject( litMineur ) +garonne_2.AddGeometryObject( domaineEtendu ) +garonne_2.AddGeometryObject( litMajeur ) +garonne_2.AddGeometryObject( digue ); + +case_geom_group = domaineEtendu.GetGroup( 0 ); +garonne_2.AddGeometryGroup( case_geom_group ); +case_geom_group = litMineur.GetGroup( 0 ); +garonne_2.AddGeometryGroup( case_geom_group ); +case_geom_group = litMajeur.GetGroup( 0 ); +garonne_2.AddGeometryGroup( case_geom_group ); +case_geom_group = digue.GetGroup( 2 ); +garonne_2.AddGeometryGroup( case_geom_group ); +case_geom_group = digue.GetGroup( 0 ); +garonne_2.AddGeometryGroup( case_geom_group ); +case_geom_group = digue.GetGroup( 3 ); +garonne_2.AddGeometryGroup( case_geom_group ); +case_geom_group = digue.GetGroup( 1 ); +garonne_2.AddGeometryGroup( case_geom_group ); +garonne_2.SetBoundaryPolyline( domaine ); + +# Start the algorithm of the partition and assignment +garonne_2.Update(); +garonne_2_litMineur = hydro_doc.FindObjectByName( "garonne_2_Reg_1" ); +garonne_2_Zone_1 = hydro_doc.FindObjectByName( "garonne_2_Zone_1" ); +garonne_2_Zone_1.SetMergeType( HYDROData_Zone.Merge_ZMAX ) +garonne_2_litMineur.AddZone( garonne_2_Zone_1 ); +garonne_2_riveDroite = hydro_doc.FindObjectByName( "garonne_2_Reg_2" ); +garonne_2_Zone_2 = hydro_doc.FindObjectByName( "garonne_2_Zone_2" ); +garonne_2_riveDroite.AddZone( garonne_2_Zone_2 ); +garonne_2_Zone_3 = hydro_doc.FindObjectByName( "garonne_2_Zone_3" ); +garonne_2_riveDroite.AddZone( garonne_2_Zone_3 ); +garonne_2_riveGauche = hydro_doc.FindObjectByName( "garonne_2_Reg_3" ); +garonne_2_Zone_4 = hydro_doc.FindObjectByName( "garonne_2_Zone_4" ); +garonne_2_riveGauche.AddZone( garonne_2_Zone_4 ); +garonne_2_Zone_5 = hydro_doc.FindObjectByName( "garonne_2_Zone_5" ); +garonne_2_riveGauche.AddZone( garonne_2_Zone_5 ); +garonne_2_digue = hydro_doc.FindObjectByName( "garonne_2_Reg_4" ); +garonne_2_Zone_6 = hydro_doc.FindObjectByName( "garonne_2_Zone_6" ); +garonne_2_Zone_6.SetMergeType( HYDROData_Zone.Merge_ZMIN ) +garonne_2_digue.AddZone( garonne_2_Zone_6 ); + +garonne_2_litMineur.SetName("garonne_2_litMineur") +garonne_2_riveDroite.SetName("garonne_2_riveDroite") +garonne_2_riveGauche.SetName("garonne_2_riveGauche") +garonne_2_digue.SetName("garonne_2_digue") + +# Export of the calculation case +garonne_2_entry = garonne_2.Export( theStudy._get_StudyId() ) + +#---------------------- +# --- Geometry +#---------------------- + +# Get geometry shape and print debug information +import GEOM +from salome.geom import geomBuilder +import math +import SALOMEDS +from salome.hydrotools.controls import controlGeomProps + +geompy = geomBuilder.New(theStudy) + +print "Entry:", garonne_2_entry +HYDRO_garonne_2 = salome.IDToObject( str( garonne_2_entry ) ) +print "Geom shape:", HYDRO_garonne_2 +print "Geom shape name:", HYDRO_garonne_2.GetName() + +[riveGauche,digue,litMineur,riveDroite] = geompy.ExtractShapes(HYDRO_garonne_2, geompy.ShapeType["FACE"], True) +geompy.addToStudyInFather( HYDRO_garonne_2, riveGauche, 'riveGauche' ) +geompy.addToStudyInFather( HYDRO_garonne_2, digue, 'digue' ) +geompy.addToStudyInFather( HYDRO_garonne_2, litMineur, 'litMineur' ) +geompy.addToStudyInFather( HYDRO_garonne_2, riveDroite, 'riveDroite' ) + +SectionsGaronne = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) +geompy.UnionIDs(SectionsGaronne, [4, 11]) +geompy.addToStudyInFather( HYDRO_garonne_2, SectionsGaronne, 'SectionsGaronne' ) + +SectionsDigue = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) +geompy.UnionIDs(SectionsDigue, [46, 50]) +geompy.addToStudyInFather( HYDRO_garonne_2, SectionsDigue, 'SectionsDigue' ) + +# --- recreate subshapes already exported from HYDRO to get access from Python +#garonne_2_domaineEtendu_Outer = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) +#geompy.UnionIDs(garonne_2_domaineEtendu_Outer, [4, 11, 17, 24, 26, 28, 14, 19, 20, 22, 31, 39, 41, 33, 35, 37]) +#garonne_2_digue_Left_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) +#geompy.UnionIDs(garonne_2_digue_Left_Bank, [43]) +#garonne_2_digue_Outlet = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) +#geompy.UnionIDs(garonne_2_digue_Outlet, [46]) +#garonne_2_digue_Inlet = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) +#geompy.UnionIDs(garonne_2_digue_Inlet, [50]) +#garonne_2_litMineur_Outer = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) +#geompy.UnionIDs(garonne_2_litMineur_Outer, [7, 9]) +#garonne_2_digue_Right_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) +#geompy.UnionIDs(garonne_2_digue_Right_Bank, [48]) + +controlGeomProps(geompy, riveGauche, 39493.270103, 35885901.558025) +controlGeomProps(geompy, digue, 10343.900923, 103893.397004) +controlGeomProps(geompy, litMineur, 30337.548492, 3646827.749809) +controlGeomProps(geompy, riveDroite, 32012.343241, 26177085.460092) + +#---------------------- +# --- Meshing +#---------------------- + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +from salome.hydrotools.controls import controlMeshStats, controlSubMeshStats + +smesh = smeshBuilder.New(theStudy) + +# --- algorithms and hypothesis +garonne_2 = smesh.Mesh(HYDRO_garonne_2) + +NETGEN_2D = garonne_2.Triangle(algo=smeshBuilder.NETGEN_1D2D) +NETGEN_2D_Parameters = NETGEN_2D.Parameters() +NETGEN_2D_Parameters.SetMaxSize( 200 ) +NETGEN_2D_Parameters.SetSecondOrder( 0 ) +NETGEN_2D_Parameters.SetOptimize( 1 ) +NETGEN_2D_Parameters.SetFineness( 4 ) +NETGEN_2D_Parameters.SetMinSize( 50 ) +NETGEN_2D_Parameters.SetUseSurfaceCurvature( 1 ) +NETGEN_2D_Parameters.SetFuseEdges( 1 ) +NETGEN_2D_Parameters.SetQuadAllowed( 0 ) + +algo2D_litMineur = garonne_2.Quadrangle(algo=smeshBuilder.QUAD_MA_PROJ,geom=litMineur) +algo1D_litMineur = garonne_2.Segment(geom=litMineur) +hypo1D_litMineur = algo1D_litMineur.LocalLength(100,None,1e-07) +subMesh_litMineur = algo1D_litMineur.GetSubMesh() +smesh.SetName(subMesh_litMineur, "litMineur") + +algo1D_SectionsGaronne = garonne_2.Segment(geom=SectionsGaronne) +hypo1D_SectionsGaronne = algo1D_SectionsGaronne.NumberOfSegments(8) +hypo1D_SectionsGaronne.SetDistrType( 0 ) +subMesh_SectionsGaronne = algo1D_SectionsGaronne.GetSubMesh() +smesh.SetName(subMesh_SectionsGaronne, "SectionsGaronne") + +algo2D_digue = garonne_2.Quadrangle(algo=smeshBuilder.QUAD_MA_PROJ,geom=digue) +algo1D_digue = garonne_2.Segment(geom=digue) +hypo1D_digue = algo1D_digue.LocalLength(50,None,1e-07) +subMesh_digue = algo1D_digue.GetSubMesh() +smesh.SetName(subMesh_digue, "digue") + +algo1D_SectionsDigue = garonne_2.Segment(geom=SectionsDigue) +hypo1D_SectionsDigue = algo1D_SectionsDigue.NumberOfSegments(4) +hypo1D_SectionsDigue.SetDistrType( 0 ) +subMesh_SectionsDigue = algo1D_SectionsDigue.GetSubMesh() +smesh.SetName(subMesh_SectionsDigue, "SectionsDigue") + +isDone = garonne_2.SetMeshOrder( [ [ subMesh_SectionsGaronne, subMesh_litMineur ], [ subMesh_SectionsDigue, subMesh_digue ]]) + +# --- compute mesh +isDone = garonne_2.Compute() +isDone = garonne_2.SplitQuadObject( garonne_2, 1 ) + +# --- geometrical groups of edges +#garonne_2_litMineur_Outer_1 = garonne_2.GroupOnGeom(garonne_2_litMineur_Outer,'garonne_2_litMineur_Outer',SMESH.EDGE) +#garonne_2_domaineEtendu_Outer_1 = garonne_2.GroupOnGeom(garonne_2_domaineEtendu_Outer,'garonne_2_domaineEtendu_Outer',SMESH.EDGE) +#aval_1 = garonne_2.GroupOnGeom(aval,'aval',SMESH.EDGE) +#amont_1 = garonne_2.GroupOnGeom(amont,'amont',SMESH.EDGE) +#bordGaucheDomaine_1 = garonne_2.GroupOnGeom(bordGaucheDomaine,'bordGaucheDomaine',SMESH.EDGE) +#bordDroiteDomaine_1 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.EDGE) +SectionsGaronne_2 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.EDGE) +SectionsDigue_2 = garonne_2.GroupOnGeom(SectionsDigue,'SectionsDigue',SMESH.EDGE) + +# --- geometrical groups of faces +riveGauche_1 = garonne_2.GroupOnGeom(riveGauche,'riveGauche',SMESH.FACE) +litMineur_2 = garonne_2.GroupOnGeom(litMineur,'litMineur',SMESH.FACE) +riveDroite_1 = garonne_2.GroupOnGeom(riveDroite,'riveDroite',SMESH.FACE) +digue_1 = garonne_2.GroupOnGeom(digue,'digue',SMESH.FACE) + +# --- geometrical groups of nodes +#garonne_2_litMineur_Outer_2 = garonne_2.GroupOnGeom(garonne_2_litMineur_Outer,'garonne_2_litMineur_Outer',SMESH.NODE) +#garonne_2_domaineEtendu_Outer_2 = garonne_2.GroupOnGeom(garonne_2_domaineEtendu_Outer,'garonne_2_domaineEtendu_Outer',SMESH.NODE) +riveGauche_2 = garonne_2.GroupOnGeom(riveGauche,'riveGauche',SMESH.NODE) +litMineur_3 = garonne_2.GroupOnGeom(litMineur,'litMineur',SMESH.NODE) +riveDroite_2 = garonne_2.GroupOnGeom(riveDroite,'riveDroite',SMESH.NODE) +digue_2 = garonne_2.GroupOnGeom(digue,'digue',SMESH.NODE) +#aval_2 = garonne_2.GroupOnGeom(aval,'aval',SMESH.NODE) +#amont_2 = garonne_2.GroupOnGeom(amont,'amont',SMESH.NODE) +#bordGaucheDomaine_2 = garonne_2.GroupOnGeom(bordGaucheDomaine,'bordGaucheDomaine',SMESH.NODE) +#bordDroiteDomaine_2 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE) +SectionsGaronne_3 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE) + +garonne_2.SetAutoColor( 1 ) +garonne_2.ExportMED( r'/tmp/garonne_2.med', 0, SMESH.MED_V2_2, 1, None ,1) + +controlMeshStats(garonne_2, 6190, 691, 12201) +controlSubMeshStats(litMineur_2, 2384) +controlSubMeshStats(riveDroite_1, 2400) +controlSubMeshStats(riveGauche_1, 6585) +controlSubMeshStats(digue_1, 832) + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) -- 2.39.2