From: akl Date: Thu, 13 Mar 2014 13:29:04 +0000 (+0400) Subject: First pack of fixes X-Git-Tag: V7_4_0a1~2^2~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=05195b07e927e73c5a20c4ef81431695332410c1;p=modules%2Fparavis.git First pack of fixes --- diff --git a/src/PV_SWIG/VTKWrapping/presentations.py b/src/PV_SWIG/VTKWrapping/presentations.py index fb5c7584..5fb0117d 100644 --- a/src/PV_SWIG/VTKWrapping/presentations.py +++ b/src/PV_SWIG/VTKWrapping/presentations.py @@ -724,11 +724,8 @@ def select_all_cells(proxy): Used in creation of mesh/submesh presentation. """ - ### Old API all_cell_types = proxy.CellTypes.Available - all_cell_types = proxy.Entity.Available - ### Old API proxy.CellTypes = all_cell_types - proxy.Entity = all_cell_types - proxy.UpdatePipeline() + extractCT = pv.ExtractCellType() + extractCT.AllGeoTypes = extractCT.GetProperty("GeoTypesInfo")[::2] def select_cells_with_data(proxy, on_points=None, on_cells=None): @@ -2424,8 +2421,7 @@ def CreatePrsForFile(paravis_instance, file_name, prs_types, print "Import " + file_name.split(os.sep)[-1] + "..." try: - paravis_instance.ImportFile(file_name) - proxy = pv.GetActiveSource() + proxy = pv.MEDReader(FileName=file_name) if proxy is None: print "FAILED" else: @@ -2441,6 +2437,25 @@ def CreatePrsForFile(paravis_instance, file_name, prs_types, CreatePrsForProxy(proxy, view, prs_types, picture_dir, picture_ext) +def GetFieldsInfo(proxy): + """Extracts names of fields from tree info. + """ + fields_info = proxy.GetProperty("FieldsTreeInfo") + print fields_info + keys = [fields_info[::2][i] for i in range(len(fields_info[::2])) if fields_info[1::2][i]!='0'] + print keys + # list all the names of arrays that can be seen (including their spatial discretization) + arr_names_with_dis = [elt.split("/")[-1] for elt in keys] + # split items by spatial discretization (point or cell) + # and put (field_name, field_path) pairs into corresponding dictionaries + points_dict = dict(); cells_dict = dict() + for (i, elt) in enumerate(arr_names_with_dis): + arr_item = elt.split(proxy.GetProperty("Separator").GetData()) + if arr_item[1] == 'P0': + cells_dict[arr_item[0]] = keys[i] + elif arr_item[1] == 'P1': + points_dict[arr_item[0]] = keys[i] + return points_dict, cells_dict def CreatePrsForProxy(proxy, view, prs_types, picture_dir, picture_ext): """Build presentations of the given types for all fields of the proxy. @@ -2457,9 +2472,16 @@ def CreatePrsForProxy(proxy, view, prs_types, picture_dir, picture_ext): """ # List of the field names - field_names = list(proxy.PointArrays.GetData()) + point_fields, cell_fields = GetFieldsInfo(proxy) + print 'point_fields: ', point_fields + print 'cell_fields: ', cell_fields + field_names = list(point_fields.keys()) nb_on_nodes = len(field_names) - field_names.extend(proxy.CellArrays.GetData()) + field_names.extend(cell_fields.keys()) + print 'field_names: ', field_names + field_paths = list(point_fields.values()) + field_paths.extend(cell_fields.values()) + print 'field_paths: ', field_paths # Add path separator to the end of picture path if necessery if not picture_dir.endswith(os.sep): @@ -2469,8 +2491,10 @@ def CreatePrsForProxy(proxy, view, prs_types, picture_dir, picture_ext): if PrsTypeEnum.MESH in prs_types: # Create Mesh presentation. Build all possible submeshes. + extGrp=pv.ExtractGroup() + # Remember the current state - groups = list(proxy.Groups) + groups = filter(lambda x:x[:4]=="GRP_",list(extGrp.GetProperty("GroupsFlagsInfo")[::2])) # Iterate on meshes mesh_names = get_mesh_names(proxy) @@ -2510,32 +2534,28 @@ def CreatePrsForProxy(proxy, view, prs_types, picture_dir, picture_ext): process_prs_for_test(prs, view, pic_name, False) # Restore the state - proxy.Groups = groups - proxy.UpdatePipeline() + extGrp.AllGroups = groups + extGrp.UpdatePipelineInformation() # Presentations on fields for (i, field_name) in enumerate(field_names): # Select only the current field: # necessary for getting the right timestamps - cell_arrays = proxy.CellArrays.GetData() - point_arrays = proxy.PointArrays.GetData() field_entity = None if (i >= nb_on_nodes): field_entity = EntityType.CELL - proxy.PointArrays.DeselectAll() - proxy.CellArrays = [field_name] + proxy.AllArrays = [cell_fields[field_name]] else: field_entity = EntityType.NODE - proxy.CellArrays.DeselectAll() - proxy.PointArrays = [field_name] + proxy.AllArrays = [point_fields[field_name]] # Get timestamps proxy.UpdatePipelineInformation() timestamps = proxy.TimestepValues.GetData() + print timestamps # Restore fields selection state - proxy.CellArrays = cell_arrays - proxy.PointArrays = point_arrays + proxy.AllArrays = field_paths proxy.UpdatePipelineInformation() for prs_type in prs_types: @@ -2569,3 +2589,4 @@ def CreatePrsForProxy(proxy, view, prs_types, picture_dir, picture_ext): # Show and dump the presentation into a graphics file process_prs_for_test(prs, view, pic_name) + return diff --git a/src/Plugins/MEDReader/CMakeLists.txt b/src/Plugins/MEDReader/CMakeLists.txt index 299f1cd3..130e508d 100644 --- a/src/Plugins/MEDReader/CMakeLists.txt +++ b/src/Plugins/MEDReader/CMakeLists.txt @@ -75,8 +75,14 @@ INCLUDE(SalomeSetupPlatform) INCLUDE(SalomeMEDConfig) FIND_PACKAGE(SalomePython REQUIRED) FIND_PACKAGE(SalomeHDF5 REQUIRED) +FIND_PACKAGE(SalomeMED REQUIRED) FIND_PACKAGE(SalomeMEDFile REQUIRED) +# Accumulate environment variables for PARAVIS module +SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS} + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}) +SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS}) + # # process all vtk-modules defined in this plugin. This generates the necessary # wrappings for all these modules as well. diff --git a/src/Plugins/MEDReader/Test/CMakeLists.txt b/src/Plugins/MEDReader/Test/CMakeLists.txt index db1ddd50..96afce8f 100644 --- a/src/Plugins/MEDReader/Test/CMakeLists.txt +++ b/src/Plugins/MEDReader/Test/CMakeLists.txt @@ -17,12 +17,22 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) ADD_TEST(testMEDReader0 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader0.py) +SET_TESTS_PROPERTIES(testMEDReader0 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(testMEDReader1 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader1.py) +SET_TESTS_PROPERTIES(testMEDReader1 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(testMEDReader2 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader2.py) +SET_TESTS_PROPERTIES(testMEDReader2 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(testMEDReader3 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader3.py) +SET_TESTS_PROPERTIES(testMEDReader3 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(testMEDReader4 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader4.py) +SET_TESTS_PROPERTIES(testMEDReader4 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(testMEDReader5 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader5.py) +SET_TESTS_PROPERTIES(testMEDReader5 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(testMEDReader6 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader6.py) +SET_TESTS_PROPERTIES(testMEDReader6 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(testMEDReader7 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader7.py) +SET_TESTS_PROPERTIES(testMEDReader7 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(testMEDReader8 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader8.py) +SET_TESTS_PROPERTIES(testMEDReader8 PROPERTIES ENVIRONMENT "${tests_env}") diff --git a/test/VisuPrs/2D_viewer/A0.py b/test/VisuPrs/2D_viewer/A0.py index adeebd65..c7c1100e 100755 --- a/test/VisuPrs/2D_viewer/A0.py +++ b/test/VisuPrs/2D_viewer/A0.py @@ -37,11 +37,6 @@ aXYPlot.ChartTitle = 'title of XY plot' print "Chart title for xyplot ...", aXYPlot.ChartTitle error = 0 -try: - aXYPlot.ShowAxis = [1, 1, 0, 0] -except: - print "Error: ShowAxis property is not avaliable for XYPlotView" - error = error + 1 aXYPlot.AxisUseCustomRange = [1, 1, 0, 0] diff --git a/test/VisuPrs/2D_viewer/A1.py b/test/VisuPrs/2D_viewer/A1.py index a22d0903..9a4004a4 100755 --- a/test/VisuPrs/2D_viewer/A1.py +++ b/test/VisuPrs/2D_viewer/A1.py @@ -48,13 +48,6 @@ Ranges=aXYPlot.LeftAxisRange error = error + test_values(Ranges, Etvalue[0:2]) Ranges=aXYPlot.BottomAxisRange error = error + test_values(Ranges, Etvalue[2:4]) - -try: - aXYPlot.ShowAxis = [1, 1, 1, 1] -except: - print "Error: ShowAxis property is not avaliable for XYPlotView" - error = error + 1 - aXYPlot.AxisUseCustomRange = [1, 1, 1, 1] # Left, bottom, right and top axis range aXYPlot.LeftAxisRange = [0, 200] diff --git a/test/VisuPrs/3D_viewer/A1.py b/test/VisuPrs/3D_viewer/A1.py index fe15dc5d..3591563f 100644 --- a/test/VisuPrs/3D_viewer/A1.py +++ b/test/VisuPrs/3D_viewer/A1.py @@ -68,7 +68,7 @@ field_name = 'VITESSE' my_view = GetRenderView() print "\nCreating plot3d.......", -plot3d = Plot3DOnField(proxy, EntityType.CELL, field_name, 1) +plot3d = Plot3DOnField(proxy, EntityType.NODE, field_name, 1) if plot3d is None: raise RuntimeError("Error!!! Presentation wasn't created...") diff --git a/test/VisuPrs/3D_viewer/B0.py b/test/VisuPrs/3D_viewer/B0.py index ccedd880..100e89eb 100644 --- a/test/VisuPrs/3D_viewer/B0.py +++ b/test/VisuPrs/3D_viewer/B0.py @@ -67,7 +67,7 @@ shrinked_sm = None field_name = 'VITESSE' print "\nCreating scalar map.......", -scalar_map = ScalarMapOnField(proxy, EntityType.CELL, field_name, 1) +scalar_map = ScalarMapOnField(proxy, EntityType.NODE, field_name, 1) if scalar_map is None: raise RuntimeError("Error!!! Presentation wasn't created...") diff --git a/test/VisuPrs/bugs/A0.py b/test/VisuPrs/bugs/A0.py index d5252947..cdc3922a 100644 --- a/test/VisuPrs/bugs/A0.py +++ b/test/VisuPrs/bugs/A0.py @@ -27,7 +27,8 @@ import paravis import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/A0") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/A0") # 1. Import MED file print 'Importing "hydro_sea_alv.med"...', diff --git a/test/VisuPrs/bugs/A1.py b/test/VisuPrs/bugs/A1.py index 6dbb7472..a245df79 100644 --- a/test/VisuPrs/bugs/A1.py +++ b/test/VisuPrs/bugs/A1.py @@ -28,7 +28,8 @@ import paravis import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/A1") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/A1") med_file_path = datadir + "fra1.med" pic_path = os.path.join(picturedir, "A1." + pictureext) diff --git a/test/VisuPrs/bugs/A2.py b/test/VisuPrs/bugs/A2.py index a1d5c358..5d8cbee3 100644 --- a/test/VisuPrs/bugs/A2.py +++ b/test/VisuPrs/bugs/A2.py @@ -28,7 +28,8 @@ import paravis import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/A2") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/A2") med_file_path = datadir + "carre_MIXTE_0000_v3.0.6.med" pic_path = os.path.join(picturedir, "A2." + pictureext) diff --git a/test/VisuPrs/bugs/A6.py b/test/VisuPrs/bugs/A6.py index 16543b79..1b93507f 100644 --- a/test/VisuPrs/bugs/A6.py +++ b/test/VisuPrs/bugs/A6.py @@ -27,7 +27,8 @@ import paravis import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/A6") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/A6") med_file_path = datadir + "fra.med" diff --git a/test/VisuPrs/bugs/A7.py b/test/VisuPrs/bugs/A7.py index e8151774..3be25493 100644 --- a/test/VisuPrs/bugs/A7.py +++ b/test/VisuPrs/bugs/A7.py @@ -25,7 +25,8 @@ from presentations import CreatePrsForFile, PrsTypeEnum import paravis my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/A7") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/A7") med_file_path = datadir + "hexa_28320_ELEM.med" CreatePrsForFile(my_paravis, med_file_path, [PrsTypeEnum.MESH], picturedir, pictureext) diff --git a/test/VisuPrs/bugs/A9.py b/test/VisuPrs/bugs/A9.py index 5adb3367..6e1000ee 100644 --- a/test/VisuPrs/bugs/A9.py +++ b/test/VisuPrs/bugs/A9.py @@ -29,7 +29,8 @@ import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/A9") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/A9") # 1. Step1: Import MED file print "**** Step1: Importing MED file" diff --git a/test/VisuPrs/bugs/B1.py b/test/VisuPrs/bugs/B1.py index 8c859245..ea667471 100644 --- a/test/VisuPrs/bugs/B1.py +++ b/test/VisuPrs/bugs/B1.py @@ -27,7 +27,8 @@ import paravis import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/B1") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/B1") # 1. Import MED file med_file_path = datadir + "resultat.01.med" diff --git a/test/VisuPrs/bugs/C3.py b/test/VisuPrs/bugs/C3.py index 4785f09f..6843eca4 100644 --- a/test/VisuPrs/bugs/C3.py +++ b/test/VisuPrs/bugs/C3.py @@ -34,7 +34,7 @@ my_paravis.ImportFile(med_file_path) med_reader = pvsimple.GetActiveSource() if med_reader is None: - print "FAILED" + raise RuntimeError, "MEDfileForStructuredMesh.med was not imported!" else: print "OK" diff --git a/test/VisuPrs/bugs/C4.py b/test/VisuPrs/bugs/C4.py index 96216c73..c5b19279 100644 --- a/test/VisuPrs/bugs/C4.py +++ b/test/VisuPrs/bugs/C4.py @@ -27,7 +27,8 @@ import paravis import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/C4") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/C4") # 1. Import MED file med_file_path = datadir + "forma01f.resu.med" diff --git a/test/VisuPrs/bugs/C6.py b/test/VisuPrs/bugs/C6.py index 97dfbee3..4dcc3748 100644 --- a/test/VisuPrs/bugs/C6.py +++ b/test/VisuPrs/bugs/C6.py @@ -27,7 +27,8 @@ import paravis import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/C6") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/C6") # 1. Import MED file med_file_path = datadir + "relachement_brutal_sans_dudg_gauss.med" diff --git a/test/VisuPrs/bugs/C7.py b/test/VisuPrs/bugs/C7.py index b55d346e..4e2feead 100644 --- a/test/VisuPrs/bugs/C7.py +++ b/test/VisuPrs/bugs/C7.py @@ -27,7 +27,8 @@ import paravis import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/C7") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/C7") # 1. Import MED file med_file_path = datadir + "Bug583-Quadratique.resu.med" diff --git a/test/VisuPrs/bugs/D0.py b/test/VisuPrs/bugs/D0.py index 3c1240d0..d4f9ce05 100644 --- a/test/VisuPrs/bugs/D0.py +++ b/test/VisuPrs/bugs/D0.py @@ -28,7 +28,8 @@ import paravis import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/D0") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/D0") # Aux method def get_group_full_name(source, group_name): diff --git a/test/VisuPrs/bugs/D1.py b/test/VisuPrs/bugs/D1.py index 34343dd9..6ef39bf8 100644 --- a/test/VisuPrs/bugs/D1.py +++ b/test/VisuPrs/bugs/D1.py @@ -27,7 +27,8 @@ import paravis import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "bugs/D1") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("bugs/D1") # 1. Import of the "Bug829_resu_mode.med" file at first time med_file_path = datadir + "Bug829_resu_mode.med" diff --git a/test/VisuPrs/imps/A1.py b/test/VisuPrs/imps/A1.py index 17e8808e..0c4bf352 100644 --- a/test/VisuPrs/imps/A1.py +++ b/test/VisuPrs/imps/A1.py @@ -27,7 +27,8 @@ import paravis import pvsimple my_paravis = paravis.myParavis -picturedir = get_picture_dir(sys.argv[1], "imps/A1") +os.environ["PARAVIS_TEST_PICS"] = sys.argv[1] +picturedir = get_picture_dir("imps/A1") def set_prs_colored(prs, proxy, entity, field_name, vector_mode, timestamp_nb):