Ensure you return None if dimension of TensorMesh is less than the requested grid.

This commit is contained in:
Rowan Cockett
2013-08-03 16:08:04 -07:00
parent 6d5190b2f2
commit 1acb1a4b84
+4 -4
View File
@@ -133,7 +133,7 @@ class TensorMesh(BaseMesh, TensorView, DiffOperators, InnerProducts):
doc = "Face staggered grid in the y direction."
def fget(self):
if self._gridFy is None:
if self._gridFy is None and self.dim > 1:
self._gridFy = ndgrid([x for x in [self.vectorCCx, self.vectorNy, self.vectorCCz] if not x is None])
return self._gridFy
return locals()
@@ -144,7 +144,7 @@ class TensorMesh(BaseMesh, TensorView, DiffOperators, InnerProducts):
doc = "Face staggered grid in the z direction."
def fget(self):
if self._gridFz is None:
if self._gridFz is None and self.dim > 2:
self._gridFz = ndgrid([x for x in [self.vectorCCx, self.vectorCCy, self.vectorNz] if not x is None])
return self._gridFz
return locals()
@@ -166,7 +166,7 @@ class TensorMesh(BaseMesh, TensorView, DiffOperators, InnerProducts):
doc = "Edge staggered grid in the y direction."
def fget(self):
if self._gridEy is None:
if self._gridEy is None and self.dim > 1:
self._gridEy = ndgrid([x for x in [self.vectorNx, self.vectorCCy, self.vectorNz] if not x is None])
return self._gridEy
return locals()
@@ -177,7 +177,7 @@ class TensorMesh(BaseMesh, TensorView, DiffOperators, InnerProducts):
doc = "Edge staggered grid in the z direction."
def fget(self):
if self._gridEz is None:
if self._gridEz is None and self.dim > 2:
self._gridEz = ndgrid([x for x in [self.vectorNx, self.vectorNy, self.vectorCCz] if not x is None])
return self._gridEz
return locals()