Salome HOME
Update copyrights 2014.
[modules/paravis.git] / test / VisuPrs / SWIG_scripts / B4.py
1
2 # Copyright (C) 2010-2014  CEA/DEN, EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 # This case corresponds to: /visu/SWIG_scripts/B4 case
22
23 import sys
24 import os
25
26 from paravistest import datadir
27 from presentations import *
28 import paravis
29 import pvsimple
30
31 my_paravis = paravis.myParavis
32
33 # Import MED file
34 med_file_path = datadir + "pointe.med"
35 my_paravis.ImportFile(med_file_path)
36 med_reader = pvsimple.GetActiveSource()
37
38 if med_reader is None:
39     raise RuntimeError, "MED file was not imported successfully."
40
41 # Create presentations
42 try:
43     if os.access(med_file_path, os.R_OK) :
44        if os.access(med_file_path, os.W_OK) :
45            mesh_name = "maa1"
46            entity = EntityType.NODE
47            field_name = "fieldnodedouble"
48            timestamp_id = 1
49            
50            scalarmap = ScalarMapOnField(med_reader, entity, field_name, timestamp_id)
51            if get_nb_components(med_reader, entity, field_name) > 1:
52                vectors = VectorsOnField(med_reader, entity, field_name, timestamp_id)
53                cutplanes = CutPlanesOnField(med_reader, entity, field_name, timestamp_id)
54
55            mesh = MeshOnEntity(med_reader, mesh_name, entity)
56        else:
57            print "We have no permission to rewrite medFile"
58     else:
59         print  "We have no permission to read medFile, it will not be opened"; 
60 except:
61     print sys.exc_type 
62     print sys.exc_value
63     print sys.exc_traceback
64
65