diff --git a/SimPEG/LogicallyOrthogonalMesh.py b/SimPEG/LogicallyOrthogonalMesh.py index 1018305b..1c29c947 100644 --- a/SimPEG/LogicallyOrthogonalMesh.py +++ b/SimPEG/LogicallyOrthogonalMesh.py @@ -2,6 +2,7 @@ import numpy as np from BaseMesh import BaseMesh from DiffOperators import DiffOperators from InnerProducts import InnerProducts +from LomView import LomView from utils import mkvc, ndgrid, volTetra, indexCube, faceInfo # Some helper functions. @@ -11,7 +12,7 @@ normalize2D = lambda x: x/np.kron(np.ones((1, 2)), mkvc(length2D(x), 2)) normalize3D = lambda x: x/np.kron(np.ones((1, 3)), mkvc(length3D(x), 2)) -class LogicallyOrthogonalMesh(BaseMesh, DiffOperators, InnerProducts): +class LogicallyOrthogonalMesh(BaseMesh, DiffOperators, InnerProducts, LomView): """ LogicallyOrthogonalMesh is a mesh class that deals with logically orthogonal meshes. diff --git a/SimPEG/__init__.py b/SimPEG/__init__.py index ca9b9f7b..7cb2b76d 100644 --- a/SimPEG/__init__.py +++ b/SimPEG/__init__.py @@ -1,3 +1,4 @@ from TensorMesh import TensorMesh from LogicallyOrthogonalMesh import LogicallyOrthogonalMesh import utils +from exampleGrid import exampleLomGird diff --git a/SimPEG/tests/OrderTest.py b/SimPEG/tests/OrderTest.py index 5bddf118..64d37a32 100644 --- a/SimPEG/tests/OrderTest.py +++ b/SimPEG/tests/OrderTest.py @@ -1,6 +1,6 @@ import sys sys.path.append('../../') -from SimPEG import TensorMesh, utils, LogicallyOrthogonalMesh +from SimPEG import TensorMesh, utils, LogicallyOrthogonalMesh, exampleLomGird import numpy as np import unittest @@ -92,11 +92,17 @@ class OrderTest(unittest.TestCase): elif 'LOM' in self.meshType: if 'uniform' in self.meshType: - xx = np.cumsum(np.r_[0, np.ones(nc)/nc]) - X, Y, Z = utils.ndgrid([xx, xx, xx], vector=False) + kwrd = 'rect' + elif 'rotate' in self.meshType: + kwrd = 'rotate' else: raise Exception('Unexpected meshType') - self.M = LogicallyOrthogonalMesh([X, Y, Z]) + if self.meshDimension == 2: + X, Y = exampleLomGird([nc, nc], kwrd) + self.M = LogicallyOrthogonalMesh([X, Y]) + if self.meshDimension == 3: + X, Y, Z = exampleLomGird([nc, nc, nc], kwrd) + self.M = LogicallyOrthogonalMesh([X, Y, Z]) return 1./nc def getError(self): @@ -119,7 +125,7 @@ class OrderTest(unittest.TestCase): err = self.getError() if ii == 0: print '' - print 'Testing order of: ' + self.name + print 'Testing convergence on ' + self.M._meshType + ' of: ' + self.name print '_____________________________________________' print ' h | error | e(i-1)/e(i) | order' print '~~~~~~|~~~~~~~~~~~~~|~~~~~~~~~~~~~|~~~~~~~~~~' diff --git a/SimPEG/tests/test_massMatrices.py b/SimPEG/tests/test_massMatrices.py index da9f0ca6..021a307b 100644 --- a/SimPEG/tests/test_massMatrices.py +++ b/SimPEG/tests/test_massMatrices.py @@ -32,7 +32,9 @@ from OrderTest import OrderTest class TestInnerProducts(OrderTest): """Integrate an function over a unit cube domain using edgeInnerProducts and faceInnerProducts.""" - meshType = 'uniformLOM' + meshType = 'rotateLOM' + meshDimension = 2 + meshSizes = [16, 32, 64] def getError(self):