Ejemplo n.º 1
0
 def callFunction(self): 
   """
   Wraps the callback function so that it is only called the first time 
   the callFunction is called.
   """
   if not self.injected:
     UserEvent.callFunction(self) #Inject electrons immediately.
     self.injected = True
Ejemplo n.º 2
0
 def callFunction(self): 
   """
   Wraps the callback function so that it is only called the first time 
   the callFunction is called.
   """
   if not self.injected:
     UserEvent.callFunction(self) #Inject electrons immediately.
     loadrho(self.getElectronContainer().pgroup)
     self.injected = True
     print("Particles injected")
 def callFunction(self, *args, **kwargs):
     """
 The method that is passed to the decorator,
 i.e. installafterstep(self.callFunction) 
 This function adds the logic of checking the
 current iteration time against the times at which we'd 
 like to evaluate the callback function and passes
 the appropriate arguments to the callback.
 Args:
   self: The DiagnosticsBySteps object --- standard notation
     for object oriented python.
 """
     if len(self.times) == 0:  #If no desired times are left, skip.
         return
     #Call the function at the first time greater than or equal to
     #the desired time then remove that desired time from list.
     if self.top.time >= self.times[0]:
         self.removeFirstTime()
         UserEvent.callFunction(self, *args, **kwargs)
     return
Ejemplo n.º 4
0
 def callFunction(self,*args,**kwargs):
   """
   The method that is passed to the decorator,
   i.e. installafterstep(self.callFunction) 
   This function adds the logic of checking the
   current iteration time against the times at which we'd 
   like to evaluate the callback function and passes
   the appropriate arguments to the callback.
   Args:
     self: The DiagnosticsBySteps object --- standard notation
       for object oriented python.
   """
   if len(self.times) == 0: #If no desired times are left, skip.
     return
   #Call the function at the first time greater than or equal to
   #the desired time then remove that desired time from list.
   if self.top.time >= self.times[0]: 
     self.removeFirstTime()
     UserEvent.callFunction(self,*args,**kwargs)
   return