1 # Copyright (C) 2010-2016 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 *
29 picturedir = get_picture_dir("bugs/A9")
31 # 1. Step1: Import MED file
32 print "**** Step1: Importing MED file"
34 print 'Import "sortie_med_volumique.med"...............',
35 file_path = datadir + "sortie_med_volumique.med"
36 pvsimple.OpenDataFile(file_path)
37 med_reader = pvsimple.GetActiveSource()
39 if med_reader is None:
44 print 'Get view........................................',
45 view = pvsimple.GetRenderView()
52 mesh_name = 'Volume fluide'
53 cell_entity = EntityType.CELL
54 node_entity = EntityType.NODE
56 # 2. Step2: Displaying mesh
59 print "**** Step2: Display mesh"
62 # Creation of Mesh presentation on nodes
63 print "Creating Mesh presentation on nodes......."
64 mesh = MeshOnEntity(med_reader, mesh_name, node_entity)
66 print "ERROR!!! Mesh presentation on nodes creation FAILED!!!"
69 picture_path = os.path.join(picturedir, "MeshPresentation_OnNodes." + pictureext)
70 process_prs_for_test(mesh, view, picture_path)
73 # Creation of Mesh presentation on cells
74 print "Creating Mesh presentation on cells......."
75 mesh = MeshOnEntity(med_reader, mesh_name, cell_entity)
77 print "ERROR!!! Mesh presentation on cells creation FAILED!!!"
80 picture_path = os.path.join(picturedir, "MeshPresentation_OnCells." + pictureext)
81 process_prs_for_test(mesh, view, picture_path)
84 # 3. Step3: Displaying scalar field 'Dissip'
85 print "**** Step3: Display scalar field 'Dissip'"
90 print "Creating Scalar Map.......",
91 scalarmap = ScalarMapOnField(med_reader, entity, 'Dissip', 1)
94 print "ERROR!!! Scalar Map creation FAILED!!!"
97 picture_path = os.path.join(picturedir, "ScalarMap_Dissip." + pictureext)
98 process_prs_for_test(scalarmap, view, picture_path)
101 # Iso Surfaces creation
102 print "Creating Iso Surfaces.......",
103 isosurfaces = IsoSurfacesOnField(med_reader, entity, 'Dissip', 1)
105 if isosurfaces is None:
106 print "ERROR!!! Iso Surfaces creation FAILED!!!"
109 picture_path = os.path.join(picturedir, "IsoSurfaces_Dissip." + pictureext)
110 process_prs_for_test(isosurfaces, view, picture_path)
113 # Gauss Points creation
114 print "Creating Gauss Points.......",
115 gausspoints = GaussPointsOnField(med_reader, entity, 'Dissip', 1)
117 if gausspoints is None:
118 print "ERROR!!! Gauss Points creation FAILED!!!"
121 picture_path = os.path.join(picturedir, "GaussPoints_Dissip." + pictureext)
122 process_prs_for_test(isosurfaces, view, picture_path)
125 # 4. Step4: Displaying vectoriel field 'VitesseX'
128 print "**** Step5: Display vectoriel field 'VitesseX'"
129 # Deformed Shape creation
130 print "Creating Deformed Shape.......",
132 defshape = DeformedShapeOnField(med_reader, entity, 'VitesseX', 1)
134 print "ERROR!!! Deformed Shape creation FAILED!!!"
137 picture_path = os.path.join(picturedir, "DeformedShape_VitesseX." + pictureext)
138 process_prs_for_test(defshape, view, picture_path)
142 print "Creating Vectors.......",
143 vectors = VectorsOnField(med_reader, entity, 'VitesseX', 1)
146 print "ERROR!!! Vectors creation FAILED!!!"
149 picture_path = os.path.join(picturedir, "Vectors_VitesseX." + pictureext)
150 process_prs_for_test(vectors, view, picture_path)
153 # Scalar Map On Deformed Shape creation
154 print "Creating Scalar Map On Deformed Shape.......",
155 smapondefshape = DeformedShapeAndScalarMapOnField(med_reader, entity, 'VitesseX', 1)
157 if smapondefshape is None:
158 print "ERROR!!! ScalarMapOnDeformedShape creation failed!!!"
161 picture_path = os.path.join(picturedir, "ScalMapOnDefShape_VitesseX." + pictureext)
162 process_prs_for_test(smapondefshape, view, picture_path)
166 raise RuntimeError, "There is an error was occured... For more info see ERROR message above.."
168 raise RuntimeError, "There are some errors were occured... For more info see ERRORs messages above.."