/[escript]/trunk/modellib/py_src/visualization.py
ViewVC logotype

Annotation of /trunk/modellib/py_src/visualization.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 127 - (hide annotations)
Fri Jul 22 05:11:29 2005 UTC (14 years ago) by jgs
Original Path: trunk/esys2/modellib/py_src/visualization.py
File MIME type: text/x-python
File size: 2515 byte(s)
moved modellib code to esys2/modellib/py_src

1 jgs 127 # $Id$
2    
3    
4     from esys.modelframe import Model
5    
6     class Visualization(Model):
7     """
8    
9     generic visualization of scalar, vector and tensorial data (not implemeted yet)
10    
11     scalar: scalar data set
12     vector: vector data set
13     tensor: tensor data set
14     stride: visulaization is done every strides time step
15     filename: name of the movie file
16    
17     """
18     def __init__(self,debug=False):
19     Model.__init__(self,debug=debug)
20     self.declareParameter(scalar=None,vector=None,tensor=None,stride=1,filename="movie.mpg")
21    
22     def doInitialization(self,t):
23     self.__tn=t
24     self.__n=0
25     self.__scene=None
26    
27     def doStep(self,dt):
28     self.__tn+=dt
29     self.__n+=1
30     if self.__n%self.stride:
31     data=self.scalar
32     if data!=None:
33     pass
34     data=self.vector
35     if data!=None:
36     pass
37     data=self.tensor
38     if data!=None:
39     pass
40    
41     def doFinalization(self):
42     # make the movie into self.filename
43     pass
44    
45     class WriteVTK(Visualization):
46     """ writes data into a VTK file for further processing. Currently data are written in several files for
47     each data type. This may change in the future.
48    
49     scalar: scalar data set
50     vector: vector data set
51     tensor: tensor data set
52     stride: file is written every stride-th time step
53     filename: name of the data files. use %s for indication of data type (s,v,t) and time step id.
54    
55     """
56     def __init__(self,debug=False):
57     Visualization.__init__(self,debug=debug)
58     self.declareParameter(scalar=None,vector=None,tensor=None,stride=1,filename="data.%s.vtk",counter=0)
59    
60     def doInitialization(self,t):
61     self.__tn=t
62    
63     def doStep(self,dt):
64     self.__tn+=dt
65     self.counter+=1
66     print self.counter,self.stride,self.counter%self.stride
67     if self.counter%self.stride==0:
68     n=self.counter/self.stride
69     data=self.scalar
70     if hasattr(data,"saveVTK"): data.saveVTK(self.filename%("s%d"%n))
71     data=self.vector
72     if hasattr(data,"saveVTK"): data.saveVTK(self.filename%("v%d"%n))
73     data=self.tensor
74     if hasattr(data,"saveVTK"): data.saveVTK(self.filename%("t%d"%n))

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26