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