Changeset 2825 for trunk

Show
Ignore:
Timestamp:
11/18/2008 05:08:38 PM (7 weeks ago)
Author:
guyer
Message:

It makes more sense for the copy of an OperatorVariable to be a plain Variable (of appropriate class)

Location:
trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/FiPy.egg-info/SOURCES.txt

    r2822 r2825  
    2222documentation/TALKS.txt 
    2323documentation/TODOLIST.txt 
    24 documentation/VERSION.txt 
    2524documentation/VKML.txt 
    2625documentation/figures/NIST_right2line.pdf 
     
    3130documentation/manual/fipy.bst 
    3231documentation/manual/fipy.dbj 
    33 documentation/manual/fipy.pdf 
    3432documentation/manual/fipy.sty 
    3533documentation/manual/fipy.tex 
  • trunk/fipy/variables/cellVariable.py

    r2781 r2825  
    132132    def copy(self): 
    133133         
    134         return self.__class__( 
    135             mesh = self.mesh,  
    136             name = self.name + "_old",  
    137             value = self.getValue(), 
    138             hasOld = 0) 
     134        return self._getArithmeticBaseClass()(mesh=self.mesh,  
     135                                              name=self.name + "_old",  
     136                                              value=self.getValue(), 
     137                                              hasOld=False) 
    139138             
    140139    def __call__(self, points=None, order=0): 
  • trunk/fipy/variables/faceVariable.py

    r2781 r2825  
    6060 
    6161    def copy(self): 
    62         return self.__class__(mesh = self.mesh,  
    63                               name = self.name + "_copy",  
    64                               value = self.getValue()) 
     62        return self._getArithmeticBaseClass()(mesh=self.mesh,  
     63                                              name=self.name + "_copy",  
     64                                              value=self.getValue()) 
    6565 
    6666    def getDivergence(self): 
  • trunk/fipy/variables/modularVariable.py

    r2781 r2825  
    208208        return self._BinaryOperatorVariable(lambda a,b: b-a, other, canInline=False) 
    209209 
     210    def _getArithmeticBaseClass(self, other=None): 
     211        """ 
     212        Given `self` and `other`, return the desired base 
     213        class for an operation result. 
     214        """ 
     215        if other is None: 
     216            return ModularVariable 
     217             
     218        return CellVariable._getArithmeticBaseClass(self, other) 
     219 
    210220 
    211221def _test():  
  • trunk/fipy/variables/operatorVariable.py

    r2817 r2825  
    191191            return name 
    192192             
    193         def copy(self): 
    194             return self.__class__( 
    195                 op = self.op, 
    196                 var = self.var, 
    197                 opShape = self.opShape, 
    198                 canInline = self.canInline) 
    199   
    200193        def getShape(self): 
    201194            if self.opShape is not None: 
  • trunk/fipy/variables/variable.py

    r2819 r2825  
    221221             
    222222        """ 
    223         return Variable(value=self) 
     223        return self._getArithmeticBaseClass()(value=self) 
    224224 
    225225