Salome HOME
Update ParaVis non-regression test base in the following ways:
[modules/paravis.git] / test / VisuPrs / bugs / E0.py
1 # Copyright (C) 2010-2015  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/bugs4/E0 case
21
22 import time
23 from paravistest import datadir
24 from presentations import *
25 import pvsimple
26
27 sleep_delay = 1
28
29 # 1. MED file import
30 print 'Import "ResOK_0000.med"...............',
31 med_file_path = datadir + "ResOK_0000.med"
32 pvsimple.OpenDataFile(med_file_path)
33 med_reader = pvsimple.GetActiveSource()
34 if med_reader is None:
35     raise RuntimeError, "ResOK_0000.med was not imported!!!"
36 else:
37     print "OK"
38
39 # TODO: in the original VISU script the timestamp id was equal to 2,
40 #       but in PARAVIS it's inly one timestamp accessible
41 timestamp_id = 1
42
43 # 2. Create Scalar Map
44 field_name = 'vitesse'
45
46 print "Creating Scalar Map......."
47 scmap1 = ScalarMapOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
48 if scmap1 is None :
49     raise RuntimeError, "ScalarMap presentation is None!!!"
50 else:
51     print "OK"
52
53 display_only(scmap1)
54 reset_view()
55
56 print "WIREFRAME sur scmap1"
57 scmap1.Representation = 'Wireframe'
58 time.sleep(sleep_delay)
59
60 print "POINT sur scmap1"
61 scmap1.Representation = 'Points'
62 time.sleep(sleep_delay)
63
64 print "SURFACEFRAME sur scmap1"
65 scmap1.Representation = 'Surface With Edges'
66 time.sleep(sleep_delay)
67
68 # 3. Create Deformed Shape And Scalar Map
69 print "Creating DeformedShapeAndScalarMap......."
70 scmap2 = DeformedShapeAndScalarMapOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
71 if scmap2 is None :
72     raise RuntimeError, "DeformedShapeAndScalarMapOnField presentation is None!!!"
73 else:
74     print "OK"
75
76 scmap2.Input.ScaleFactor = 1.0
77
78 display_only(scmap2)
79 reset_view()
80
81 print "WIREFRAME sur scmap2"
82 scmap2.Representation = 'Wireframe'
83 time.sleep(sleep_delay)
84
85 print "POINT sur scmap2"
86 scmap2.Representation = 'Points'
87 time.sleep(sleep_delay)
88
89 print "SURFACEFRAME sur scmap2"
90 scmap2.Representation = 'Surface With Edges'
91 time.sleep(sleep_delay)
92
93 # 4.Create Deformed Shape
94 print "Creating DeformedShape........"
95 scmap3 = DeformedShapeOnField(med_reader, EntityType.NODE, field_name, timestamp_id)
96 if scmap3 is None :
97     raise RuntimeError, "DeformedShapeOnField presentation is None!!!"
98 else:
99     print "OK"
100
101 print "WIREFRAME sur scmap3"
102 scmap3.Representation = 'Wireframe'
103 time.sleep(sleep_delay)
104
105 print "POINT sur scmap3"
106 scmap3.Representation = 'Points'
107 time.sleep(sleep_delay)
108
109 print "SURFACEFRAME sur scmap3"
110 scmap3.Representation = 'Surface With Edges'
111 time.sleep(sleep_delay)
112
113 scmap2.Input.ScaleFactor = 1.0
114
115 # show colored:
116 scmap3.ColorArrayName = (EntityType.get_pvtype(EntityType.NODE), field_name)
117
118 display_only(scmap3)
119 reset_view()