def _getSuitableVars(self, vars): vars = [var for var in _MatplotlibViewer._getSuitableVars(self, vars) if var.getMesh().getDim() == 1] if len(vars) > 1: vars = [var for var in vars if var.getMesh() is vars[0].getMesh()] if len(vars) == 0: from fipy.viewers import MeshDimensionError raise MeshDimensionError, "Can only plot 1D data" return vars
def _getSuitableVars(self, vars): from fipy.meshes.numMesh.grid2D import Grid2D from fipy.variables.cellVariable import CellVariable vars = [var for var in _MatplotlibViewer._getSuitableVars(self, vars) \ if (isinstance(var.getMesh(), Grid2D) and isinstance(var, CellVariable))] if len(vars) == 0: from fipy.viewers import MeshDimensionError raise MeshDimensionError, "The mesh must be a Grid2D instance" # this viewer can only display one variable return [vars[0]]
def _getSuitableVars(self, vars): from fipy.meshes.numMesh.mesh2D import Mesh2D from fipy.variables.cellVariable import CellVariable vars = [var for var in _MatplotlibViewer._getSuitableVars(self, vars) \ if ((isinstance(var.getMesh(), Mesh2D) and isinstance(var, CellVariable)) and var.getRank() == 0)] if len(vars) == 0: from fipy.viewers import MeshDimensionError raise MeshDimensionError, "Matplotlib2DViewer can only display a rank-0, 2D CellVariable" # this viewer can only display one variable return [vars[0]]
def _getSuitableVars(self, vars): from fipy.meshes.numMesh.mesh2D import Mesh2D vars = [var for var in _MatplotlibViewer._getSuitableVars(self, vars) \ if (isinstance(var.getMesh(), Mesh2D) \ and (isinstance(var, FaceVariable) \ or isinstance(var, CellVariable)) and var.getRank() == 1)] if len(vars) == 0: from fipy.viewers import MeshDimensionError raise MeshDimensionError, "The mesh must be a Mesh2D instance" # this viewer can only display one variable return [vars[0]]