Back to index

salome-paravis  6.5.0
B2.py
Go to the documentation of this file.
00001 # Copyright (C) 2010-2012  CEA/DEN, EDF R&D
00002 #
00003 # This library is free software; you can redistribute it and/or
00004 # modify it under the terms of the GNU Lesser General Public
00005 # License as published by the Free Software Foundation; either
00006 # version 2.1 of the License.
00007 #
00008 # This library is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 # Lesser General Public License for more details.
00012 #
00013 # You should have received a copy of the GNU Lesser General Public
00014 # License along with this library; if not, write to the Free Software
00015 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 #
00017 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 #
00019 
00020 # This case corresponds to: /visu/GaussPoints/B2 case
00021 # Create Gauss Points on the field of the MED file
00022 
00023 import os
00024 import sys
00025 
00026 from paravistest import datadir, pictureext, get_picture_dir
00027 from presentations import GaussPointsOnField, EntityType, get_time, process_prs_for_test
00028 import paravis
00029 import pvsimple
00030 
00031 
00032 # Directory for saving snapshots
00033 picturedir = get_picture_dir(sys.argv[1], "GaussPoints/B2")
00034 if not picturedir.endswith(os.sep):
00035     picturedir += os.sep
00036     
00037 # MED file
00038 file_name = datadir + "H_COUPLEX1.med"
00039 field_name = "Head"
00040 timestamp_nb = 1
00041 
00042 paravis.myParavis.ImportFile(file_name)
00043 med_reader = pvsimple.GetActiveSource()
00044 if med_reader is None:
00045     raise RuntimeError("File wasn't imported!!!")
00046 
00047 # Create Gauss Points presentation
00048 prs = GaussPointsOnField(med_reader, EntityType.CELL, field_name, timestamp_nb)
00049 if prs is None:
00050     raise RuntimeError, "Created presentation is None!!!"
00051 
00052 # Display presentation and get snapshot
00053 view = pvsimple.GetRenderView()
00054 time = get_time(med_reader, timestamp_nb)
00055 
00056 pic_name = picturedir + field_name + "_" + str(time) + "_GAUSSPOINTS." + pictureext
00057 process_prs_for_test(prs, view, pic_name)