From 1acb1a4b848dbcde990fee6e7a2ebe48d9844071 Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Sat, 3 Aug 2013 16:08:04 -0700 Subject: [PATCH] Ensure you return None if dimension of TensorMesh is less than the requested grid. --- SimPEG/TensorMesh.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SimPEG/TensorMesh.py b/SimPEG/TensorMesh.py index acfdfbac..5218aec1 100644 --- a/SimPEG/TensorMesh.py +++ b/SimPEG/TensorMesh.py @@ -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()