X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=test%2FVisuPrs%2Fimps%2FB2.py;h=f715c973ad5e5afc0d6df433b05c691183724e96;hb=937b15c6a43ec7efea52bd90272e2e35d89ab37b;hp=171630a85c4ff20c683b2724ca441803c1d2bf51;hpb=7cbbd61df3f61d6f3f766b890af5352960bbaa1e;p=modules%2Fparavis.git diff --git a/test/VisuPrs/imps/B2.py b/test/VisuPrs/imps/B2.py old mode 100755 new mode 100644 index 171630a8..f715c973 --- a/test/VisuPrs/imps/B2.py +++ b/test/VisuPrs/imps/B2.py @@ -1,4 +1,4 @@ -# Copyright (C) 2010-2014 CEA/DEN, EDF R&D +# Copyright (C) 2010-2016 CEA/DEN, EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -21,16 +21,13 @@ from paravistest import datadir from presentations import * -import paravis import pvsimple -my_paravis = paravis.myParavis - # 1. Import MED file print 'Import "ResOK_0000.med"...............', file_path = datadir + "ResOK_0000.med" -my_paravis.ImportFile(file_path) +pvsimple.OpenDataFile(file_path) med_reader = pvsimple.GetActiveSource() if med_reader is None: @@ -38,23 +35,45 @@ if med_reader is None: else: print "OK" + +def _extract_all_arrays_of_type(array_type, source): + import re + #sep = source.GetProperty("Separator").GetData() # "@@][@@" + arrays = source.AllArrays + result = [] + for arr in arrays: + match = re.search("ComSup[^/]*/(.*)@@\]\[@@(.*)", arr) + field_name = match.group(1) + arr_typ = match.group(2) + if arr_typ == array_type: + result += [field_name] + pass + return result +# + +def _extract_cell_arrays(source): + return _extract_all_arrays_of_type("P0", source) +# +def _extract_point_arrays(source): + return _extract_all_arrays_of_type("P1", source) +# + # 2. Get some information on the MED file -fields_on_nodes = med_reader.PointArrays +#fields_on_nodes = med_reader.PointArrays +fields_on_nodes = _extract_point_arrays(med_reader) print "Field names on NODE: ", fields_on_nodes is_ok = len(fields_on_nodes) == 2 and ("temperature" in fields_on_nodes) and ("vitesse" in fields_on_nodes) if not is_ok: raise RuntimeError, "=> Error in PointArrays property" -fields_on_cells = med_reader.CellArrays +#fields_on_cells = med_reader.CellArrays +fields_on_cells = _extract_cell_arrays(med_reader) print "Field names on CELL: ", fields_on_cells is_ok = len(fields_on_cells) == 1 and ("pression" in fields_on_cells) if not is_ok: raise RuntimeError, "=> Error in CellArrays property" -timestamps = med_reader.TimestepValues.GetData() +timestamps = med_reader.TimestepValues.GetData()[1:] print "timestamps: ", timestamps if timestamps != [17.030882013694594]: raise RuntimeError, "=> Wrong TimestepValues property value" - - -