Back to index

salome-paravis  6.5.0
C7.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/C4 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/C7")
00034 if not picturedir.endswith(os.sep):
00035     picturedir += os.sep
00036 
00037 # MED file
00038 file_name = datadir + "homard_ASTER_OSF_MEDV2.1.5_1_v2.2.med"
00039 field_names = ["REMEUN_ERRE_ELGA_NORE", "REMEZEROERRE_ELGA_NORE"]
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 view = pvsimple.GetRenderView()
00049 time = get_time(med_reader, timestamp_nb)
00050 
00051 for field_name in field_names:
00052     prs = GaussPointsOnField(med_reader, EntityType.CELL, field_name, timestamp_nb)
00053     if prs is None:
00054         raise RuntimeError, "Created presentation is None!!!"
00055 
00056     # Display presentation and get snapshot
00057     pic_name = picturedir + field_name + "_" + str(time) + "_GAUSSPOINTS." + pictureext
00058     process_prs_for_test(prs, view, pic_name)