/[escript]/trunk/escript/py_src/pdetools.py
ViewVC logotype

Diff of /trunk/escript/py_src/pdetools.py

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

revision 880 by gross, Wed Oct 25 23:58:16 2006 UTC revision 1107 by gross, Thu Apr 19 02:14:18 2007 UTC
# Line 132  class Projector: Line 132  class Projector:
132      self.__pde.setValue(D = 1.)      self.__pde.setValue(D = 1.)
133      return      return
134    
   def __del__(self):  
     return  
   
135    def __call__(self, input_data):    def __call__(self, input_data):
136      """      """
137      Projects input_data onto a continuous function      Projects input_data onto a continuous function
# Line 310  class Locator: Line 307  class Locator:
307         if isinstance(x, list):         if isinstance(x, list):
308             self.__id=[]             self.__id=[]
309             for p in x:             for p in x:
310                self.__id.append(util.length(self.__function_space.getX()-p[:self.__function_space.getDim()]).mindp())                self.__id.append(util.length(self.__function_space.getX()-p[:self.__function_space.getDim()]).minGlobalDataPoint())
311         else:         else:
312             self.__id=util.length(self.__function_space.getX()-x[:self.__function_space.getDim()]).mindp()             self.__id=util.length(self.__function_space.getX()-x[:self.__function_space.getDim()]).minGlobalDataPoint()
313    
314       def __str__(self):       def __str__(self):
315         """         """
# Line 380  class Locator: Line 377  class Locator:
377             if isinstance(id,list):             if isinstance(id,list):
378                 out=[]                 out=[]
379                 for i in id:                 for i in id:
380                    o=data.convertToNumArrayFromDPNo(*i)                    o=data.getValueOfGlobalDataPoint(*i)
381                    if data.getRank()==0:                    if data.getRank()==0:
382                       out.append(o[0])                       out.append(o[0])
383                    else:                    else:
384                       out.append(o)                       out.append(o)
385                 return out                 return out
386             else:             else:
387               out=data.convertToNumArrayFromDPNo(*id)               out=data.getValueOfGlobalDataPoint(*id)
388               if data.getRank()==0:               if data.getRank()==0:
389                  return out[0]                  return out[0]
390               else:               else:
# Line 404  class SaddlePointProblem(object): Line 401  class SaddlePointProblem(object):
401    
402     for u and p. The problem is solved with an inexact Uszawa scheme for p:     for u and p. The problem is solved with an inexact Uszawa scheme for p:
403    
404     M{Q_f (u^{k+1}-u^{k}) = - f(u^{k},p^{k})     M{Q_f (u^{k+1}-u^{k}) = - f(u^{k},p^{k})}
405     M{Q_g (p^{k+1}-p^{k}) =   g(u^{k+1})}     M{Q_g (p^{k+1}-p^{k}) =   g(u^{k+1})}
406    
407     where Q_f is an approximation of the Jacobiean A_f of f with respect to u  and Q_f is an approximation of     where Q_f is an approximation of the Jacobiean A_f of f with respect to u  and Q_f is an approximation of
# Line 416  class SaddlePointProblem(object): Line 413  class SaddlePointProblem(object):
413         """         """
414         initializes the problem         initializes the problem
415    
416         @parm verbose: switches on the printing out some information         @param verbose: switches on the printing out some information
417         @type verbose: C{bool}         @type verbose: C{bool}
418         @note: this method may be overwritten by a particular saddle point problem         @note: this method may be overwritten by a particular saddle point problem
419         """         """
420           if not isinstance(verbose,bool):
421                raise TypeError("verbose needs to be of type bool.")
422         self.__verbose=verbose         self.__verbose=verbose
423         self.relaxation=1.         self.relaxation=1.
424    
# Line 427  class SaddlePointProblem(object): Line 426  class SaddlePointProblem(object):
426         """         """
427         prints text if verbose has been set         prints text if verbose has been set
428    
429         @parm text: a text message         @param text: a text message
430         @type text: C{str}         @type text: C{str}
431         """         """
432         if self.__verbose: print "%s: %s"%(str(self),text)         if self.__verbose: print "%s: %s"%(str(self),text)
# Line 592  class SaddlePointProblem(object): Line 591  class SaddlePointProblem(object):
591                 tol_eq_f=tolerance_u*norm_df2/norm_f*norm_u_new                 tol_eq_f=tolerance_u*norm_df2/norm_f*norm_u_new
592                 if norm_g_new <= tol_eq_g and norm_f_new <= tol_eq_f:                 if norm_g_new <= tol_eq_g and norm_f_new <= tol_eq_f:
593                     converged=True                     converged=True
                    break  
594              f, norm_f, u, norm_u, g, norm_g, p, norm_p = f_new, norm_f_new, u_new, norm_u_new, g_new, norm_g_new, p_new, norm_p_new              f, norm_f, u, norm_u, g, norm_g, p, norm_p = f_new, norm_f_new, u_new, norm_u_new, g_new, norm_g_new, p_new, norm_p_new
595          self.trace("convergence after %s steps."%self.iter)          self.trace("convergence after %s steps."%self.iter)
596          return u,p          return u,p

Legend:
Removed from v.880  
changed lines
  Added in v.1107

  ViewVC Help
Powered by ViewVC 1.1.26