From: vtn Date: Fri, 21 Mar 2014 12:45:33 +0000 (+0400) Subject: GaussPoints modification X-Git-Tag: V7_4_0a1~2^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1bccbf6158b625087579a5212d834b171ec56c87;p=modules%2Fparavis.git GaussPoints modification --- diff --git a/src/PV_SWIG/VTKWrapping/presentations.py b/src/PV_SWIG/VTKWrapping/presentations.py index 7c62380a..6042b90c 100644 --- a/src/PV_SWIG/VTKWrapping/presentations.py +++ b/src/PV_SWIG/VTKWrapping/presentations.py @@ -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 diff --git a/test/VisuPrs/GaussPoints/A3.py b/test/VisuPrs/GaussPoints/A3.py index 856f9ade..247447fb 100644 --- a/test/VisuPrs/GaussPoints/A3.py +++ b/test/VisuPrs/GaussPoints/A3.py @@ -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) diff --git a/test/VisuPrs/GaussPoints/A4.py b/test/VisuPrs/GaussPoints/A4.py index cff8dcd9..6730d245 100644 --- a/test/VisuPrs/GaussPoints/A4.py +++ b/test/VisuPrs/GaussPoints/A4.py @@ -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) diff --git a/test/VisuPrs/GaussPoints/A5.py b/test/VisuPrs/GaussPoints/A5.py index fdf3420a..530fc331 100644 --- a/test/VisuPrs/GaussPoints/A5.py +++ b/test/VisuPrs/GaussPoints/A5.py @@ -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) diff --git a/test/VisuPrs/GaussPoints/A6.py b/test/VisuPrs/GaussPoints/A6.py index 19fded2e..81afb619 100644 --- a/test/VisuPrs/GaussPoints/A6.py +++ b/test/VisuPrs/GaussPoints/A6.py @@ -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) diff --git a/test/VisuPrs/GaussPoints/A7.py b/test/VisuPrs/GaussPoints/A7.py index ed253754..f7ddd0af 100644 --- a/test/VisuPrs/GaussPoints/A7.py +++ b/test/VisuPrs/GaussPoints/A7.py @@ -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) diff --git a/test/VisuPrs/GaussPoints/B7.py b/test/VisuPrs/GaussPoints/B7.py index d215648f..6c1fd992 100644 --- a/test/VisuPrs/GaussPoints/B7.py +++ b/test/VisuPrs/GaussPoints/B7.py @@ -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) diff --git a/test/VisuPrs/GaussPoints/C1.py b/test/VisuPrs/GaussPoints/C1.py index 4e4715ab..e7c946b3 100644 --- a/test/VisuPrs/GaussPoints/C1.py +++ b/test/VisuPrs/GaussPoints/C1.py @@ -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) diff --git a/test/VisuPrs/GaussPoints/C3.py b/test/VisuPrs/GaussPoints/C3.py index 672e93b9..9c02d467 100644 --- a/test/VisuPrs/GaussPoints/C3.py +++ b/test/VisuPrs/GaussPoints/C3.py @@ -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) diff --git a/test/VisuPrs/GaussPoints/C4.py b/test/VisuPrs/GaussPoints/C4.py index 7cbae10c..80baf8c1 100644 --- a/test/VisuPrs/GaussPoints/C4.py +++ b/test/VisuPrs/GaussPoints/C4.py @@ -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) diff --git a/test/VisuPrs/GaussPoints/C6.py b/test/VisuPrs/GaussPoints/C6.py index 52e95039..138361d3 100644 --- a/test/VisuPrs/GaussPoints/C6.py +++ b/test/VisuPrs/GaussPoints/C6.py @@ -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) diff --git a/test/VisuPrs/GaussPoints/C7.py b/test/VisuPrs/GaussPoints/C7.py index a6263335..00d534aa 100644 --- a/test/VisuPrs/GaussPoints/C7.py +++ b/test/VisuPrs/GaussPoints/C7.py @@ -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) diff --git a/test/VisuPrs/GaussPoints/C8.py b/test/VisuPrs/GaussPoints/C8.py index 5d277b90..83d7cbc5 100644 --- a/test/VisuPrs/GaussPoints/C8.py +++ b/test/VisuPrs/GaussPoints/C8.py @@ -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() diff --git a/test/VisuPrs/imps/A6.py b/test/VisuPrs/imps/A6.py index af83e6f9..117d36a1 100644 --- a/test/VisuPrs/imps/A6.py +++ b/test/VisuPrs/imps/A6.py @@ -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