Salome HOME
a7c8cbbd79420532c50bf3982f0dda7c1d50fa77
[modules/paravis.git] / test / VisuPrs / imps / A4.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/imps/A4 case
21
22 from paravistest import datadir
23 from presentations import *
24 import pvserver as paravis
25 import pvsimple
26
27 my_paravis = paravis.myParavis
28 error = 0
29
30 # Import MED file
31 med_file_path = datadir + "fra.med"
32 my_paravis.ImportFile(med_file_path)
33 med_reader = pvsimple.GetActiveSource()
34
35 if med_reader is None:
36     print "Error!!! med file is not imported"
37     error = error+1
38
39 # Create Mesh
40 mesh_name = 'LE_VOLUME'
41 cell_entity = EntityType.CELL
42 mesh = MeshOnEntity(med_reader, mesh_name, cell_entity)
43 if mesh is None:
44     print "Error!!! Mesh is not created"
45     error = error+1
46
47 mesh.Visibility = 1
48 reset_view()
49
50 # Use shrink filter
51 mesh_shrinked = pvsimple.Shrink(med_reader)
52 mesh_shrinked.ShrinkFactor = 0.75
53 mesh_shrinked = pvsimple.GetRepresentation(mesh_shrinked)
54
55 if mesh_shrinked is None:
56     print "Error!!! Mesh is not shrinked"
57     error = error+1
58
59 # Create Scalar Map
60 scalarmap = ScalarMapOnField(med_reader, EntityType.NODE, 'TAUX_DE_VIDE', 1);
61 if scalarmap is None:
62     print "Error!!! ScalarMap is not created"
63     error = error+1
64 display_only(scalarmap)
65
66 if error > 0:
67     raise RuntimeError, "There is(are) some error(s) was(were) found... For more info see ERRORs above..."