/[escript]/branches/3.4.1/modellib/py_src/input.py
ViewVC logotype

Diff of /branches/3.4.1/modellib/py_src/input.py

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

revision 813 by gross, Thu Apr 27 10:16:05 2006 UTC revision 814 by gross, Wed Aug 23 09:31:10 2006 UTC
# Line 12  from math import log Line 12  from math import log
12    
13  class Sequencer(Model):  class Sequencer(Model):
14      """      """
15      Runs through time until t_end is reached.      Runs through time until t_end is reached.
16      @cvar t_end: - model is terminated when t_end is passed  (exposed in writeXML)  
17      @type t_end: float      @ivar t_end: model is terminated when t_end is passed, default 1 (in).
18      @cvar dt_max: - maximum time step size      @type t_end: C{float}
19      @type dt_max: float      @ivar dt_max: maximum time step size, default L{Model.UNDEF_DT} (in)
20      @cvar t: - initial time      @type dt_max: C{float}
21      @type t: float      @ivar t: current time stamp (in/out). By default it is initialized with zero.
22        @type t: C{float}
23    
24      """      """
25      def __init__(self,debug=False):      def __init__(self,debug=False):
# Line 43  class Sequencer(Model): Line 44  class Sequencer(Model):
44    
45      def finalize(self):      def finalize(self):
46          """          """
47          true when t has reached t_end          returns true when L{t} has reached L{t_end}
48          """          """
49          return self.t >= self.t_end          return self.t >= self.t_end
50    
51      def getSafeTimeStepSize(self, dt):      def getSafeTimeStepSize(self, dt):
52          """          """
53          returns dt_max          returns L{dt_max}
54          """          """
55          return self.dt_max          return self.dt_max
56    
# Line 58  class GaussianProfile(ParameterSet): Line 59  class GaussianProfile(ParameterSet):
59      Generates a Gaussian profile at center x_c, width width and height A      Generates a Gaussian profile at center x_c, width width and height A
60      over a domain      over a domain
61    
62      @ivar domain (in): domain      @ivar domain: domain
63      @ivar x_c (in): center of the Gaussian profile (default [0.,0.,0.])      @ivar x_c: center of the Gaussian profile (default [0.,0.,0.])
64      @ivar A (in): height of the profile. A maybe a vector. (default 1.)      @ivar A: (in) height of the profile. A maybe a vector. (default 1.)
65      @ivar width (in): width of the profile (default 0.1)      @ivar width: (in) width of the profile (default 0.1)
66      @ivar r (in): radius of the circle (default = 0)      @ivar r: (in) radius of the circle (default = 0)
     @ivar out (callable): profile  
67    
68      In the case that the spatial dimension is two, The third component of      In the case that the spatial dimension is two, The third component of
69      x_c is dropped      x_c is dropped.
70      """      """
71      def __init__(self,debug=False):      def __init__(self,debug=False):
72          ParameterSet.__init__(self,debug=debug)          ParameterSet.__init__(self,debug=debug)
# Line 79  class GaussianProfile(ParameterSet): Line 79  class GaussianProfile(ParameterSet):
79      def out(self):      def out(self):
80          """          """
81          Generate the Gaussian profile          Generate the Gaussian profile
82    
83            Link against this method to get the output of this model.
84          """          """
85          x = self.domain.getX()          x = self.domain.getX()
86          dim = self.domain.getDim()          dim = self.domain.getDim()
# Line 90  class GaussianProfile(ParameterSet): Line 92  class GaussianProfile(ParameterSet):
92  class InterpolateOverBox(ParameterSet):  class InterpolateOverBox(ParameterSet):
93      """      """
94      Returns values at each time. The values are defined through given values      Returns values at each time. The values are defined through given values
95      at time node.      at time node. For two dimensional domains back values are ignored.
96    
97      @ivar domain (in): domain      @ivar domain: domain
98      @ivar left_bottom_front (in): coordinates of left, bottom, front corner      @ivar left_bottom_front: (in) coordinates of left, bottom, front corner
99                of the box                of the box
100      @ivar right_top_back (in): coordinates of the right, top, back corner      @ivar right_top_back: (in) coordinates of the right, top, back corner
101                of the box                of the box
102      @ivar value_left_bottom_front (in): value at left,bottom,front corner      @ivar value_left_bottom_front: (in) value at left,bottom,front corner
103      @ivar value_right_bottom_front (in): value at right, bottom, front corner      @ivar value_right_bottom_front: (in) value at right, bottom, front corner
104      @ivar value_left_top_front (in): value at left,top,front corner      @ivar value_left_top_front: (in) value at left,top,front corner
105      @ivar value_right_top_front (in): value at right,top,front corner      @ivar value_right_top_front: (in) value at right,top,front corner
106      @ivar value_left_bottom_back (in): value at  left,bottom,back corner      @ivar value_left_bottom_back: (in) value at  left,bottom,back corner
107      @ivar value_right_bottom_back (in): value at right,bottom,back corner      @ivar value_right_bottom_back: (in) value at right,bottom,back corner
108      @ivar value_left_top_back (in): value at left,top,back  corner      @ivar value_left_top_back: (in) value at left,top,back  corner
109      @ivar value_right_top_back (in): value at right,top,back corner      @ivar value_right_top_back: (in) value at right,top,back corner
     @ivar out (callable): values at domain locations by bilinear  
               interpolation.  For two dimensional domains back values are  
               ignored.  
