]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
GaussPoints modification
authorvtn <vtn@opencascade.com>
Fri, 21 Mar 2014 12:45:33 +0000 (16:45 +0400)
committervtn <vtn@opencascade.com>
Fri, 21 Mar 2014 12:45:33 +0000 (16:45 +0400)
14 files changed:
src/PV_SWIG/VTKWrapping/presentations.py
test/VisuPrs/GaussPoints/A3.py
test/VisuPrs/GaussPoints/A4.py
test/VisuPrs/GaussPoints/A5.py
test/VisuPrs/GaussPoints/A6.py
test/VisuPrs/GaussPoints/A7.py
test/VisuPrs/GaussPoints/B7.py
test/VisuPrs/GaussPoints/C1.py
test/VisuPrs/GaussPoints/C3.py
test/VisuPrs/GaussPoints/C4.py
test/VisuPrs/GaussPoints/C6.py
test/VisuPrs/GaussPoints/C7.py
test/VisuPrs/GaussPoints/C8.py
test/VisuPrs/imps/A6.py

index 7c62380a5772be1c3dbc4e241b08a363db91e077..6042b90c452121000c8dd972fab3630a1527e064 100644 (file)
@@ -763,7 +763,7 @@ def select_all_cells(proxy):
     extractCT.AllGeoTypes = extractCT.GetProperty("GeoTypesInfo")[::2]
 
 
-def select_cells_with_data(proxy, on_points=None, on_cells=None):
+def select_cells_with_data(proxy, on_points=[], on_cells=[], on_gauss=[]):
     """Select cell types with data.
 
     Only cell types with data for the given fields will be selected.
@@ -772,7 +772,32 @@ def select_cells_with_data(proxy, on_points=None, on_cells=None):
 
     """
     if not hasattr(proxy, 'Entity'):
-        return
+        separator = proxy.GetProperty("Separator").GetData()
+
+        fields_info = proxy.GetProperty("FieldsTreeInfo")[::2]
+        arr_name_with_dis=[elt.split("/")[-1] for elt in fields_info]
+
+        proxy.AllArrays = []
+        
+        fields = []
+        for name in on_gauss:
+            fields.append(name+separator+'GAUSS')
+        for name in on_cells:
+            fields.append(name+separator+'P0')
+        for name in on_points:
+            fields.append(name+separator+'P1')
+
+        field_list = []
+        for name in fields:
+            if arr_name_with_dis.count(name) > 0:
+                index = arr_name_with_dis.index(name)
+                field_list.append(fields_info[index])
+                
+        proxy.AllArrays = field_list
+        proxy.UpdatePipeline()
+        return len(field_list) != 0
+
+    # TODO: VTN. Looks like this code is out of date.
     
     #all_cell_types = proxy.CellTypes.Available
     all_cell_types = proxy.Entity.Available
