Back to index

salome-paravis  6.5.0
demo10.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 
00021 if not ('servermanager' in dir()):
00022   from pvsimple import *
00023 
00024 import os
00025 
00026 def demo10(fname, impth):
00027     """This method demonstrates the Contour filter."""
00028 
00029     reader = ExodusIIReader(FileName=fname)
00030     v=GetActiveView()
00031     ##Show(reader, view=v)
00032     contourFilter = Contour(reader)
00033     contourFilter.ContourBy = 'Temp'
00034     contourFilter.Isosurfaces
00035     ##[]
00036 
00037     contourFilter.Isosurfaces = [400]
00038     camera = GetActiveCamera()
00039     camera.Position = [0., 60., -33]
00040     camera.Elevation(-70)
00041  
00042     dp2 = GetDisplayProperties(contourFilter)
00043     contourFilter.PointData[:]
00044     ##[Array: Temp, Array: V, Array: Pres, Array: AsH3, Array: GaMe3, Array: CH4, Array: H2]
00045 
00046     temp = contourFilter.PointData[0]
00047     temp.GetRange()
00048     ## (399.99999999999994, 400.00000000000006)
00049 
00050     dp2.LookupTable = MakeBlueToRedLT(399.999,400)
00051     dp2.ColorAttributeType = 'POINT_DATA'
00052     dp2.ColorArrayName = 'Temp'
00053     Render()
00054     WriteImage(filename = (impth + "contourFilter_1.png"), view=v, Magnification=2)
00055 
00056     pres = contourFilter.PointData[2]
00057     pres.GetRange()
00058     ##(0.0074376024368978605, 0.02845284189526591)
00059 
00060     dp2.LookupTable = MakeBlueToRedLT(0.007437602, 0.02845284)
00061     dp2.ColorArrayName = 'Pres'
00062     Render()
00063     WriteImage(filename = (impth + "contourFilter_2.png"), view=v, Magnification=2)
00064 
00065     dp1 = GetDisplayProperties(reader)
00066     dp1.Representation = 'Wireframe'
00067     dp1.LookupTable = dp2.LookupTable
00068     dp1.ColorAttributeType = 'POINT_DATA'
00069     dp1.ColorArrayName = 'Pres'
00070     Show(reader)
00071  
00072     camera.Dolly(0.5)
00073     Render()
00074     camera.Elevation(-150)
00075     Render()
00076     WriteImage(filename = (impth + "contourFilter_3.png"), view=v, Magnification=2)
00077 
00078     
00079 testdir = os.getenv("TESTDIR")
00080 pvdata = os.getenv("PVDATA")
00081 
00082 if __name__ == "__main__":
00083  demo10(fname=pvdata+"/Data/disk_out_ref.ex2", impth=testdir+"/Pic/")