1 # Copyright (C) 2010-2015 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, or (at your option) any later version.
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/bugs/A9 case
25 from paravistest import datadir, get_picture_dir, pictureext
26 from presentations import *
27 import pvserver as paravis
30 my_paravis = paravis.myParavis
32 os.environ["PARAVIS_TEST_PICS"] = sys.argv[1]
33 picturedir = get_picture_dir("bugs/A9")
35 # 1. Step1: Import MED file
36 print "**** Step1: Importing MED file"
38 print 'Import "sortie_med_volumique.med"...............',
39 file_path = datadir + "sortie_med_volumique_v3.0.6.med"
40 OpenDataFile(file_path)
41 med_reader = pvsimple.GetActiveSource()
43 if med_reader is None:
48 print 'Get view........................................',
49 view = pvsimple.GetRenderView()
56 mesh_name = 'Volume_fluide'
57 cell_entity = EntityType.CELL
58 node_entity = EntityType.NODE
60 # 2. Step2: Displaying mesh
63 print "**** Step2: Display mesh"
66 # Creation of Mesh presentation on nodes
67 print "Creating Mesh presentation on nodes......."
68 mesh = MeshOnEntity(med_reader, mesh_name, node_entity)
70 print "ERROR!!! Mesh presentation on nodes creation FAILED!!!"
73 picture_path = os.path.join(picturedir, "MeshPresentation_OnNodes." + pictureext)
74 process_prs_for_test(mesh, view, picture_path)
77 # Creation of Mesh presentation on cells
78 print "Creating Mesh presentation on cells......."
79 mesh = MeshOnEntity(med_reader, mesh_name, cell_entity)
81 print "ERROR!!! Mesh presentation on cells creation FAILED!!!"
84 picture_path = os.path.join(picturedir, "MeshPresentation_OnCells." + pictureext)
85 process_prs_for_test(mesh, view, picture_path)
88 # 3. Step3: Displaying scalar field 'Dissip'
89 print "**** Step3: Display scalar field 'Dissip'"
94 print "Creating Scalar Map.......",
95 scalarmap = ScalarMapOnField(med_reader, entity, 'Dissip', 1)
98 print "ERROR!!! Scalar Map creation FAILED!!!"
101 picture_path = os.path.join(picturedir, "ScalarMap_Dissip." + pictureext)
102 process_prs_for_test(scalarmap, view, picture_path)
105 # Iso Surfaces creation
106 print "Creating Iso Surfaces.......",
107 isosurfaces = IsoSurfacesOnField(med_reader, entity, 'Dissip', 1)
109 if isosurfaces is None:
110 print "ERROR!!! Iso Surfaces creation FAILED!!!"
113 picture_path = os.path.join(picturedir, "IsoSurfaces_Dissip." + pictureext)
114 process_prs_for_test(isosurfaces, view, picture_path)
117 # Gauss Points creation
118 print "Creating Gauss Points.......",
119 gausspoints = GaussPointsOnField(med_reader, entity, 'Dissip', 1)
121 if gausspoints is None:
122 print "ERROR!!! Gauss Points creation FAILED!!!"
125 picture_path = os.path.join(picturedir, "GaussPoints_Dissip." + pictureext)
126 process_prs_for_test(isosurfaces, view, picture_path)
129 # 4. Step4: Displaying vectoriel field 'VitesseX'
132 print "**** Step5: Display vectoriel field 'VitesseX'"
133 # Deformed Shape creation
134 print "Creating Deformed Shape.......",
136 defshape = DeformedShapeOnField(med_reader, entity, 'VitesseX', 1)
138 print "ERROR!!! Deformed Shape creation FAILED!!!"
141 picture_path = os.path.join(picturedir, "DeformedShape_VitesseX." + pictureext)
142 process_prs_for_test(defshape, view, picture_path)
146 print "Creating Vectors.......",
147 vectors = VectorsOnField(med_reader, entity, 'VitesseX', 1)
150 print "ERROR!!! Vectors creation FAILED!!!"
153 picture_path = os.path.join(picturedir, "Vectors_VitesseX." + pictureext)
154 process_prs_for_test(vectors, view, picture_path)
157 # Scalar Map On Deformed Shape creation
158 print "Creating Scalar Map On Deformed Shape.......",
159 smapondefshape = DeformedShapeAndScalarMapOnField(med_reader, entity, 'VitesseX', 1)
161 if smapondefshape is None:
162 print "ERROR!!! ScalarMapOnDeformedShape creation failed!!!"
165 picture_path = os.path.join(picturedir, "ScalMapOnDefShape_VitesseX." + pictureext)
166 process_prs_for_test(smapondefshape, view, picture_path)
170 raise RuntimeError, "There is an error was occured... For more info see ERROR message above.."
172 raise RuntimeError, "There are some errors were occured... For more info see ERRORs messages above.."