Salome HOME
Add frequency info in mode mode.
[modules/paravis.git] / test / VisuPrs / bugs / A9.py
1 # Copyright (C) 2010-2013  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.
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/bugs/A9 case
21
22 import os
23 import sys
24
25 from paravistest import datadir, get_picture_dir, pictureext
26 from presentations import *
27 import paravis
28 import pvsimple
29
30 my_paravis = paravis.myParavis
31
32 picturedir = get_picture_dir(sys.argv[1], "bugs/A9")
33
34 # 1. Step1: Import MED file
35 print "**** Step1: Importing MED file"
36
37 print 'Import "sortie_med_volumique.med"...............',
38 file_path = datadir + "sortie_med_volumique_v3.0.6.med"
39 my_paravis.ImportFile(file_path)
40 med_reader = pvsimple.GetActiveSource()
41
42 if med_reader is None:
43     print "FAILED"
44 else:
45     print "OK"
46
47 print 'Get view........................................',
48 view = pvsimple.GetRenderView()
49 if view is None:
50     print "FAILED"
51 else:
52     reset_view(view)
53     print "OK"
54     
55 mesh_name = 'Volume_fluide'
56 cell_entity = EntityType.CELL
57 node_entity = EntityType.NODE
58
59 # 2. Step2: Displaying mesh
60 errors = 0
61
62 print "**** Step2: Display mesh"
63 print "BREAKPOINT_1"
64
65 # Creation of Mesh presentation on nodes
66 print "Creating Mesh presentation on nodes......."
67 mesh = MeshOnEntity(med_reader, mesh_name, node_entity)
68 if mesh is None:
69     print "ERROR!!! Mesh presentation on nodes creation FAILED!!!"
70     errors += 1
71 else:
72     picture_path = os.path.join(picturedir, "MeshPresentation_OnNodes." + pictureext)
73     process_prs_for_test(mesh, view, picture_path)
74     print "OK"
75
76 # Creation of Mesh presentation on cells
77 print "Creating Mesh presentation on cells......."
78 mesh = MeshOnEntity(med_reader, mesh_name, cell_entity)
79 if mesh is None:
80     print "ERROR!!! Mesh presentation on cells creation FAILED!!!"
81     errors += 1
82 else:
83     picture_path = os.path.join(picturedir, "MeshPresentation_OnCells." + pictureext)
84     process_prs_for_test(mesh, view, picture_path)
85     print "OK"
86
87 # 3. Step3: Displaying scalar field 'Dissip'
88 print "**** Step3: Display scalar field 'Dissip'"
89
90 entity = cell_entity
91
92 # Scalar Map creation
93 print "Creating Scalar Map.......",
94 scalarmap = ScalarMapOnField(med_reader, entity, 'Dissip', 1)
95
96 if scalarmap is None:
97     print "ERROR!!! Scalar Map creation FAILED!!!"
98     errors += 1
99 else:
100     picture_path = os.path.join(picturedir, "ScalarMap_Dissip." + pictureext)
101     process_prs_for_test(scalarmap, view, picture_path)
102     print "OK"
103
104 # Iso Surfaces creation
105 print "Creating Iso Surfaces.......",
106 isosurfaces = IsoSurfacesOnField(med_reader, entity, 'Dissip', 1)
107
108 if isosurfaces is None:
109     print "ERROR!!! Iso Surfaces creation FAILED!!!"
110     errors += 1
111 else:
112     picture_path = os.path.join(picturedir, "IsoSurfaces_Dissip." + pictureext)
113     process_prs_for_test(isosurfaces, view, picture_path)
114     print "OK"
115
116 # Gauss Points creation
117 print "Creating Gauss Points.......",
118 gausspoints = GaussPointsOnField(med_reader, entity, 'Dissip', 1)
119
120 if gausspoints is None:
121     print "ERROR!!! Gauss Points creation FAILED!!!"
122     errors += 1
123 else:
124     picture_path = os.path.join(picturedir, "GaussPoints_Dissip." + pictureext)
125     process_prs_for_test(isosurfaces, view, picture_path)
126     print "OK"
127
128 # 4. Step4: Displaying vectoriel field 'VitesseX'
129 entity = cell_entity
130
131 print "**** Step5: Display vectoriel field 'VitesseX'"
132 # Deformed Shape creation
133 print "Creating Deformed Shape.......",
134
135 defshape = DeformedShapeOnField(med_reader, entity, 'VitesseX', 1)
136 if defshape is None:
137     print "ERROR!!! Deformed Shape creation FAILED!!!"
138     errors += 1
139 else:
140     picture_path = os.path.join(picturedir, "DeformedShape_VitesseX." + pictureext)
141     process_prs_for_test(defshape, view, picture_path)
142     print "OK"
143
144 # Vectors creation
145 print "Creating Vectors.......",
146 vectors = VectorsOnField(med_reader, entity, 'VitesseX', 1)
147
148 if vectors is None:
149     print "ERROR!!! Vectors creation FAILED!!!"
150     errors += 1
151 else:
152     picture_path = os.path.join(picturedir, "Vectors_VitesseX." + pictureext)
153     process_prs_for_test(vectors, view, picture_path)
154     print "OK"
155
156 # Scalar Map On Deformed Shape creation
157 print "Creating Scalar Map On Deformed Shape.......",
158 smapondefshape = DeformedShapeAndScalarMapOnField(med_reader, entity, 'VitesseX', 1)
159
160 if smapondefshape is None:
161     print "ERROR!!! ScalarMapOnDeformedShape creation failed!!!"
162     errors += 1
163 else:
164     picture_path = os.path.join(picturedir, "ScalMapOnDefShape_VitesseX." + pictureext)
165     process_prs_for_test(smapondefshape, view, picture_path)
166     print "OK"
167
168 if errors == 1:
169     raise RuntimeError, "There is an error was occured... For more info see ERROR message above.."
170 elif errors > 1:
171     raise RuntimeError, "There are some errors were occured... For more info see ERRORs messages above.."
172 print "BREAKPOINT_2"