1 # Copyright (C) 2010-2014 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 *
30 my_paravis = paravis.myParavis
32 picturedir = get_picture_dir(sys.argv[1], "bugs/A9")
34 # 1. Step1: Import MED file
35 print "**** Step1: Importing MED file"
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()
42 if med_reader is None:
47 print 'Get view........................................',
48 view = pvsimple.GetRenderView()
55 mesh_name = 'Volume_fluide'
56 cell_entity = EntityType.CELL
57 node_entity = EntityType.NODE
59 # 2. Step2: Displaying mesh
62 print "**** Step2: Display mesh"
65 # Creation of Mesh presentation on nodes
66 print "Creating Mesh presentation on nodes......."
67 mesh = MeshOnEntity(med_reader, mesh_name, node_entity)
69 print "ERROR!!! Mesh presentation on nodes creation FAILED!!!"
72 picture_path = os.path.join(picturedir, "MeshPresentation_OnNodes." + pictureext)
73 process_prs_for_test(mesh, view, picture_path)
76 # Creation of Mesh presentation on cells
77 print "Creating Mesh presentation on cells......."
78 mesh = MeshOnEntity(med_reader, mesh_name, cell_entity)
80 print "ERROR!!! Mesh presentation on cells creation FAILED!!!"
83 picture_path = os.path.join(picturedir, "MeshPresentation_OnCells." + pictureext)
84 process_prs_for_test(mesh, view, picture_path)
87 # 3. Step3: Displaying scalar field 'Dissip'
88 print "**** Step3: Display scalar field 'Dissip'"
93 print "Creating Scalar Map.......",
94 scalarmap = ScalarMapOnField(med_reader, entity, 'Dissip', 1)
97 print "ERROR!!! Scalar Map creation FAILED!!!"
100 picture_path = os.path.join(picturedir, "ScalarMap_Dissip." + pictureext)
101 process_prs_for_test(scalarmap, view, picture_path)
104 # Iso Surfaces creation
105 print "Creating Iso Surfaces.......",
106 isosurfaces = IsoSurfacesOnField(med_reader, entity, 'Dissip', 1)
108 if isosurfaces is None:
109 print "ERROR!!! Iso Surfaces creation FAILED!!!"
112 picture_path = os.path.join(picturedir, "IsoSurfaces_Dissip." + pictureext)
113 process_prs_for_test(isosurfaces, view, picture_path)
116 # Gauss Points creation
117 print "Creating Gauss Points.......",
118 gausspoints = GaussPointsOnField(med_reader, entity, 'Dissip', 1)
120 if gausspoints is None:
121 print "ERROR!!! Gauss Points creation FAILED!!!"
124 picture_path = os.path.join(picturedir, "GaussPoints_Dissip." + pictureext)
125 process_prs_for_test(isosurfaces, view, picture_path)
128 # 4. Step4: Displaying vectoriel field 'VitesseX'
131 print "**** Step5: Display vectoriel field 'VitesseX'"
132 # Deformed Shape creation
133 print "Creating Deformed Shape.......",
135 defshape = DeformedShapeOnField(med_reader, entity, 'VitesseX', 1)
137 print "ERROR!!! Deformed Shape creation FAILED!!!"
140 picture_path = os.path.join(picturedir, "DeformedShape_VitesseX." + pictureext)
141 process_prs_for_test(defshape, view, picture_path)
145 print "Creating Vectors.......",
146 vectors = VectorsOnField(med_reader, entity, 'VitesseX', 1)
149 print "ERROR!!! Vectors creation FAILED!!!"
152 picture_path = os.path.join(picturedir, "Vectors_VitesseX." + pictureext)
153 process_prs_for_test(vectors, view, picture_path)
156 # Scalar Map On Deformed Shape creation
157 print "Creating Scalar Map On Deformed Shape.......",
158 smapondefshape = DeformedShapeAndScalarMapOnField(med_reader, entity, 'VitesseX', 1)
160 if smapondefshape is None:
161 print "ERROR!!! ScalarMapOnDeformedShape creation failed!!!"
164 picture_path = os.path.join(picturedir, "ScalMapOnDefShape_VitesseX." + pictureext)
165 process_prs_for_test(smapondefshape, view, picture_path)
169 raise RuntimeError, "There is an error was occured... For more info see ERROR message above.."
171 raise RuntimeError, "There are some errors were occured... For more info see ERRORs messages above.."