/[escript]/trunk/pyvisi/py_src/datacollector.py
ViewVC logotype

Diff of /trunk/pyvisi/py_src/datacollector.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

temp/pyvisi/py_src/datacollector.py revision 1387 by trankine, Fri Jan 11 07:45:26 2008 UTC trunk/pyvisi/py_src/datacollector.py revision 2009 by phornby, Mon Nov 10 10:01:50 2008 UTC
# Line 1  Line 1 
1    
2    ########################################################
3    #
4    # Copyright (c) 2003-2008 by University of Queensland
5    # Earth Systems Science Computational Center (ESSCC)
6    # http://www.uq.edu.au/esscc
7    #
8    # Primary Business: Queensland, Australia
9    # Licensed under the Open Software License version 3.0
10    # http://www.opensource.org/licenses/osl-3.0.php
11    #
12    ########################################################
13    
14    __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15    Earth Systems Science Computational Center (ESSCC)
16    http://www.uq.edu.au/esscc
17    Primary Business: Queensland, Australia"""
18    __license__="""Licensed under the Open Software License version 3.0
19    http://www.opensource.org/licenses/osl-3.0.php"""
20    __url__="http://www.uq.edu.au/esscc/escript-finley"
21    
22  """  """
23  @var __author__: name of author  @var __author__: name of author
24  @var __copyright__: copyrights  @var __copyright__: copyrights
# Line 8  Line 29 
29  """  """
30    
31  __author__="John Ngui, john.ngui@uq.edu.au"  __author__="John Ngui, john.ngui@uq.edu.au"
 __copyright__="""  Copyright (c) 2006 by ACcESS MNRF  
                     http://www.access.edu.au  
                 Primary Business: Queensland, Australia"""  
 __license__="""Licensed under the Open Software License version 3.0  
              http://www.opensource.org/licenses/osl-3.0.php"""  
 __url__="http://www.iservo.edu.au/esys"  
 __version__="$Revision$"  
 __date__="$Date$"  
32    
33    
34  import vtk  import vtk
# Line 58  class DataCollector: Line 71  class DataCollector:
71          self.__set_scalar = False          self.__set_scalar = False
72          self.__set_vector= False          self.__set_vector= False
73          self.__set_tensor= False          self.__set_tensor= False
74            self.__tmp_fd = None
75            self.__tmp_file = None
76    
77    
78          if(source == Source.XML): # Source is an XML file.          if(source == Source.XML): # Source is an XML file.
79              self.__vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader()              self.__vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader()
# Line 65  class DataCollector: Line 81  class DataCollector:
81          elif (self.__source == Source.ESCRIPT):          elif (self.__source == Source.ESCRIPT):
82              self.__vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader()              self.__vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader()
83              # Create a temporary .xml file and retrieve its path.              # Create a temporary .xml file and retrieve its path.
84              self.__tmp_file = tempfile.mkstemp(suffix=".xml")[1]              # Should raise IOError on failure, in wich case
85                # __tmp_fd will remain None.
86                fd_and_name = tempfile.mkstemp(suffix=".xml")
87                self.__tmp_fd = fd_and_name[0]
88                self.__tmp_file = fd_and_name[1]
89    
90      def __del__(self):      def __del__(self):
91          """          """
92          Perform some clean up of the temporary file.          Perform some clean up of ths assumese temporary file.
93          """          """
94            # remove this test and rely upon the existance of an open
95          if (self.__source == Source.ESCRIPT):          # __tmp_file to decide upon closing and unlinking.
96              if os.access(self.__tmp_file,os.F_OK): os.unlink(self.__tmp_file)          # if (self.__source == Source.ESCRIPT):
97            if self.__tmp_fd != None :
98                os.close(self.__tmp_fd)
99                os.unlink(self.__tmp_file)
100    
101      def setFileName(self, file_name):      def setFileName(self, file_name):
102          """          """

Legend:
Removed from v.1387  
changed lines
  Added in v.2009

  ViewVC Help
Powered by ViewVC 1.1.26