]> SALOME platform Git repositories - modules/paravis.git/blob - test/VisuPrs/bugs/D0.py
Salome HOME
Porting to PV5.0.1
[modules/paravis.git] / test / VisuPrs / bugs / D0.py
1 # Copyright (C) 2010-2016  CEA/DEN, EDF R&D
2 #
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, or (at your option) any later version.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # This case corresponds to: /visu/bugs3/D0 case
21
22 import sys
23 import os
24 import time
25 from paravistest import datadir, pictureext, get_picture_dir
26 from presentations import *
27 import pvsimple
28
29 picturedir = get_picture_dir("bugs/D0")
30
31 # Aux method
32 def get_group_full_name(source, group_name):
33     result_name = group_name
34
35     #full_names = source.Groups.Available
36     full_names = get_group_names(source)
37     for name in full_names:
38         if name.endswith(group_name):
39             result_name = name
40             break
41
42     return result_name
43
44 #
45 # NB! An 'Unknown exception' is raised, when a user try to open
46 # "Bug619-result_calcul_OCC.med" file in MED module via 'Add Data Source' functionality.
47 # Refer to LastTest.log file for more information.
48 # TODO: check MedReader pb.
49 #
50 # 1. Import of the "Bug619-result_calcul_OCC.med" file
51 med_file_path = datadir + "Bug619-result_calcul_OCC.med"
52
53 pvsimple.OpenDataFile(med_file_path)
54 med_reader = pvsimple.GetActiveSource()
55
56 if med_reader is None:
57     raise RuntimeError, "Bug619-result_calcul_OCC.med was not imported!!!"
58
59 # 2. Creation of ScalarMap:
60 # iteration1: on the "TU_3D_G1" group
61 # iteration2: on the "TU_3D_D1" group
62 view = pvsimple.GetRenderView()
63 field_name = "MECASTATEQUI_ELNO_SIGM"
64
65 groups = ['TU_3D_G1', 'TU_3D_D1']
66
67 for group_name in groups:
68     extract_group = pvsimple.ExtractGroup(med_reader)
69     #extract_group.Groups = [get_group_full_name(med_reader, group_name)]
70     extract_group.AllGroups = [get_group_full_name(extract_group, group_name)]
71     extract_group.UpdatePipeline()
72
73     scalar_map = ScalarMapOnField(extract_group, EntityType.CELL, field_name, 1)
74     if scalar_map is None :
75         raise RuntimeError, "ScalarMap presentation on '" + group_name + "' group is None!!!"
76
77     pic_path = os.path.join(picturedir, "npal18711_" + group_name + "." + pictureext)
78     process_prs_for_test(scalar_map, view, pic_path)