@@ -1106,6 +1131,11 @@ def CutPlanesOnField(proxy, entity, field_name, timestamp_nb,
       Cut Planes as representation object.
 
     """
+    if entity == EntityType.NODE:
+        select_cells_with_data(proxy, on_points=[field_name])
+    else:
+        select_cells_with_data(proxy, on_cells=[field_name])
+
     # Check vector mode
     nb_components = get_nb_components(proxy, entity, field_name)
     check_vector_mode(vector_mode, nb_components)
@@ -1196,6 +1226,11 @@ def CutLinesOnField(proxy, entity, field_name, timestamp_nb,
       (Cut Lines as representation object, list of 'PlotOverLine') otherwise
 
     """
+    if entity == EntityType.NODE:
+        select_cells_with_data(proxy, on_points=[field_name])
+    else:
+        select_cells_with_data(proxy, on_cells=[field_name])
+
     # Check vector mode
     nb_components = get_nb_components(proxy, entity, field_name)
     check_vector_mode(vector_mode, nb_components)
@@ -1318,6 +1353,11 @@ def CutSegmentOnField(proxy, entity, field_name, timestamp_nb,
       Cut Segment as 3D representation object.
 
     """
+    if entity == EntityType.NODE:
+        select_cells_with_data(proxy, on_points=[field_name])
+    else:
+        select_cells_with_data(proxy, on_cells=[field_name])
+
     # Check vector mode
     nb_components = get_nb_components(proxy, entity, field_name)
     check_vector_mode(vector_mode, nb_components)
@@ -1386,6 +1426,11 @@ def VectorsOnField(proxy, entity, field_name, timestamp_nb,
       Vectors as representation object.
 
     """
+    if entity == EntityType.NODE:
+        select_cells_with_data(proxy, on_points=[field_name])
+    else:
+        select_cells_with_data(proxy, on_cells=[field_name])
+
     # Check vector mode
     nb_components = get_nb_components(proxy, entity, field_name)
     check_vector_mode(vector_mode, nb_components)
@@ -1995,10 +2040,12 @@ def GaussPointsOnField(proxy, entity, field_name,
 
     """
     # We don't need mesh parts with no data on them
-    if entity == EntityType.NODE:
-        select_cells_with_data(proxy, on_points=[field_name])
-    else:
-        select_cells_with_data(proxy, on_cells=[field_name])
+    on_gauss = select_cells_with_data(proxy, on_gauss=[field_name])
+    if not on_gauss:
+        if entity == EntityType.NODE:
+            select_cells_with_data(proxy, on_points=[field_name])
+        else:
+            select_cells_with_data(proxy, on_cells=[field_name])
 
     # Check vector mode
     nb_components = get_nb_components(proxy, entity, field_name)
@@ -2013,17 +2060,10 @@ def GaussPointsOnField(proxy, entity, field_name,
 
     source = proxy
 
-    fields_info = proxy.GetProperty("FieldsTreeInfo")[::2]
-    arr_name_with_dis=[elt.split("/")[-1] for elt in fields_info]
-    gauss_name=field_name+proxy.GetProperty("Separator").GetData()+'GAUSS'
-
     # If no quadrature point array is passed, use cell centers
-    if arr_name_with_dis.count(gauss_name) > 0:
-        index = arr_name_with_dis.index(gauss_name)
-        field = fields_info[index]
-        source.AllArrays = [field]
+    if on_gauss:
         generate_qp = pvs.GenerateQuadraturePoints(source)
-        generate_qp.SelectSourceArray = ['CELLS', 'ELGA_Offset']
+        generate_qp.QuadratureSchemeDef = ['CELLS', 'ELGA@0']
         source = generate_qp
     else:
         # Cell centers
@@ -2171,18 +2211,13 @@ def GaussPointsOnField1(proxy, entity, field_name,
       Gauss Points as representation object.
 
     """
+    select_cells_with_data(proxy, on_gauss=[field_name])
+
+    nb_components = get_nb_components(proxy, entity, field_name)
+
     # Get time value
     time_value = get_time(proxy, timestamp_nb)
 
-    # Select field_name
-    fields_info = proxy.GetProperty("FieldsTreeInfo")[::2]
-    arr_name_with_dis=[elt.split("/")[-1] for elt in fields_info]
-    gauss_name=field_name+proxy.GetProperty("Separator").GetData()+'GAUSS'
-    if arr_name_with_dis.count(gauss_name) > 0:
-        index = arr_name_with_dis.index(gauss_name)
-        field = fields_info[index]
-        proxy.AllArrays = [field]
-
     # Set timestamp
     pvs.GetRenderView().ViewTime = time_value
     proxy.UpdatePipeline(time=time_value)
@@ -2195,14 +2230,6 @@ def GaussPointsOnField1(proxy, entity, field_name,
     gausspnt = pvs.GetRepresentation(source)
 
     # Get lookup table
-    entity_data_info = None
-    point_data_info = source.GetPointDataInformation()
-    if field_name in point_data_info.keys():
-        entity_data_info = point_data_info
-    else:
-        entity_data_info = source.GetCellDataInformation()
-    nb_components = entity_data_info[field_name].GetNumberOfComponents()
-    
     lookup_table = get_lookup_table(field_name, nb_components, vector_mode)
 
     # Set field range if necessary
index 856f9ade1e45f147ee4f33a1ab385cfa7da34027..247447fb402ae55a67dec9ed84d554e39debe525 100644 (file)
@@ -36,7 +36,7 @@ if not picturedir.endswith(os.sep):
     
 # MED file
 file_name = datadir + "Hexa8.med"
-field_name = "scalar_field"
+field_name = "scalar field"
 timestamp_nb = -1 # last timestamp
 
 paravis.myParavis.ImportFile(file_name)
index cff8dcd9cfd2e39552d08f3b783006772a217ed1..6730d245acbd12b94940742439828b66a813673f 100644 (file)
@@ -36,7 +36,7 @@ if not picturedir.endswith(os.sep):
     
 # MED file
 file_name = datadir + "Penta6.med"
-field_name = "scalar_field"
+field_name = "scalar field"
 timestamp_nb = -1 # last timestamp
 
 paravis.myParavis.ImportFile(file_name)
index fdf3420a4f99aa58489126dffa05eda6617d6c79..530fc331a3913f9ad2a0cc6a44ec9af1c27e45f0 100644 (file)
@@ -36,7 +36,7 @@ if not picturedir.endswith(os.sep):
     
 # MED file
 file_name = datadir + "Tetra4.med"
-field_name = "scalar_field"
+field_name = "scalar field"
 timestamp_nb = -1 # last timestamp
 
 paravis.myParavis.ImportFile(file_name)
index 19fded2e017efb7b7780e0b2e5f5e193e38c5da6..81afb6193863afe18f3b6624f95f4eef7f2f408d 100644 (file)
@@ -36,7 +36,7 @@ if not picturedir.endswith(os.sep):
     
 # MED file
 file_name = datadir + "Tria3.med"
-field_name = "scalar_field"
+field_name = "scalar field"
 timestamp_nb = -1 # last timestamp
 
 paravis.myParavis.ImportFile(file_name)
index ed2537544173a6a1b2cea9d2175460ec15fd2ab2..f7ddd0afd867abde40d7fc51983f7fdb3f36893b 100644 (file)
@@ -36,7 +36,7 @@ if not picturedir.endswith(os.sep):
     
 # MED file
 file_name = datadir + "Quad4.med"
-field_name = "scalar_field"
+field_name = "scalar field"
 timestamp_nb = -1 # last timestamp
 
 paravis.myParavis.ImportFile(file_name)
index d215648f2a63cede7ef46a077302a60c558ea0a7..6c1fd99212bbfa6dd31cb8c5439332578d8c1900 100644 (file)
@@ -36,7 +36,7 @@ if not picturedir.endswith(os.sep):
     
 # MED file
 file_name = datadir + "couplex_alain.med"
-field_name = "Conc._I129"
+field_name = "Conc. I129"
 timestamp_nb = -1 # last timestamp
 
 paravis.myParavis.ImportFile(file_name)
index 4e4715abd144449c4d8b931291b9d593a47cb4f3..e7c946b3fff079ed11491f553b74b1f17222b1dc 100644 (file)
@@ -36,7 +36,7 @@ if not picturedir.endswith(os.sep):
     
 # MED file
 file_name = datadir + "T_COUPLEX1.med"
-field_name = "Conc._I129"
+field_name = "Conc. I129"
 timestamp_nb = -1 # last timestamp
 
 paravis.myParavis.ImportFile(file_name)
index 672e93b968138ede21440b02135a714ce813379c..9c02d467c1f9984c0322f5ed7c3241a1b1aaf4b8 100644 (file)
@@ -36,7 +36,7 @@ if not picturedir.endswith(os.sep):
 
 # MED file
 file_name = datadir + "UO2_250ans.med"
-field_name = "Concentration_O2(aq)_mol_per_l"
+field_name = "Concentration_O2(aq)_mol per l"
 timestamp_nb = -1 # last timestamp
 
 paravis.myParavis.ImportFile(file_name)
index 7cbae10c613850d86d31897b2379a8b4a3d56f50..80baf8c1f7249cb0023bf698ffa23f51305d8bf4 100644 (file)
@@ -36,7 +36,7 @@ if not picturedir.endswith(os.sep):
 
 # MED file
 file_name = datadir + "homard_ASTER_OSF_MEDV2.1.5_1_v2.3.med"
-field_names = ["REMEUN_ERRE_ELGA_NORE", "REMEZEROERRE_ELGA_NORE"]
+field_names = ["REMEUN__ERRE_ELGA_NORE__________", "REMEZEROERRE_ELGA_NORE__________"]
 timestamp_nb = -1 # last timestamp
 
 paravis.myParavis.ImportFile(file_name)
index 52e950394d50d503c95ba8e4837b27a6be2f20b2..138361d316bfaf48657f818cdd5e5bcfef78393b 100644 (file)
@@ -36,7 +36,7 @@ if not picturedir.endswith(os.sep):
 
 # MED file
 file_name = datadir + "homard_ASTER_OSF_MEDV2.1.5_1_v2.1.med"
-field_names = ["REMEUN_ERRE_ELGA_NORE", "REMEZEROERRE_ELGA_NORE"]
+field_names = ["REMEUN__ERRE_ELGA_NORE__________", "REMEZEROERRE_ELGA_NORE__________"]
 timestamp_nb = -1 # last timestamp
 
 paravis.myParavis.ImportFile(file_name)
index a62633356e0c3c793ee7faac81a79dd15a25f99b..00d534aa777db554d4ae735a923e8340856a7b73 100644 (file)
@@ -36,7 +36,7 @@ if not picturedir.endswith(os.sep):
 
 # MED file
 file_name = datadir + "homard_ASTER_OSF_MEDV2.1.5_1_v2.2.med"
-field_names = ["REMEUN_ERRE_ELGA_NORE", "REMEZEROERRE_ELGA_NORE"]
+field_names = ["REMEUN__ERRE_ELGA_NORE__________", "REMEZEROERRE_ELGA_NORE__________"]
 timestamp_nb = -1 # last timestamp
 
 paravis.myParavis.ImportFile(file_name)
index 5d277b90924bcf487d69f26cdd538a1c41a12a1c..83d7cbc54b1dc2ca316e4824d82d8f10ba6773b5 100644 (file)
@@ -30,14 +30,15 @@ import pvsimple
 
 
 # Directory for saving snapshots
-picturedir = get_picture_dir(sys.argv[1], "GaussPoints/C8")
+picturedir = get_picture_dir("GaussPoints/C8")
 if not picturedir.endswith(os.sep):
     picturedir += os.sep
 
 # MED file
 file_name = datadir + "ir.resu.med"
-field_name = "gravit_VARI_ELGA"
-timestamp_nb = -1 # last timestamp
+field_name = "gravit__VARI_ELGA"
+#timestamp_nb = 1
+timestamp_nb = 6 # timestamp 1 is empty
 
 paravis.myParavis.ImportFile(file_name)
 med_reader = pvsimple.GetActiveSource()
index af83e6f99f953e1e9f5b79d549d3bacb29593b8f..117d36a1d322506d4260a56753497f351f31298c 100644 (file)
@@ -37,7 +37,7 @@ if med_reader is None:
     error = error+1
 
 # Create Scalar Map
-scalarmap = ScalarMapOnField(med_reader, EntityType.NODE, 'RESUMECAEQUI_ELGA_SIGM', 1)
+scalarmap = ScalarMapOnField(med_reader, EntityType.NODE, 'RESUMECAEQUI_ELGA_SIGM__________', 1)
 if scalarmap is None:
     print "Error!!! ScalarMap is not created"
     error = error+1