X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=inline;f=doc%2Fsalome%2Fexamples%2Fh018_streamInterpolation.py;h=7294842118162cdc6705b22e051a774cae3d251d;hb=9bbc6d378308cf934454c48e3be90b633531b538;hp=600f51e7183b8028a7256a454b4d4cfd4bd0b1d5;hpb=cb890fc20e239d522bee9d2071344703bc807402;p=modules%2Fhydro.git diff --git a/doc/salome/examples/h018_streamInterpolation.py b/doc/salome/examples/h018_streamInterpolation.py index 600f51e7..72948421 100644 --- a/doc/salome/examples/h018_streamInterpolation.py +++ b/doc/salome/examples/h018_streamInterpolation.py @@ -1,28 +1,26 @@ # -*- coding: utf-8 -*- -### -### This file is generated automatically by SALOME v7.8.0 with dump python functionality -### +import os +HYDRO_SAMPLES = os.path.join( os.environ["HYDRO_ROOT_DIR"], "bin/salome/test/HYDRO") import sys import salome +import os +HYDRO_SAMPLES = os.path.join( os.environ["HYDRO_ROOT_DIR"], "bin/salome/test/HYDRO") + -salome.salome_init() -theStudy = salome.myStudy -import salome_notebook -notebook = salome_notebook.NoteBook(theStudy) -sys.path.insert( 0, r'/local00/home/B27118/projets/salome_hydro/bugs/V780H2016') +salome.salome_init() -### -### HYDRO component -### +#---------------------- +# --- HYDRO +#---------------------- from HYDROPy import * -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt5.QtCore import * +from PyQt5.QtGui import * -hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() ) +hydro_doc = HYDROData_Document.Document() hydro_doc.SetLocalCS( 0.000, 0.000 ) @@ -31,181 +29,181 @@ Strickler_table_1.SetName( "Strickler table_1" ) Strickler_table_1.SetAttrName( "CODE_06" ) -Strickler_table_1.Set( u"Pelouses et pâturages naturels", 1.0321 ) -Strickler_table_1.SetAttrValue( u"Pelouses et pâturages naturels", "321" ) -Strickler_table_1.SetColor( u"Pelouses et pâturages naturels", QColor( 204, 242, 77 ) ) +Strickler_table_1.Set( "Pelouses et pâturages naturels", 1.0321 ) +Strickler_table_1.SetAttrValue( "Pelouses et pâturages naturels", "321" ) +Strickler_table_1.SetColor( "Pelouses et pâturages naturels", QColor( 204, 242, 77 ) ) -Strickler_table_1.Set( u"Aéroports", 1.0124 ) -Strickler_table_1.SetAttrValue( u"Aéroports", "124" ) -Strickler_table_1.SetColor( u"Aéroports", QColor( 230, 204, 230 ) ) +Strickler_table_1.Set( "Aéroports", 1.0124 ) +Strickler_table_1.SetAttrValue( "Aéroports", "124" ) +Strickler_table_1.SetColor( "Aéroports", QColor( 230, 204, 230 ) ) -Strickler_table_1.Set( u"Systèmes culturaux et parcellaires complexes", 1.0242 ) -Strickler_table_1.SetAttrValue( u"Systèmes culturaux et parcellaires complexes", "242" ) -Strickler_table_1.SetColor( u"Systèmes culturaux et parcellaires complexes", QColor( 255, 230, 77 ) ) +Strickler_table_1.Set( "Systèmes culturaux et parcellaires complexes", 1.0242 ) +Strickler_table_1.SetAttrValue( "Systèmes culturaux et parcellaires complexes", "242" ) +Strickler_table_1.SetColor( "Systèmes culturaux et parcellaires complexes", QColor( 255, 230, 77 ) ) -Strickler_table_1.Set( u"Cultures annuelles associées à des cultures permanentes", 1.0241 ) -Strickler_table_1.SetAttrValue( u"Cultures annuelles associées à des cultures permanentes", "241" ) -Strickler_table_1.SetColor( u"Cultures annuelles associées à des cultures permanentes", QColor( 255, 230, 166 ) ) +Strickler_table_1.Set( "Cultures annuelles associées à des cultures permanentes", 1.0241 ) +Strickler_table_1.SetAttrValue( "Cultures annuelles associées à des cultures permanentes", "241" ) +Strickler_table_1.SetColor( "Cultures annuelles associées à des cultures permanentes", QColor( 255, 230, 166 ) ) -Strickler_table_1.Set( u"Forêt et végétation arbustive en mutation", 1.0324 ) -Strickler_table_1.SetAttrValue( u"Forêt et végétation arbustive en mutation", "324" ) -Strickler_table_1.SetColor( u"Forêt et végétation arbustive en mutation", QColor( 166, 242, 0 ) ) +Strickler_table_1.Set( "Forêt et végétation arbustive en mutation", 1.0324 ) +Strickler_table_1.SetAttrValue( "Forêt et végétation arbustive en mutation", "324" ) +Strickler_table_1.SetColor( "Forêt et végétation arbustive en mutation", QColor( 166, 242, 0 ) ) -Strickler_table_1.Set( u"Décharges", 1.0132 ) -Strickler_table_1.SetAttrValue( u"Décharges", "132" ) -Strickler_table_1.SetColor( u"Décharges", QColor( 166, 77, 0 ) ) +Strickler_table_1.Set( "Décharges", 1.0132 ) +Strickler_table_1.SetAttrValue( "Décharges", "132" ) +Strickler_table_1.SetColor( "Décharges", QColor( 166, 77, 0 ) ) -Strickler_table_1.Set( u"Végétation clairsemée", 1.0333 ) -Strickler_table_1.SetAttrValue( u"Végétation clairsemée", "333" ) -Strickler_table_1.SetColor( u"Végétation clairsemée", QColor( 204, 255, 204 ) ) +Strickler_table_1.Set( "Végétation clairsemée", 1.0333 ) +Strickler_table_1.SetAttrValue( "Végétation clairsemée", "333" ) +Strickler_table_1.SetColor( "Végétation clairsemée", QColor( 204, 255, 204 ) ) -Strickler_table_1.Set( u"Prairies et autres surfaces toujours en herbe à usage agricole", 1.0231 ) -Strickler_table_1.SetAttrValue( u"Prairies et autres surfaces toujours en herbe à usage agricole", "231" ) -Strickler_table_1.SetColor( u"Prairies et autres surfaces toujours en herbe à usage agricole", QColor( 230, 230, 77 ) ) +Strickler_table_1.Set( "Prairies et autres surfaces toujours en herbe à usage agricole", 1.0231 ) +Strickler_table_1.SetAttrValue( "Prairies et autres surfaces toujours en herbe à usage agricole", "231" ) +Strickler_table_1.SetColor( "Prairies et autres surfaces toujours en herbe à usage agricole", QColor( 230, 230, 77 ) ) -Strickler_table_1.Set( u"Périmètres irrigués en permanence", 1.0212 ) -Strickler_table_1.SetAttrValue( u"Périmètres irrigués en permanence", "212" ) -Strickler_table_1.SetColor( u"Périmètres irrigués en permanence", QColor( 255, 255, 0 ) ) +Strickler_table_1.Set( "Périmètres irrigués en permanence", 1.0212 ) +Strickler_table_1.SetAttrValue( "Périmètres irrigués en permanence", "212" ) +Strickler_table_1.SetColor( "Périmètres irrigués en permanence", QColor( 255, 255, 0 ) ) -Strickler_table_1.Set( u"Plans d'eau", 1.0512 ) -Strickler_table_1.SetAttrValue( u"Plans d'eau", "512" ) -Strickler_table_1.SetColor( u"Plans d'eau", QColor( 128, 242, 230 ) ) +Strickler_table_1.Set( "Plans d'eau", 1.0512 ) +Strickler_table_1.SetAttrValue( "Plans d'eau", "512" ) +Strickler_table_1.SetColor( "Plans d'eau", QColor( 128, 242, 230 ) ) -Strickler_table_1.Set( u"Territoires agroforestiers", 1.0244 ) -Strickler_table_1.SetAttrValue( u"Territoires agroforestiers", "244" ) -Strickler_table_1.SetColor( u"Territoires agroforestiers", QColor( 242, 204, 166 ) ) +Strickler_table_1.Set( "Territoires agroforestiers", 1.0244 ) +Strickler_table_1.SetAttrValue( "Territoires agroforestiers", "244" ) +Strickler_table_1.SetColor( "Territoires agroforestiers", QColor( 242, 204, 166 ) ) -Strickler_table_1.Set( u"Forêts mélangées", 1.0313 ) -Strickler_table_1.SetAttrValue( u"Forêts mélangées", "313" ) -Strickler_table_1.SetColor( u"Forêts mélangées", QColor( 77, 255, 0 ) ) +Strickler_table_1.Set( "Forêts mélangées", 1.0313 ) +Strickler_table_1.SetAttrValue( "Forêts mélangées", "313" ) +Strickler_table_1.SetColor( "Forêts mélangées", QColor( 77, 255, 0 ) ) -Strickler_table_1.Set( u"Glaciers et neiges éternelles", 1.0335 ) -Strickler_table_1.SetAttrValue( u"Glaciers et neiges éternelles", "335" ) -Strickler_table_1.SetColor( u"Glaciers et neiges éternelles", QColor( 166, 230, 204 ) ) +Strickler_table_1.Set( "Glaciers et neiges éternelles", 1.0335 ) +Strickler_table_1.SetAttrValue( "Glaciers et neiges éternelles", "335" ) +Strickler_table_1.SetColor( "Glaciers et neiges éternelles", QColor( 166, 230, 204 ) ) -Strickler_table_1.Set( u"Plages, dunes et sable", 1.0331 ) -Strickler_table_1.SetAttrValue( u"Plages, dunes et sable", "331" ) -Strickler_table_1.SetColor( u"Plages, dunes et sable", QColor( 230, 230, 230 ) ) +Strickler_table_1.Set( "Plages, dunes et sable", 1.0331 ) +Strickler_table_1.SetAttrValue( "Plages, dunes et sable", "331" ) +Strickler_table_1.SetColor( "Plages, dunes et sable", QColor( 230, 230, 230 ) ) -Strickler_table_1.Set( u"Zones incendiées", 1.0334 ) -Strickler_table_1.SetAttrValue( u"Zones incendiées", "334" ) -Strickler_table_1.SetColor( u"Zones incendiées", QColor( 0, 0, 0 ) ) +Strickler_table_1.Set( "Zones incendiées", 1.0334 ) +Strickler_table_1.SetAttrValue( "Zones incendiées", "334" ) +Strickler_table_1.SetColor( "Zones incendiées", QColor( 0, 0, 0 ) ) -Strickler_table_1.Set( u"Tissu urbain continu", 1.0111 ) -Strickler_table_1.SetAttrValue( u"Tissu urbain continu", "111" ) -Strickler_table_1.SetColor( u"Tissu urbain continu", QColor( 230, 0, 77 ) ) +Strickler_table_1.Set( "Tissu urbain continu", 1.0111 ) +Strickler_table_1.SetAttrValue( "Tissu urbain continu", "111" ) +Strickler_table_1.SetColor( "Tissu urbain continu", QColor( 230, 0, 77 ) ) -Strickler_table_1.Set( u"Chantiers", 1.0133 ) -Strickler_table_1.SetAttrValue( u"Chantiers", "133" ) -Strickler_table_1.SetColor( u"Chantiers", QColor( 255, 77, 255 ) ) +Strickler_table_1.Set( "Chantiers", 1.0133 ) +Strickler_table_1.SetAttrValue( "Chantiers", "133" ) +Strickler_table_1.SetColor( "Chantiers", QColor( 255, 77, 255 ) ) -Strickler_table_1.Set( u"Estuaires", 1.0522 ) -Strickler_table_1.SetAttrValue( u"Estuaires", "522" ) -Strickler_table_1.SetColor( u"Estuaires", QColor( 166, 255, 230 ) ) +Strickler_table_1.Set( "Estuaires", 1.0522 ) +Strickler_table_1.SetAttrValue( "Estuaires", "522" ) +Strickler_table_1.SetColor( "Estuaires", QColor( 166, 255, 230 ) ) -Strickler_table_1.Set( u"Marais maritimes", 1.0421 ) -Strickler_table_1.SetAttrValue( u"Marais maritimes", "421" ) -Strickler_table_1.SetColor( u"Marais maritimes", QColor( 204, 204, 255 ) ) +Strickler_table_1.Set( "Marais maritimes", 1.0421 ) +Strickler_table_1.SetAttrValue( "Marais maritimes", "421" ) +Strickler_table_1.SetColor( "Marais maritimes", QColor( 204, 204, 255 ) ) -Strickler_table_1.Set( u"Forêts de conifères", 1.0312 ) -Strickler_table_1.SetAttrValue( u"Forêts de conifères", "312" ) -Strickler_table_1.SetColor( u"Forêts de conifères", QColor( 0, 166, 0 ) ) +Strickler_table_1.Set( "Forêts de conifères", 1.0312 ) +Strickler_table_1.SetAttrValue( "Forêts de conifères", "312" ) +Strickler_table_1.SetColor( "Forêts de conifères", QColor( 0, 166, 0 ) ) -Strickler_table_1.Set( u"Surfaces essentiellement agricoles, interrompues par des espaces naturels importants", 1.0243 ) -Strickler_table_1.SetAttrValue( u"Surfaces essentiellement agricoles, interrompues par des espaces naturels importants", "243" ) -Strickler_table_1.SetColor( u"Surfaces essentiellement agricoles, interrompues par des espaces naturels importants", QColor( 230, 204, 77 ) ) +Strickler_table_1.Set( "Surfaces essentiellement agricoles, interrompues par des espaces naturels importants", 1.0243 ) +Strickler_table_1.SetAttrValue( "Surfaces essentiellement agricoles, interrompues par des espaces naturels importants", "243" ) +Strickler_table_1.SetColor( "Surfaces essentiellement agricoles, interrompues par des espaces naturels importants", QColor( 230, 204, 77 ) ) -Strickler_table_1.Set( u"Tourbières", 1.0412 ) -Strickler_table_1.SetAttrValue( u"Tourbières", "412" ) -Strickler_table_1.SetColor( u"Tourbières", QColor( 77, 77, 255 ) ) +Strickler_table_1.Set( "Tourbières", 1.0412 ) +Strickler_table_1.SetAttrValue( "Tourbières", "412" ) +Strickler_table_1.SetColor( "Tourbières", QColor( 77, 77, 255 ) ) -Strickler_table_1.Set( u"Extraction de matériaux", 1.0131 ) -Strickler_table_1.SetAttrValue( u"Extraction de matériaux", "131" ) -Strickler_table_1.SetColor( u"Extraction de matériaux", QColor( 166, 0, 204 ) ) +Strickler_table_1.Set( "Extraction de matériaux", 1.0131 ) +Strickler_table_1.SetAttrValue( "Extraction de matériaux", "131" ) +Strickler_table_1.SetColor( "Extraction de matériaux", QColor( 166, 0, 204 ) ) -Strickler_table_1.Set( u"Réseaux routier et ferroviaire et espaces associés", 1.0122 ) -Strickler_table_1.SetAttrValue( u"Réseaux routier et ferroviaire et espaces associés", "122" ) -Strickler_table_1.SetColor( u"Réseaux routier et ferroviaire et espaces associés", QColor( 204, 0, 0 ) ) +Strickler_table_1.Set( "Réseaux routier et ferroviaire et espaces associés", 1.0122 ) +Strickler_table_1.SetAttrValue( "Réseaux routier et ferroviaire et espaces associés", "122" ) +Strickler_table_1.SetColor( "Réseaux routier et ferroviaire et espaces associés", QColor( 204, 0, 0 ) ) -Strickler_table_1.Set( u"Mers et océans", 1.0523 ) -Strickler_table_1.SetAttrValue( u"Mers et océans", "523" ) -Strickler_table_1.SetColor( u"Mers et océans", QColor( 230, 242, 255 ) ) +Strickler_table_1.Set( "Mers et océans", 1.0523 ) +Strickler_table_1.SetAttrValue( "Mers et océans", "523" ) +Strickler_table_1.SetColor( "Mers et océans", QColor( 230, 242, 255 ) ) -Strickler_table_1.Set( u"Equipements sportifs et de loisirs", 1.0142 ) -Strickler_table_1.SetAttrValue( u"Equipements sportifs et de loisirs", "142" ) -Strickler_table_1.SetColor( u"Equipements sportifs et de loisirs", QColor( 255, 230, 255 ) ) +Strickler_table_1.Set( "Equipements sportifs et de loisirs", 1.0142 ) +Strickler_table_1.SetAttrValue( "Equipements sportifs et de loisirs", "142" ) +Strickler_table_1.SetColor( "Equipements sportifs et de loisirs", QColor( 255, 230, 255 ) ) -Strickler_table_1.Set( u"Forêts de feuillus", 1.0311 ) -Strickler_table_1.SetAttrValue( u"Forêts de feuillus", "311" ) -Strickler_table_1.SetColor( u"Forêts de feuillus", QColor( 128, 255, 0 ) ) +Strickler_table_1.Set( "Forêts de feuillus", 1.0311 ) +Strickler_table_1.SetAttrValue( "Forêts de feuillus", "311" ) +Strickler_table_1.SetColor( "Forêts de feuillus", QColor( 128, 255, 0 ) ) -Strickler_table_1.Set( u"Vergers et petits fruits", 1.0222 ) -Strickler_table_1.SetAttrValue( u"Vergers et petits fruits", "222" ) -Strickler_table_1.SetColor( u"Vergers et petits fruits", QColor( 242, 166, 77 ) ) +Strickler_table_1.Set( "Vergers et petits fruits", 1.0222 ) +Strickler_table_1.SetAttrValue( "Vergers et petits fruits", "222" ) +Strickler_table_1.SetColor( "Vergers et petits fruits", QColor( 242, 166, 77 ) ) -Strickler_table_1.Set( u"Végétation sclérophylle", 1.0323 ) -Strickler_table_1.SetAttrValue( u"Végétation sclérophylle", "323" ) -Strickler_table_1.SetColor( u"Végétation sclérophylle", QColor( 166, 230, 77 ) ) +Strickler_table_1.Set( "Végétation sclérophylle", 1.0323 ) +Strickler_table_1.SetAttrValue( "Végétation sclérophylle", "323" ) +Strickler_table_1.SetColor( "Végétation sclérophylle", QColor( 166, 230, 77 ) ) -Strickler_table_1.Set( u"Landes et broussailles", 1.0322 ) -Strickler_table_1.SetAttrValue( u"Landes et broussailles", "322" ) -Strickler_table_1.SetColor( u"Landes et broussailles", QColor( 166, 255, 128 ) ) +Strickler_table_1.Set( "Landes et broussailles", 1.0322 ) +Strickler_table_1.SetAttrValue( "Landes et broussailles", "322" ) +Strickler_table_1.SetColor( "Landes et broussailles", QColor( 166, 255, 128 ) ) -Strickler_table_1.Set( u"Tissu urbain discontinu", 1.0112 ) -Strickler_table_1.SetAttrValue( u"Tissu urbain discontinu", "112" ) -Strickler_table_1.SetColor( u"Tissu urbain discontinu", QColor( 255, 0, 0 ) ) +Strickler_table_1.Set( "Tissu urbain discontinu", 1.0112 ) +Strickler_table_1.SetAttrValue( "Tissu urbain discontinu", "112" ) +Strickler_table_1.SetColor( "Tissu urbain discontinu", QColor( 255, 0, 0 ) ) -Strickler_table_1.Set( u"Cours et voies d'eau", 1.0511 ) -Strickler_table_1.SetAttrValue( u"Cours et voies d'eau", "511" ) -Strickler_table_1.SetColor( u"Cours et voies d'eau", QColor( 0, 204, 242 ) ) +Strickler_table_1.Set( "Cours et voies d'eau", 1.0511 ) +Strickler_table_1.SetAttrValue( "Cours et voies d'eau", "511" ) +Strickler_table_1.SetColor( "Cours et voies d'eau", QColor( 0, 204, 242 ) ) -Strickler_table_1.Set( u"Oliveraies", 1.0223 ) -Strickler_table_1.SetAttrValue( u"Oliveraies", "223" ) -Strickler_table_1.SetColor( u"Oliveraies", QColor( 230, 166, 0 ) ) +Strickler_table_1.Set( "Oliveraies", 1.0223 ) +Strickler_table_1.SetAttrValue( "Oliveraies", "223" ) +Strickler_table_1.SetColor( "Oliveraies", QColor( 230, 166, 0 ) ) -Strickler_table_1.Set( u"Vignobles", 1.0221 ) -Strickler_table_1.SetAttrValue( u"Vignobles", "221" ) -Strickler_table_1.SetColor( u"Vignobles", QColor( 230, 128, 0 ) ) +Strickler_table_1.Set( "Vignobles", 1.0221 ) +Strickler_table_1.SetAttrValue( "Vignobles", "221" ) +Strickler_table_1.SetColor( "Vignobles", QColor( 230, 128, 0 ) ) -Strickler_table_1.Set( u"Rizières", 1.0213 ) -Strickler_table_1.SetAttrValue( u"Rizières", "213" ) -Strickler_table_1.SetColor( u"Rizières", QColor( 230, 230, 0 ) ) +Strickler_table_1.Set( "Rizières", 1.0213 ) +Strickler_table_1.SetAttrValue( "Rizières", "213" ) +Strickler_table_1.SetColor( "Rizières", QColor( 230, 230, 0 ) ) -Strickler_table_1.Set( u"Zones portuaires", 1.0123 ) -Strickler_table_1.SetAttrValue( u"Zones portuaires", "123" ) -Strickler_table_1.SetColor( u"Zones portuaires", QColor( 230, 204, 204 ) ) +Strickler_table_1.Set( "Zones portuaires", 1.0123 ) +Strickler_table_1.SetAttrValue( "Zones portuaires", "123" ) +Strickler_table_1.SetColor( "Zones portuaires", QColor( 230, 204, 204 ) ) -Strickler_table_1.Set( u"Zones industrielles ou commerciales et installations publiques", 1.0121 ) -Strickler_table_1.SetAttrValue( u"Zones industrielles ou commerciales et installations publiques", "121" ) -Strickler_table_1.SetColor( u"Zones industrielles ou commerciales et installations publiques", QColor( 204, 77, 242 ) ) +Strickler_table_1.Set( "Zones industrielles ou commerciales et installations publiques", 1.0121 ) +Strickler_table_1.SetAttrValue( "Zones industrielles ou commerciales et installations publiques", "121" ) +Strickler_table_1.SetColor( "Zones industrielles ou commerciales et installations publiques", QColor( 204, 77, 242 ) ) -Strickler_table_1.Set( u"Marais salants", 1.0422 ) -Strickler_table_1.SetAttrValue( u"Marais salants", "422" ) -Strickler_table_1.SetColor( u"Marais salants", QColor( 230, 230, 255 ) ) +Strickler_table_1.Set( "Marais salants", 1.0422 ) +Strickler_table_1.SetAttrValue( "Marais salants", "422" ) +Strickler_table_1.SetColor( "Marais salants", QColor( 230, 230, 255 ) ) -Strickler_table_1.Set( u"Marais intérieurs", 1.0411 ) -Strickler_table_1.SetAttrValue( u"Marais intérieurs", "411" ) -Strickler_table_1.SetColor( u"Marais intérieurs", QColor( 166, 166, 255 ) ) +Strickler_table_1.Set( "Marais intérieurs", 1.0411 ) +Strickler_table_1.SetAttrValue( "Marais intérieurs", "411" ) +Strickler_table_1.SetColor( "Marais intérieurs", QColor( 166, 166, 255 ) ) -Strickler_table_1.Set( u"Espaces verts urbains", 1.0141 ) -Strickler_table_1.SetAttrValue( u"Espaces verts urbains", "141" ) -Strickler_table_1.SetColor( u"Espaces verts urbains", QColor( 255, 166, 255 ) ) +Strickler_table_1.Set( "Espaces verts urbains", 1.0141 ) +Strickler_table_1.SetAttrValue( "Espaces verts urbains", "141" ) +Strickler_table_1.SetColor( "Espaces verts urbains", QColor( 255, 166, 255 ) ) -Strickler_table_1.Set( u"Lagunes littorales", 1.0521 ) -Strickler_table_1.SetAttrValue( u"Lagunes littorales", "521" ) -Strickler_table_1.SetColor( u"Lagunes littorales", QColor( 0, 255, 166 ) ) +Strickler_table_1.Set( "Lagunes littorales", 1.0521 ) +Strickler_table_1.SetAttrValue( "Lagunes littorales", "521" ) +Strickler_table_1.SetColor( "Lagunes littorales", QColor( 0, 255, 166 ) ) -Strickler_table_1.Set( u"Roches nues", 1.0332 ) -Strickler_table_1.SetAttrValue( u"Roches nues", "332" ) -Strickler_table_1.SetColor( u"Roches nues", QColor( 204, 204, 204 ) ) +Strickler_table_1.Set( "Roches nues", 1.0332 ) +Strickler_table_1.SetAttrValue( "Roches nues", "332" ) +Strickler_table_1.SetColor( "Roches nues", QColor( 204, 204, 204 ) ) -Strickler_table_1.Set( u"Terres arables hors périmètres d'irrigation", 1.0211 ) -Strickler_table_1.SetAttrValue( u"Terres arables hors périmètres d'irrigation", "211" ) -Strickler_table_1.SetColor( u"Terres arables hors périmètres d'irrigation", QColor( 255, 255, 168 ) ) +Strickler_table_1.Set( "Terres arables hors périmètres d'irrigation", 1.0211 ) +Strickler_table_1.SetAttrValue( "Terres arables hors périmètres d'irrigation", "211" ) +Strickler_table_1.SetColor( "Terres arables hors périmètres d'irrigation", QColor( 255, 255, 168 ) ) -Strickler_table_1.Set( u"Zones intertidales", 1.0423 ) -Strickler_table_1.SetAttrValue( u"Zones intertidales", "423" ) -Strickler_table_1.SetColor( u"Zones intertidales", QColor( 166, 166, 230 ) ) +Strickler_table_1.Set( "Zones intertidales", 1.0423 ) +Strickler_table_1.SetAttrValue( "Zones intertidales", "423" ) +Strickler_table_1.SetColor( "Zones intertidales", QColor( 166, 166, 230 ) ) Strickler_table_1.Update() @@ -243,7 +241,7 @@ bathyFlat = hydro_doc.CreateObject( KIND_BATHYMETRY ) bathyFlat.SetName( "bathyFlat" ) bathyFlat.SetAltitudesInverted( 0 ) -if not(bathyFlat.ImportFromFile( "/local00/home/B27118/projets/salome_hydro/bugs/V780H2016/bathyFlat.xyz" )): +if not(bathyFlat.ImportFromFile( os.path.join(HYDRO_SAMPLES, "bathyFlat.xyz" ))): raise ValueError('problem while loading bathymetry') bathyFlat.Update() @@ -252,8 +250,8 @@ profiles = hydro_doc.CreateObject( KIND_PROFILE ) profiles.SetName( "profiles" ) badProfilesIds=[] isToProject=True -nbp = profiles.ImportFromFile(hydro_doc, "/local00/home/B27118/projets/salome_hydro/V780H2016/modules/src/HYDRO/doc/salome/examples/profilsStream.xyz", badProfilesIds, isToProject) -print "nombre profils: " , nbp +nbp = profiles.ImportFromFile(hydro_doc, os.path.join(HYDRO_SAMPLES, "profilsStream.xyz"), badProfilesIds, isToProject) +print("nombre profils: " , nbp) if not(nbp): raise ValueError('problem while loading profiles') #profiles.Update() @@ -284,7 +282,7 @@ Stream_1.SetHydraulicAxis( axe ) for profil in seqProfs: Stream_1.AddProfile(profil) -Stream_1.SetDDZ( 0.200 ) +Stream_1.SetDDZ( 0.050 ) Stream_1.SetSpatialStep( 0.5 ) Stream_1.Update() @@ -313,89 +311,103 @@ Case_1.SetStricklerTable( Strickler_table_1 ) # Start the algorithm of the partition and assignment Case_1.Update() -riveGauche = hydro_doc.FindObjectByName( "Case_1_Reg_1" ) +Reg_riveGauche = hydro_doc.FindObjectByName( "Case_1_Reg_1" ) Case_1_Zone_1 = hydro_doc.FindObjectByName( "Case_1_Zone_1" ) Case_1_Zone_1.SetColor( QColor( 156, 192, 64 )) -riveGauche.AddZone( Case_1_Zone_1 ) -litMineur = hydro_doc.FindObjectByName( "Case_1_Reg_2" ) +Reg_riveGauche.AddZone( Case_1_Zone_1 ) +Reg_litMineur = hydro_doc.FindObjectByName( "Case_1_Reg_2" ) Case_1_Zone_2 = hydro_doc.FindObjectByName( "Case_1_Zone_2" ) Case_1_Zone_2.SetMergeType( HYDROData_Zone.Merge_Object ) Stream_1_Altitude_1 = hydro_doc.FindObjectByName( "Stream_1_Altitude_1" ) Case_1_Zone_2.SetMergeObject( Stream_1_Altitude_1 ) Case_1_Zone_2.SetColor( QColor( 64, 75, 192 )) -litMineur.AddZone( Case_1_Zone_2 ) -riveDroite = hydro_doc.FindObjectByName( "Case_1_Reg_3" ) +Reg_litMineur.AddZone( Case_1_Zone_2 ) +Reg_riveDroite = hydro_doc.FindObjectByName( "Case_1_Reg_3" ) Case_1_Zone_3 = hydro_doc.FindObjectByName( "Case_1_Zone_3" ) Case_1_Zone_3.SetColor( QColor( 192, 109, 64 )) -riveDroite.AddZone( Case_1_Zone_3 ) -riveGauche.SetName( "riveGauche" ) -litMineur.SetName( "litMineur" ) -riveDroite.SetName( "riveDroite" ) +Reg_riveDroite.AddZone( Case_1_Zone_3 ) +Reg_riveGauche.SetName( "Reg_riveGauche" ) +Reg_litMineur.SetName( "Reg_litMineur" ) +Reg_riveDroite.SetName( "Reg_riveDroite" ) # Export of the calculation case -Case_1_entry = Case_1.Export( theStudy._get_StudyId() ) - -# Get geometry shape and print debug information -import GEOM -print "Entry:", Case_1_entry -HYDRO_Case_1 = salome.IDToObject( str( Case_1_entry ) ) -print "Geom shape:", HYDRO_Case_1 -print "Geom shape name:", HYDRO_Case_1.GetName() +Case_1_entry = Case_1.Export() - -### -### GEOM component -### +#---------------------- +# --- Geometry +#---------------------- import GEOM from salome.geom import geomBuilder import math import SALOMEDS +from salome.hydrotools.controls import controlGeomProps +# Get geometry shape and print debug information +print("Entry:", Case_1_entry) +HYDRO_Case_1 = salome.IDToObject( str( Case_1_entry ) ) +print("Geom shape:", HYDRO_Case_1) +print("Geom shape name:", HYDRO_Case_1.GetName()) -geompy = geomBuilder.New(theStudy) +geompy = geomBuilder.New() -#geomObj_1 = geompy.RestoreShape("") # the shape string has not been dump for performance reason -#[geomObj_2,geomObj_3,geomObj_4] = geompy.SubShapeAll(geomObj_1, geompy.ShapeType["FACE"]) -geomObj_5 = geompy.CreateGroup(geomObj_1, geompy.ShapeType["EDGE"]) -geompy.UnionIDs(geomObj_5, [4, 12, 19, 23, 25, 21, 14, 9]) -HYDRO_Case_1 = geompy.RestoreShape("") # the shape string has not been dump for performance reason +# --- manual definition: geometrical faces [riveGauche,litMineur,riveDroite] = geompy.SubShapeAll(HYDRO_Case_1, geompy.ShapeType["FACE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["VERTEX"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["VERTEX"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -#listSubShapeIDs = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) + +# --- manual definition: useful groups of edges Case_1_plaine_Outer = geompy.CreateGroup(HYDRO_Case_1, geompy.ShapeType["EDGE"]) geompy.UnionIDs(Case_1_plaine_Outer, [4, 12, 19, 23, 25, 21, 14, 9]) + +# --- manual identification of all useful edge groups (boundary conditions) + +allEdgesIds = geompy.SubShapeAllIDs(HYDRO_Case_1, geompy.ShapeType["EDGE"]) +print("allEdgesIds", allEdgesIds) + +(isDone, ClosedFreeBoundary, OpenFreeBoundary) = geompy.GetFreeBoundary(HYDRO_Case_1) +geompy.addToStudyInFather(HYDRO_Case_1, ClosedFreeBoundary[0], "ClosedFreeBoundary") + +freeBoundary = geompy.ExtractShapes(ClosedFreeBoundary[0], geompy.ShapeType["EDGE"], True) +freeBoundaryIds = [ geompy.GetSubShapeID(HYDRO_Case_1, freeBoundary[i]) for i in range(len(freeBoundary)) ] +print("freeBoundaryIds", freeBoundaryIds) + +edges_litMineur = geompy.GetSharedShapesMulti([HYDRO_Case_1, litMineur], geompy.ShapeType["EDGE"], True) +edges_litMineurIds = [ geompy.GetSubShapeID(HYDRO_Case_1, edges_litMineur[i]) for i in range(len(edges_litMineur)) ] +sectionsIds = [Id for Id in edges_litMineurIds if Id in freeBoundaryIds] +print("sectionsIds", sectionsIds) sections = geompy.CreateGroup(HYDRO_Case_1, geompy.ShapeType["EDGE"]) -geompy.UnionIDs(sections, [14, 12]) -geompy.addToStudy( HYDRO_Case_1, 'HYDRO_Case_1' ) +geompy.UnionIDs(sections, sectionsIds) + +# --- publish in study geompy.addToStudyInFather( HYDRO_Case_1, riveGauche, 'riveGauche' ) geompy.addToStudyInFather( HYDRO_Case_1, litMineur, 'litMineur' ) geompy.addToStudyInFather( HYDRO_Case_1, riveDroite, 'riveDroite' ) -geompy.addToStudyInFather( HYDRO_Case_1, Case_1_plaine_Outer, 'Case_1_plaine_Outer' ) geompy.addToStudyInFather( HYDRO_Case_1, sections, 'sections' ) -### -### SMESH component -### +# --- basic properties control: edges length, surfaces + +controlGeomProps(geompy, riveGauche, 355.239855, 7755.628676) +controlGeomProps(geompy, litMineur, 383.395884, 3432.296956) +controlGeomProps(geompy, riveDroite, 419.214176, 2537.363869) + +#---------------------- +# --- Meshing +#---------------------- + +med_file = r'/tmp/plaine.med' +try: + os.remove(med_file) +except OSError: + pass import SMESH, SALOMEDS from salome.smesh import smeshBuilder +from salome.hydrotools.controls import controlMeshStats, controlSubMeshStats -smesh = smeshBuilder.New(theStudy) +smesh = smeshBuilder.New() + +# --- algorithms and hypothesis plaine = smesh.Mesh(HYDRO_Case_1) + NETGEN_2D = plaine.Triangle(algo=smeshBuilder.NETGEN_1D2D) NETGEN_2D_Parameters_1 = NETGEN_2D.Parameters() NETGEN_2D_Parameters_1.SetMaxSize( 10 ) @@ -406,45 +418,60 @@ NETGEN_2D_Parameters_1.SetMinSize( 1 ) NETGEN_2D_Parameters_1.SetUseSurfaceCurvature( 1 ) NETGEN_2D_Parameters_1.SetFuseEdges( 1 ) NETGEN_2D_Parameters_1.SetQuadAllowed( 0 ) -Regular_1D = plaine.Segment(geom=litMineur) -litMineur_1 = Regular_1D.GetSubMesh() -Local_Length_1 = Regular_1D.LocalLength(3,None,1e-07) -QuadFromMedialAxis_1D2D = plaine.Quadrangle(algo=smeshBuilder.QUAD_MA_PROJ,geom=litMineur) -Regular_1D_1 = plaine.Segment(geom=sections) -sections_1 = Regular_1D_1.GetSubMesh() -Nb_Segments_1 = Regular_1D_1.NumberOfSegments(20) -isDone = plaine.SetMeshOrder( [ [ sections_1, litMineur_1 ] ]) +algo2D_litMineur = plaine.Quadrangle(algo=smeshBuilder.QUADRANGLE,geom=litMineur) +algo1D_litMineur = plaine.Segment(geom=litMineur) +hypo1D_litMineur = algo1D_litMineur.NumberOfSegments(60) +subMesh_litMineur = algo1D_litMineur.GetSubMesh() +smesh.SetName(subMesh_litMineur, "litMineur") + +algo1D_sections = plaine.Segment(geom=sections) +hypo1D_sections = algo1D_sections.NumberOfSegments(20) +hypo1D_sections.SetDistrType( 0 ) +subMesh_sections = algo1D_sections.GetSubMesh() +smesh.SetName(subMesh_sections, "sections") + +isDone = plaine.SetMeshOrder( [ [ subMesh_sections, subMesh_litMineur ] ]) + +# --- compute mesh isDone = plaine.Compute() isDone = plaine.SplitQuadObject( plaine, 1 ) +isDone = plaine.ReorientObject( plaine ) +# --- geometrical groups of faces riveGauche_1 = plaine.GroupOnGeom(riveGauche,'riveGauche',SMESH.FACE) litMineur_2 = plaine.GroupOnGeom(litMineur,'litMineur',SMESH.FACE) riveDroite_1 = plaine.GroupOnGeom(riveDroite,'riveDroite',SMESH.FACE) + +# --- geometrical groups of edges Case_1_plaine_Outer_1 = plaine.GroupOnGeom(Case_1_plaine_Outer,'Case_1_plaine_Outer',SMESH.EDGE) sections_2 = plaine.GroupOnGeom(sections,'sections',SMESH.EDGE) + +# --- geometrical groups of nodes riveGauche_2 = plaine.GroupOnGeom(riveGauche,'riveGauche',SMESH.NODE) litMineur_3 = plaine.GroupOnGeom(litMineur,'litMineur',SMESH.NODE) riveDroite_2 = plaine.GroupOnGeom(riveDroite,'riveDroite',SMESH.NODE) Case_1_plaine_Outer_2 = plaine.GroupOnGeom(Case_1_plaine_Outer,'Case_1_plaine_Outer',SMESH.NODE) sections_3 = plaine.GroupOnGeom(sections,'sections',SMESH.NODE) + smesh.SetName(plaine, 'plaine') +plaine.SetAutoColor( 1 ) try: - plaine.ExportMED( r'/local00/home/B27118/projets/salome_hydro/bugs/V780H2016/plaine.med', 0, SMESH.MED_V2_2, 1, None ,1) + plaine.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) except: - print 'ExportToMEDX() failed. Invalid file name?' + print('ExportToMEDX() failed. Invalid file name?') -#controlMeshStats(plaine, 6190, 691, 12201) -#controlSubMeshStats(litMineur_2, 2384) -#controlSubMeshStats(riveDroite_1, 2400) -#controlSubMeshStats(riveGauche_1, 6585) +controlMeshStats(plaine, 1680, 227, 3251) +controlSubMeshStats(litMineur_2, 2400) +controlSubMeshStats(riveDroite_1, 257) +controlSubMeshStats(riveGauche_1, 580) #---------------------- # --- Z interpolation with HYDRO #---------------------- -from salome.hydrotools.interpolZ import interpolZ, createZfield2 +from salome.hydrotools.interpolZ import interpolZ from salome.hydrotools.controls import controlStatZ # --- case name in HYDRO @@ -454,22 +481,29 @@ nomCas = 'Case_1' fichierMaillage = med_file # --- dictionary [med group name] = region name -dicoGroupeRegion= dict(litMineur = 'litMineur', - riveDroite = 'riveDroite', - riveGauche = 'riveGauche', +dicoGroupeRegion= dict(litMineur = 'Reg_litMineur', + riveDroite = 'Reg_riveDroite', + riveGauche = 'Reg_riveGauche', ) # --- value to use for Z when the node is not in a region (used to detect problems) zUndef = 110 +# --- interpolation Method: 0 = nearest point on bathymetry (default), 1 = linear interpolation +interpolMethod = 0 +# --- produce a 3D mesh (Z set to its value instead of 0 +m3d = True # --- Z interpolation on the bathymety/altimetry on the mesh nodes -statz = interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef) -refstatz = {'riveDroite': (10.88, 32.47999954), 'riveGauche': (7.72, 71.38999939), 'litMineur': (2.06, 25.41)} +statz = interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef, interpolMethod, m3d) +#print statz +refstatz = {'riveDroite': (100.0, 100.0, 100.0, 0.0, 100.0, 100.0), + 'riveGauche': (100.0, 100.0, 100.0, 0.0, 100.0, 100.0), + 'litMineur': (80.35, 100.0, 92.88, 4.82, 84.44, 100.0)} controlStatZ(statz, refstatz) # --- add a field on nodes of type double with z values, named "BOTTOM" -createZfield2(fichierMaillage) +#createZfield2(fichierMaillage) if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(1) + salome.sg.updateObjBrowser()