]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
First pack of fixes
authorakl <akl@opencascade.com>
Thu, 13 Mar 2014 13:29:04 +0000 (17:29 +0400)
committerakl <akl@opencascade.com>
Thu, 13 Mar 2014 13:29:04 +0000 (17:29 +0400)
21 files changed:
src/PV_SWIG/VTKWrapping/presentations.py
src/Plugins/MEDReader/CMakeLists.txt
src/Plugins/MEDReader/Test/CMakeLists.txt
test/VisuPrs/2D_viewer/A0.py
test/VisuPrs/2D_viewer/A1.py
test/VisuPrs/3D_viewer/A1.py
test/VisuPrs/3D_viewer/B0.py
test/VisuPrs/bugs/A0.py
test/VisuPrs/bugs/A1.py
test/VisuPrs/bugs/A2.py
test/VisuPrs/bugs/A6.py
test/VisuPrs/bugs/A7.py
test/VisuPrs/bugs/A9.py
test/VisuPrs/bugs/B1.py
test/VisuPrs/bugs/C3.py
test/VisuPrs/bugs/C4.py
test/VisuPrs/bugs/C6.py
test/VisuPrs/bugs/C7.py
test/VisuPrs/bugs/D0.py
test/VisuPrs/bugs/D1.py
test/VisuPrs/imps/A1.py

index fb5c7584d40c3215eedf8d1cd28c0ee8f84e8916..5fb0117d791cc7fd13b27865a6886c77f1c700c0 100644 (file)
@@ -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
index 299f1cd39a3ccfe921abc1c88a6f01511eac71c1..130e508d3a35238be80fdb08f516ead50b24739b 100644 (file)
@@ -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.
index db1ddd5055e082975c23e7b44051f5b6b1e8f77d..96afce8fe60024759d4e89681cb82b2ed78c8172 100644 (file)
 # 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}")
index adeebd65315ae64464e0b2e2a9b8cc68d0862b1f..c7c1100ec3ba914c3681c2c1a150d6d3cf8f781a 100755 (executable)
@@ -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]
 
index a22d0903f6daee800ac84a5f164941655c4ecb91..9a4004a471f747926e53758a2b9bc8f9b02b1f8e 100755 (executable)
@@ -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]
index fe15dc5dabca4186bfad09c4b10c497acce1de81..3591563f7935f9f60565f33862fcddbc12d21882 100644 (file)
@@ -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...")
 
index ccedd8801516edb84310bccccbf791f6456878f3..100e89eb91cbc01efd3bf213d22cf95c40d1a043 100644 (file)
@@ -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...")
 
index d5252947f833ad86f114b1b22341b49743ec8da3..cdc3922a66197083ba6c191a69db0ea3a450a5a8 100644 (file)
@@ -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"...',
index 6dbb7472864f4ecb6a3511c52ec43a6a8094a8dc..a245df79249878a945281168b20a55fa15900484 100644 (file)
@@ -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)
index a1d5c358027d1c482dd185f4fd4766dd677dbcdd..5d8cbee332f1382ae6753e5d32282b1bf12eeabd 100644 (file)
@@ -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)
index 16543b79781b69c950926f8277f66cb50f25d383..1b93507faef4978262d94edc63baf64f32b67101 100644 (file)
@@ -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"
 
index e815177459723bb232e102246f40f0d866dd2339..3be25493f6e216d0426329148726610d7c9cb37c 100644 (file)
@@ -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)
index 5adb3367931631e42a481e260d4bebd62cec5d8a..6e1000eed15bfc4e0aa2584d8a82b094700d8563 100644 (file)
@@ -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"
index 8c859245c785401ddd3da82d26a24d1aa9cb4bd7..ea6674715aabd9a0892cdfd7b74ae61fb24e42ec 100644 (file)
@@ -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"
index 4785f09f1c130e536e82159fa454488862c626c7..6843eca4e20577e050d40c0085781f747df21192 100644 (file)
@@ -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"
 
index 96216c73788727922b5f00a668a3124ee6c0fc39..c5b19279090579785a9a97f538d9035c6fa8b066 100644 (file)
@@ -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"
index 97dfbee3c6ed8a69ffbe7f1ddebd8cbdce314604..4dcc37485749aef4306a041cbf2d4435a866fce8 100644 (file)
@@ -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"
index b55d346ee4134d64bdd20b8156be2f7179a138a0..4e2feead93b22dd13da07a3ff587cfce785f70c2 100644 (file)
@@ -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"
index 3c1240d0e47c0eca99c105b3f75e4a8b0249afd6..d4f9ce05f3e669b2e67e2cb53f81aacefb489a0a 100644 (file)
@@ -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):
index 34343dd98a4ab6f7708c4bf10320952845668d2a..6ef39bf8ec0b261fcda5ecd5473a90fc28d83736 100644 (file)
@@ -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"
index 17e8808edd25bd9216d5fc451a95c2927d41ebf6..0c4bf3529ebe08a1903fcd39ccc34bb934ccbdb5 100644 (file)
@@ -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):