def __add__(self, other): if isinstance(other, TransientTerm): return self.__class__(coeff=self.coeff + other.coeff) else: return CellTerm.__add__(self, other)
def __init__(self, coeff=0., var=None): if self.__class__ is SourceTerm: raise AbstractBaseClassError CellTerm.__init__(self, coeff=coeff, var=var)
def __init__(self, coeff = 0.): if self.__class__ is SourceTerm: raise NotImplementedError, "can't instantiate abstract base class" CellTerm.__init__(self, coeff = coeff)