def __init__(self, coeff=(1., ), var=None): if self.__class__ is _AbstractDiffusionTerm: raise AbstractBaseClassError if type(coeff) not in (type(()), type([])): coeff = [coeff] self.order = len(coeff) * 2 if len(coeff) > 0: self.nthCoeff = coeff[0] from fipy.variables.variable import Variable if not isinstance(self.nthCoeff, Variable): self.nthCoeff = Variable(value=self.nthCoeff) from fipy.variables.cellVariable import CellVariable if isinstance(self.nthCoeff, CellVariable): self.nthCoeff = self.nthCoeff.arithmeticFaceValue else: self.nthCoeff = None _UnaryTerm.__init__(self, coeff=coeff, var=var) if self.order > 0: self.lowerOrderDiffusionTerm = self.__class__(coeff=coeff[1:])
def __init__(self, coeff = (1.,), var=None): if self.__class__ is _AbstractDiffusionTerm: raise AbstractBaseClassError if type(coeff) not in (type(()), type([])): coeff = [coeff] self.order = len(coeff) * 2 if len(coeff) > 0: self.nthCoeff = coeff[0] from fipy.variables.variable import Variable if not isinstance(self.nthCoeff, Variable): self.nthCoeff = Variable(value = self.nthCoeff) from fipy.variables.cellVariable import CellVariable if isinstance(self.nthCoeff, CellVariable): self.nthCoeff = self.nthCoeff.arithmeticFaceValue else: self.nthCoeff = None _UnaryTerm.__init__(self, coeff=coeff, var=var) if self.order > 0: self.lowerOrderDiffusionTerm = self.__class__(coeff = coeff[1:])