110      """      """
111    
112      def __init__(self, debug=False):      def __init__(self, debug=False):
# Line 126  class InterpolateOverBox(ParameterSet): Line 125  class InterpolateOverBox(ParameterSet):
125    
126    
127      def out(self):      def out(self):
128            """
129            values at domain locations by bilinear interpolation of the given values.
130    
131            Link against this method to get the output of this model.
132            """
133          x = self.domain.getX()          x = self.domain.getX()
134          if self.domain.getDim() == 2:          if self.domain.getDim() == 2:
135              f_right = (x[0] - self.left_bottom_front[0])/\              f_right = (x[0] - self.left_bottom_front[0])/\
# Line 171  class InterpolatedTimeProfile(ParameterS Line 175  class InterpolatedTimeProfile(ParameterS
175         For time t<nodes[0], value[0] is used and for t>nodes[l], values[l]         For time t<nodes[0], value[0] is used and for t>nodes[l], values[l]
176         is used where l=len(nodes)-1.         is used where l=len(nodes)-1.
177    
178         @ivar t (in): current time         @ivar t: (in) current time
179         @ivar node (in): list of time nodes         @ivar node: (in) list of time nodes
180         @ivar values (in): list of values at time nodes         @ivar values: (in) list of values at time nodes
        @ivar out (callable): current value  
181         """         """
182    
183         def __init__(self,debug=False):         def __init__(self,debug=False):
# Line 183  class InterpolatedTimeProfile(ParameterS Line 186  class InterpolatedTimeProfile(ParameterS
186                                   nodes=[0.,1.],\                                   nodes=[0.,1.],\
187                                   values=[1.,1.])                                   values=[1.,1.])
188         def out(self):         def out(self):
189               """
190               current value
191      
192               Link against this method to get the output of this model.
193               """
194             l = len(self.nodes) - 1             l = len(self.nodes) - 1
195             t = self.t             t = self.t
196             if t <= self.nodes[0]:             if t <= self.nodes[0]:
# Line 199  class LinearCombination(Model): Line 207  class LinearCombination(Model):
207      """      """
208      Returns a linear combination of the f0*v0+f1*v1+f2*v2+f3*v3+f4*v4      Returns a linear combination of the f0*v0+f1*v1+f2*v2+f3*v3+f4*v4
209                            
210      @ivar f0 (in): numerical object or None (default: None)      @ivar f0: (in) numerical object or None, default=None (in)
211      @ivar v0 (in): numerical object or None (default: None)      @ivar v0: (in) numerical object or None, default=None (in)
212      @ivar f1 (in): numerical object or None (default: None)      @ivar f1: (in) numerical object or None, default=None (in)
213      @ivar v1 (in): numerical object or None (default: None)      @ivar v1: (in) numerical object or None, default=None (in)
214      @ivar f2 (in): numerical object or None (default: None)      @ivar f2: (in) numerical object or None, default=None (in)
215      @ivar v2 (in): numerical object or None (default: None)      @ivar v2: (in) numerical object or None, default=None (in)
216      @ivar f3 (in): numerical object or None (default: None)      @ivar f3: (in) numerical object or None, default=None (in)
217      @ivar v3 (in): numerical object or None (default: None)      @ivar v3: (in) numerical object or None, default=None (in)
218      @ivar f4 (in): numerical object or None (default: None)      @ivar f4: (in) numerical object or None, default=None (in)
219      @ivar v4 (in): numerical object or None (default: None)      @ivar v4: (in) numerical object or None, default=None (in)
     @ivar out (callable): current value  
220      """      """
221      def __init__(self,debug=False):      def __init__(self,debug=False):
222          Model.__init__(self,debug=debug)          Model.__init__(self,debug=debug)
# Line 225  class LinearCombination(Model): Line 232  class LinearCombination(Model):
232                                v4=None)                                v4=None)
233    
234      def out(self):      def out(self):
235            """
236            returns f0*v0+f1*v1+f2*v2+f3*v3+f4*v4.
237            Link against this method to get the output of this model.
238            """
239          if not self.f0 == None and not self.v0 == None:          if not self.f0 == None and not self.v0 == None:
240              fv0 = self.f0*self.v0              fv0 = self.f0*self.v0
241          else:          else:

Legend:
Removed from v.813  
changed lines
  Added in v.814

  ViewVC Help
Powered by ViewVC 1.1.26