Salome HOME
CMake:
[modules/paravis.git] / test / VisuPrs / bugs / A0.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/A0 case
21
22 import sys
23 import os
24 from paravistest import datadir, pictureext, get_picture_dir
25 import presentations
26 import paravis
27 import pvsimple
28
29 my_paravis = paravis.myParavis
30 picturedir = get_picture_dir(sys.argv[1], "bugs/A0")
31
32 # 1. Import MED file
33 print 'Importing "hydro_sea_alv.med"...',
34 file_path = datadir + "hydro_sea_alv.med"
35 my_paravis.ImportFile(file_path)
36 med_reader = pvsimple.GetActiveSource()
37
38 if med_reader is None:
39     print "FAILED"
40 else:
41     print "OK"
42
43 # 2. Create cut lines on "Head" field
44 mesh_name = "maillage_migr3d"
45 field_name = "Head"
46 cell_entity = presentations.EntityType.CELL
47 timestamps = med_reader.TimestepValues.GetData()
48
49 for ts in xrange(1, len(timestamps) + 1):
50     print "Timestamp: ", ts
51     cutlines = presentations.CutLinesOnField(med_reader, cell_entity, field_name, ts,
52                                              orientation1=presentations.Orientation.ZX,
53                                              orientation2=presentations.Orientation.YZ)
54     pic_name = mesh_name + "_" + str(cell_entity) + "_" + field_name + "_" + str(ts) + "_TCUTLINES." + pictureext
55     pic_path = os.path.join(picturedir, pic_name)
56     print pic_path
57     presentations.process_prs_for_test(cutlines, pvsimple.GetRenderView(), pic_path)
58     nb_lines = len(cutlines.Input.SliceOffsetValues)
59     print "Number of lines = ", nb_lines
60     
61     
62
63     
64
65
66
67