/[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

revision 1153 by jongui, Thu May 17 06:33:54 2007 UTC revision 1197 by jongui, Mon Jun 18 02:08:34 2007 UTC
# Line 1  Line 1 
1  """  """
2  @author: John NGUI  @var __author__: name of author
3    @var __copyright__: copyrights
4    @var __license__: licence agreement
5    @var __url__: url entry point on documentation
6    @var __version__: version
7    @var __date__: date of the version
8  """  """
9    
10    __author__="John Ngui, john.ngui@uq.edu.au"
11    __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
12                        http://www.access.edu.au
13                    Primary Business: Queensland, Australia"""
14    __license__="""Licensed under the Open Software License version 3.0
15                 http://www.opensource.org/licenses/osl-3.0.php"""
16    __url__="http://www.iservo.edu.au/esys"
17    __version__="$Revision$"
18    __date__="$Date$"
19    
20    
21  import vtk  import vtk
22  import tempfile, os, sys  import tempfile, os, sys
23  from constant import Source, ColorMode  from constant import Source, ColorMode
# Line 13  except ImportError: Line 29  except ImportError:
29  class DataCollector:  class DataCollector:
30      """      """
31      Class that defines a data collector. A data collector is used to read      Class that defines a data collector. A data collector is used to read
32      data from an XML file or from an escript object directly. Writing XML      data from a XML file or from an escript object directly. Writing XML
33      files are expensive, but this approach has the advantage given that the      files are expensive, but this approach has the advantage given that the
34      results can be analyzed easily after the simulation has completed.        results can be analyzed easily after the simulation has completed.  
35    
# Line 34  class DataCollector: Line 50  class DataCollector:
50          self.__source = source          self.__source = source
51          # Keeps track on whether DataCollector have been modified.          # Keeps track on whether DataCollector have been modified.
52          self.__modified = True          self.__modified = True
53            # Keeps track of the number of times the 'setFileName' or 'setData'
54            # method have been executed.
55            self.__count = 0
56          # Keeps track on whether any specific scalar, vector or tensor          # Keeps track on whether any specific scalar, vector or tensor
57          # field have been specified.          # field have been specified.
58          self.__set_scalar = False          self.__set_scalar = False
# Line 65  class DataCollector: Line 84  class DataCollector:
84          """          """
85    
86          self.__modified = True          self.__modified = True
87            self.__count += 1
88    
89          if(self.__source == Source.XML):          if(self.__source == Source.XML):
90              # Check whether the specified file exists, otherwise exit.              # Check whether the specified file exists, otherwise exit.
# Line 88  class DataCollector: Line 108  class DataCollector:
108          """          """
109    
110          self.__modified = True          self.__modified = True
111            self.__count += 1
112    
113          if self.__source == Source.ESCRIPT:          if self.__source == Source.ESCRIPT:
114              esys.escript.saveVTK(self.__tmp_file,**args)              esys.escript.saveVTK(self.__tmp_file,**args)
# Line 361  class DataCollector: Line 382  class DataCollector:
382          """          """
383    
384          if(self.__modified == True):          if(self.__modified == True):
385              self.__modified = False              # 'self.__modified' is set to False only if the 'setFileName' or
386                # 'setData' method have been called once. This is to prevent
387                # the scalar range and active field (i.e. scalar, vector or tensor)
388                # from being updated as no changes has taken place (for performance
389                # reasons). However if the 'setFileName' or 'setData' method is
390                # called more than once, then 'self.__modified' remains True.
391                if(self.__count == 1):
392                    self.__modified = False
393              return True              return True
394          else:          else:
395              return False              return False

Legend:
Removed from v.1153  
changed lines
  Added in v.1197

  ViewVC Help
Powered by ViewVC 1.1.26