1 # Copyright (C) 2010-2013 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # This case corresponds to: /visu/bugs3/D0 case
25 from paravistest import datadir, pictureext, get_picture_dir
26 from presentations import *
30 my_paravis = paravis.myParavis
31 picturedir = get_picture_dir(sys.argv[1], "bugs/D0")
34 def get_group_full_name(source, group_name):
35 result_name = group_name
37 full_names = source.Groups.Available
38 for name in full_names:
39 if name.endswith(group_name):
45 # 1. Import of the "Bug619-result_calcul_OCC.med" file
46 med_file_path = datadir + "Bug619-result_calcul_OCC.med"
48 my_paravis.ImportFile(med_file_path)
49 med_reader = pvsimple.GetActiveSource()
51 if med_reader is None:
52 raise RuntimeError, "Bug619-result_calcul_OCC.med was not imported!!!"
54 # 2. Creation of ScalarMap:
55 # iteration1: on the "TU_3D_G1" group
56 # iteration2: on the "TU_3D_D1" group
57 view = pvsimple.GetRenderView()
58 field_name = "MECASTATEQUI_ELNO_SIGM"
60 groups = ['TU_3D_G1', 'TU_3D_D1']
62 for group_name in groups:
63 extract_group = pvsimple.ExtractGroup(med_reader)
64 extract_group.Groups = [get_group_full_name(med_reader, group_name)]
65 extract_group.UpdatePipeline()
67 scalar_map = ScalarMapOnField(extract_group, EntityType.CELL, field_name, 1)
68 if scalar_map is None :
69 raise RuntimeError, "ScalarMap presentation on '" + group_name + "' group is None!!!"
71 pic_path = os.path.join(picturedir, "npal18711_" + group_name + "." + pictureext)
72 process_prs_for_test(scalar_map, view, pic_path)