From 1f8ea5858b69290ee697270bda5dab90d7d20039 Mon Sep 17 00:00:00 2001 From: vtn Date: Wed, 19 Mar 2014 18:53:05 +0400 Subject: [PATCH] last timestamp for GaussPointsOnField --- src/PV_SWIG/VTKWrapping/presentations.py | 19 +++++++++++++------ test/VisuPrs/GaussPoints/A0.py | 2 +- test/VisuPrs/GaussPoints/A2.py | 4 ++-- test/VisuPrs/GaussPoints/A3.py | 2 +- test/VisuPrs/GaussPoints/A4.py | 2 +- test/VisuPrs/GaussPoints/A5.py | 2 +- test/VisuPrs/GaussPoints/A6.py | 2 +- test/VisuPrs/GaussPoints/A7.py | 2 +- test/VisuPrs/GaussPoints/A9.py | 2 +- test/VisuPrs/GaussPoints/B0.py | 2 +- test/VisuPrs/GaussPoints/B1.py | 2 +- test/VisuPrs/GaussPoints/B2.py | 2 +- test/VisuPrs/GaussPoints/B3.py | 2 +- test/VisuPrs/GaussPoints/B4.py | 2 +- test/VisuPrs/GaussPoints/B5.py | 2 +- test/VisuPrs/GaussPoints/B6.py | 2 +- test/VisuPrs/GaussPoints/B7.py | 2 +- test/VisuPrs/GaussPoints/B8.py | 2 +- test/VisuPrs/GaussPoints/B9.py | 2 +- test/VisuPrs/GaussPoints/C0.py | 2 +- test/VisuPrs/GaussPoints/C1.py | 2 +- test/VisuPrs/GaussPoints/C2.py | 2 +- test/VisuPrs/GaussPoints/C3.py | 2 +- test/VisuPrs/GaussPoints/C4.py | 2 +- test/VisuPrs/GaussPoints/C5.py | 2 +- test/VisuPrs/GaussPoints/C6.py | 2 +- test/VisuPrs/GaussPoints/C7.py | 2 +- test/VisuPrs/GaussPoints/C8.py | 2 +- test/VisuPrs/GaussPoints/C9.py | 2 +- 29 files changed, 42 insertions(+), 35 deletions(-) diff --git a/src/PV_SWIG/VTKWrapping/presentations.py b/src/PV_SWIG/VTKWrapping/presentations.py index 3e7ebff3..8f4a57f4 100644 --- a/src/PV_SWIG/VTKWrapping/presentations.py +++ b/src/PV_SWIG/VTKWrapping/presentations.py @@ -967,12 +967,15 @@ def get_time(proxy, timestamp_nb): elif (hasattr(proxy.Input, 'TimestepValues')): timestamps = proxy.Input.TimestepValues.GetData() - if ((timestamp_nb - 1) not in xrange(len(timestamps))): + length = len(timestamps) + if (timestamp_nb > 0 and (timestamp_nb - 1) not in xrange(length) ) or (timestamp_nb < 0 and -timestamp_nb > length): raise ValueError("Timestamp number is out of range: " + str(timestamp_nb)) # Return time value - return timestamps[timestamp_nb - 1] - + if timestamp_nb > 0: + return timestamps[timestamp_nb - 1] + else: + return timestamps[timestamp_nb] def create_prs(prs_type, proxy, field_entity, field_name, timestamp_nb): """Auxiliary function. @@ -2010,11 +2013,15 @@ def GaussPointsOnField(proxy, entity, field_name, source = proxy - # Quadrature point arrays - qp_arrays = proxy.QuadraturePointArrays.Available + 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 field_name in qp_arrays: + if arr_name_with_dis.count(gauss_name) > 0: + index = arr_name_with_dis.index(gauss_name) + field = fields_info[index] + source.AllArrays = [field] generate_qp = pvs.GenerateQuadraturePoints(source) generate_qp.SelectSourceArray = ['CELLS', 'ELGA_Offset'] source = generate_qp diff --git a/test/VisuPrs/GaussPoints/A0.py b/test/VisuPrs/GaussPoints/A0.py index 904adb31..66215d6d 100644 --- a/test/VisuPrs/GaussPoints/A0.py +++ b/test/VisuPrs/GaussPoints/A0.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "hexa_28320_ELEM.med" field_name = "pression_elem_dom_pb1" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/A2.py b/test/VisuPrs/GaussPoints/A2.py index 22d4c214..e9ce5f90 100644 --- a/test/VisuPrs/GaussPoints/A2.py +++ b/test/VisuPrs/GaussPoints/A2.py @@ -36,8 +36,8 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "Fields_group3D.med" -field_name = "scalar_field" -timestamp_nb = 1 +field_name = "scalar field" +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/A3.py b/test/VisuPrs/GaussPoints/A3.py index bef3d322..856f9ade 100644 --- a/test/VisuPrs/GaussPoints/A3.py +++ b/test/VisuPrs/GaussPoints/A3.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "Hexa8.med" field_name = "scalar_field" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/A4.py b/test/VisuPrs/GaussPoints/A4.py index 27ce8f7b..cff8dcd9 100644 --- a/test/VisuPrs/GaussPoints/A4.py +++ b/test/VisuPrs/GaussPoints/A4.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "Penta6.med" field_name = "scalar_field" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/A5.py b/test/VisuPrs/GaussPoints/A5.py index fe34ed17..fdf3420a 100644 --- a/test/VisuPrs/GaussPoints/A5.py +++ b/test/VisuPrs/GaussPoints/A5.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "Tetra4.med" field_name = "scalar_field" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/A6.py b/test/VisuPrs/GaussPoints/A6.py index 30c51c7e..19fded2e 100644 --- a/test/VisuPrs/GaussPoints/A6.py +++ b/test/VisuPrs/GaussPoints/A6.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "Tria3.med" field_name = "scalar_field" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/A7.py b/test/VisuPrs/GaussPoints/A7.py index a55ea80f..ed253754 100644 --- a/test/VisuPrs/GaussPoints/A7.py +++ b/test/VisuPrs/GaussPoints/A7.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "Quad4.med" field_name = "scalar_field" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/A9.py b/test/VisuPrs/GaussPoints/A9.py index 5c438a4f..3bc4f999 100644 --- a/test/VisuPrs/GaussPoints/A9.py +++ b/test/VisuPrs/GaussPoints/A9.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "carre_en_quad4_seg2_fields.med" field_name = "AREA" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/B0.py b/test/VisuPrs/GaussPoints/B0.py index 7ad89f77..d336acf4 100644 --- a/test/VisuPrs/GaussPoints/B0.py +++ b/test/VisuPrs/GaussPoints/B0.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "cube_hexa8_quad4.med" field_name = "fieldcelldouble" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/B1.py b/test/VisuPrs/GaussPoints/B1.py index aa6cc3ea..c2664bee 100644 --- a/test/VisuPrs/GaussPoints/B1.py +++ b/test/VisuPrs/GaussPoints/B1.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "test_55_solid_concentr_dom.med" field_name = "RN_precipite_restr" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/B2.py b/test/VisuPrs/GaussPoints/B2.py index 48185d5c..c4dace7e 100644 --- a/test/VisuPrs/GaussPoints/B2.py +++ b/test/VisuPrs/GaussPoints/B2.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "H_COUPLEX1.med" field_name = "Head" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/B3.py b/test/VisuPrs/GaussPoints/B3.py index 0bbb799d..2835c0c5 100644 --- a/test/VisuPrs/GaussPoints/B3.py +++ b/test/VisuPrs/GaussPoints/B3.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "cas2_2d_couplage_chess_castem.med" field_name = "pH" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/B4.py b/test/VisuPrs/GaussPoints/B4.py index 15e6971e..f945ed32 100644 --- a/test/VisuPrs/GaussPoints/B4.py +++ b/test/VisuPrs/GaussPoints/B4.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "champc.med" field_name = "Am241_restriction" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/B5.py b/test/VisuPrs/GaussPoints/B5.py index 774e269d..d5aa0bc0 100644 --- a/test/VisuPrs/GaussPoints/B5.py +++ b/test/VisuPrs/GaussPoints/B5.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "hydro_sea_alv.med" field_name = "Head" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/B6.py b/test/VisuPrs/GaussPoints/B6.py index 60fcb2f9..f7e3dc10 100644 --- a/test/VisuPrs/GaussPoints/B6.py +++ b/test/VisuPrs/GaussPoints/B6.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "toto.med" field_name = "erreur" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/B7.py b/test/VisuPrs/GaussPoints/B7.py index ab4737d6..d215648f 100644 --- a/test/VisuPrs/GaussPoints/B7.py +++ b/test/VisuPrs/GaussPoints/B7.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "couplex_alain.med" field_name = "Conc._I129" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/B8.py b/test/VisuPrs/GaussPoints/B8.py index 25720004..4797087e 100644 --- a/test/VisuPrs/GaussPoints/B8.py +++ b/test/VisuPrs/GaussPoints/B8.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "KCOUPLEX1.med" field_name = "Head" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/B9.py b/test/VisuPrs/GaussPoints/B9.py index 2085d27a..a0ee7766 100644 --- a/test/VisuPrs/GaussPoints/B9.py +++ b/test/VisuPrs/GaussPoints/B9.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "test_hydro.med" field_name = "Head" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/C0.py b/test/VisuPrs/GaussPoints/C0.py index 1f127f5c..583d3939 100644 --- a/test/VisuPrs/GaussPoints/C0.py +++ b/test/VisuPrs/GaussPoints/C0.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "ml.med" field_name = "head_restriction" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/C1.py b/test/VisuPrs/GaussPoints/C1.py index 04581e05..4e4715ab 100644 --- a/test/VisuPrs/GaussPoints/C1.py +++ b/test/VisuPrs/GaussPoints/C1.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "T_COUPLEX1.med" field_name = "Conc._I129" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/C2.py b/test/VisuPrs/GaussPoints/C2.py index 4326d4a6..d628fc4e 100644 --- a/test/VisuPrs/GaussPoints/C2.py +++ b/test/VisuPrs/GaussPoints/C2.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "test_hydro_darcy4_out.med" field_name = "DarcyVelocity" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/C3.py b/test/VisuPrs/GaussPoints/C3.py index a8c2348f..672e93b9 100644 --- a/test/VisuPrs/GaussPoints/C3.py +++ b/test/VisuPrs/GaussPoints/C3.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "UO2_250ans.med" field_name = "Concentration_O2(aq)_mol_per_l" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/C4.py b/test/VisuPrs/GaussPoints/C4.py index bfe47bee..7cbae10c 100644 --- a/test/VisuPrs/GaussPoints/C4.py +++ b/test/VisuPrs/GaussPoints/C4.py @@ -37,7 +37,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"] -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/C5.py b/test/VisuPrs/GaussPoints/C5.py index 6ca4a080..2e123c49 100644 --- a/test/VisuPrs/GaussPoints/C5.py +++ b/test/VisuPrs/GaussPoints/C5.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "occ4050.med" field_name = "champ_reel" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/C6.py b/test/VisuPrs/GaussPoints/C6.py index 1490e2b5..52e95039 100644 --- a/test/VisuPrs/GaussPoints/C6.py +++ b/test/VisuPrs/GaussPoints/C6.py @@ -37,7 +37,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"] -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/C7.py b/test/VisuPrs/GaussPoints/C7.py index c8ecec6e..a6263335 100644 --- a/test/VisuPrs/GaussPoints/C7.py +++ b/test/VisuPrs/GaussPoints/C7.py @@ -37,7 +37,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"] -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/C8.py b/test/VisuPrs/GaussPoints/C8.py index a804bffd..5d277b90 100644 --- a/test/VisuPrs/GaussPoints/C8.py +++ b/test/VisuPrs/GaussPoints/C8.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "ir.resu.med" field_name = "gravit_VARI_ELGA" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() diff --git a/test/VisuPrs/GaussPoints/C9.py b/test/VisuPrs/GaussPoints/C9.py index 61d2e0f2..3f602a39 100644 --- a/test/VisuPrs/GaussPoints/C9.py +++ b/test/VisuPrs/GaussPoints/C9.py @@ -37,7 +37,7 @@ if not picturedir.endswith(os.sep): # MED file file_name = datadir + "petit.rmed" field_name = "RESPIL_SIEF_ELGA" -timestamp_nb = 1 +timestamp_nb = -1 # last timestamp paravis.myParavis.ImportFile(file_name) med_reader = pvsimple.GetActiveSource() -- 2.39.2