def __buildMatrix(self, var, solver, boundaryConditions, dt): if numerix.sctype2char(var.getsctype()) not in numerix.typecodes['Float']: import warnings warnings.warn("""sweep() or solve() are likely to produce erroneous results when `var` does not contain floats.""", UserWarning, stacklevel=4) self._verifyCoeffType(var) if numerix.getShape(dt) != (): raise TypeError, "`dt` must be a single number, not a " + type(dt).__name__ dt = float(dt) if type(boundaryConditions) not in (type(()), type([])): boundaryConditions = (boundaryConditions,) for bc in boundaryConditions: bc._resetBoundaryConditionApplied() if os.environ.has_key('FIPY_DISPLAY_MATRIX'): if not hasattr(self, "_viewer"): from fipy.viewers.matplotlibViewer.matplotlibSparseMatrixViewer import MatplotlibSparseMatrixViewer Term._viewer = MatplotlibSparseMatrixViewer() matrix, RHSvector = self._buildMatrix(var, solver._getMatrixClass(), boundaryConditions, dt) solver._storeMatrix(var=var, matrix=matrix, RHSvector=RHSvector) if os.environ.has_key('FIPY_DISPLAY_MATRIX'): self._viewer.title = "%s %s" % (var.name, self.__class__.__name__) self._viewer.plot(matrix=matrix, RHSvector=RHSvector) from fipy import raw_input raw_input()
def _checkVar(self, var): if ((var is not None) and (numerix.sctype2char(var.getsctype()) not in numerix.typecodes['Float'])): import warnings warnings.warn( """sweep() or solve() are likely to produce erroneous results when `var` does not contain floats.""", UserWarning, stacklevel=4)
def _checkVar(self, var): if ((var is not None) and (numerix.sctype2char(var.getsctype()) not in numerix.typecodes['Float'])): import warnings warnings.warn("""sweep() or solve() are likely to produce erroneous results when `var` does not contain floats.""", UserWarning, stacklevel=4)