From 0f703739ed1c475046c960b78d0da41028f5dfab Mon Sep 17 00:00:00 2001 From: Lindsey Date: Thu, 14 May 2015 14:12:52 -0700 Subject: [PATCH] Changes LRM to Curvilinear --- .../{LogicallyRectMesh.py => CurvilinearMesh.py} | 12 ++++++------ SimPEG/Mesh/__init__.py | 2 +- SimPEG/Tests/TestUtils.py | 6 +++--- ..._LogicallyRectMesh.py => test_CurvilinearMesh.py} | 6 +++--- SimPEG/Tests/test_innerProductDerivs.py | 4 ++-- docs/api_Mesh.rst | 4 ++-- docs/api_MeshCode.rst | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) rename SimPEG/Mesh/{LogicallyRectMesh.py => CurvilinearMesh.py} (98%) rename SimPEG/Tests/{test_LogicallyRectMesh.py => test_CurvilinearMesh.py} (97%) diff --git a/SimPEG/Mesh/LogicallyRectMesh.py b/SimPEG/Mesh/CurvilinearMesh.py similarity index 98% rename from SimPEG/Mesh/LogicallyRectMesh.py rename to SimPEG/Mesh/CurvilinearMesh.py index b2dc6f55..0fbf78a3 100644 --- a/SimPEG/Mesh/LogicallyRectMesh.py +++ b/SimPEG/Mesh/CurvilinearMesh.py @@ -10,9 +10,9 @@ normalize2D = lambda x: x/np.kron(np.ones((1, 2)), Utils.mkvc(length2D(x), 2)) normalize3D = lambda x: x/np.kron(np.ones((1, 3)), Utils.mkvc(length3D(x), 2)) -class LogicallyRectMesh(BaseRectangularMesh, DiffOperators, InnerProducts): +class CurvilinearMesh(BaseRectangularMesh, DiffOperators, InnerProducts): """ - LogicallyRectMesh is a mesh class that deals with logically rectangular meshes. + CurvilinearMesh is a mesh class that deals with logically rectangular meshes. Example of a logically rectangular mesh: @@ -21,7 +21,7 @@ class LogicallyRectMesh(BaseRectangularMesh, DiffOperators, InnerProducts): from SimPEG import Mesh, Utils X, Y = Utils.exampleLrmGrid([3,3],'rotate') - M = Mesh.LogicallyRectMesh([X, Y]) + M = Mesh.CurvilinearMesh([X, Y]) M.plotGrid(showIt=True) """ @@ -343,7 +343,7 @@ class LogicallyRectMesh(BaseRectangularMesh, DiffOperators, InnerProducts): from SimPEG import Mesh, Utils X, Y = Utils.exampleLrmGrid([3,3],'rotate') - M = Mesh.LogicallyRectMesh([X, Y]) + M = Mesh.CurvilinearMesh([X, Y]) M.plotGrid(showIt=True) """ @@ -435,9 +435,9 @@ if __name__ == '__main__': dee3 = True if dee3: X, Y, Z = Utils.ndgrid(h1, h2, h3, vector=False) - M = LogicallyRectMesh([X, Y, Z]) + M = CurvilinearMesh([X, Y, Z]) else: X, Y = Utils.ndgrid(h1, h2, vector=False) - M = LogicallyRectMesh([X, Y]) + M = CurvilinearMesh([X, Y]) print M.r(M.normals, 'F', 'Fx', 'V') diff --git a/SimPEG/Mesh/__init__.py b/SimPEG/Mesh/__init__.py index deb11321..9aadfcba 100644 --- a/SimPEG/Mesh/__init__.py +++ b/SimPEG/Mesh/__init__.py @@ -1,5 +1,5 @@ from TensorMesh import TensorMesh from CylMesh import CylMesh -from LogicallyRectMesh import LogicallyRectMesh +from CurvilinearMesh import CurvilinearMesh from TreeMesh import TreeMesh from BaseMesh import BaseMesh diff --git a/SimPEG/Tests/TestUtils.py b/SimPEG/Tests/TestUtils.py index dbcb92b6..57e17f06 100644 --- a/SimPEG/Tests/TestUtils.py +++ b/SimPEG/Tests/TestUtils.py @@ -3,7 +3,7 @@ import matplotlib.pyplot as plt from numpy.linalg import norm from SimPEG.Utils import mkvc, sdiag, diagEst from SimPEG import Utils -from SimPEG.Mesh import TensorMesh, LogicallyRectMesh, CylMesh +from SimPEG.Mesh import TensorMesh, CurvilinearMesh, CylMesh import numpy as np import scipy.sparse as sp import unittest @@ -126,10 +126,10 @@ class OrderTest(unittest.TestCase): raise Exception('Lom not supported for 1D') elif self.meshDimension == 2: X, Y = Utils.exampleLrmGrid([nc, nc], kwrd) - self.M = LogicallyRectMesh([X, Y]) + self.M = CurvilinearMesh([X, Y]) elif self.meshDimension == 3: X, Y, Z = Utils.exampleLrmGrid([nc, nc, nc], kwrd) - self.M = LogicallyRectMesh([X, Y, Z]) + self.M = CurvilinearMesh([X, Y, Z]) return 1./nc def getError(self): diff --git a/SimPEG/Tests/test_LogicallyRectMesh.py b/SimPEG/Tests/test_CurvilinearMesh.py similarity index 97% rename from SimPEG/Tests/test_LogicallyRectMesh.py rename to SimPEG/Tests/test_CurvilinearMesh.py index 5d223f68..132b6f03 100644 --- a/SimPEG/Tests/test_LogicallyRectMesh.py +++ b/SimPEG/Tests/test_CurvilinearMesh.py @@ -1,6 +1,6 @@ import numpy as np import unittest -from SimPEG.Mesh import TensorMesh, LogicallyRectMesh +from SimPEG.Mesh import TensorMesh, CurvilinearMesh from SimPEG.Utils import ndgrid @@ -13,10 +13,10 @@ class BasicLRMTests(unittest.TestCase): gridIt = lambda h: [np.cumsum(np.r_[0, x]) for x in h] X, Y = ndgrid(gridIt([a, b]), vector=False) self.TM2 = TensorMesh([a, b]) - self.LRM2 = LogicallyRectMesh([X, Y]) + self.LRM2 = CurvilinearMesh([X, Y]) X, Y, Z = ndgrid(gridIt([a, b, c]), vector=False) self.TM3 = TensorMesh([a, b, c]) - self.LRM3 = LogicallyRectMesh([X, Y, Z]) + self.LRM3 = CurvilinearMesh([X, Y, Z]) def test_area_3D(self): test_area = np.array([1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2]) diff --git a/SimPEG/Tests/test_innerProductDerivs.py b/SimPEG/Tests/test_innerProductDerivs.py index 4b7d63cd..27979445 100644 --- a/SimPEG/Tests/test_innerProductDerivs.py +++ b/SimPEG/Tests/test_innerProductDerivs.py @@ -9,7 +9,7 @@ class TestInnerProductsDerivs(unittest.TestCase): def doTestFace(self, h, rep, fast, meshType, invProp=False, invMat=False): if meshType == 'LRM': hRect = Utils.exampleLrmGrid(h,'rotate') - mesh = Mesh.LogicallyRectMesh(hRect) + mesh = Mesh.CurvilinearMesh(hRect) elif meshType == 'Tree': mesh = Mesh.TreeMesh(h) elif meshType == 'Tensor': @@ -26,7 +26,7 @@ class TestInnerProductsDerivs(unittest.TestCase): def doTestEdge(self, h, rep, fast, meshType, invProp=False, invMat=False): if meshType == 'LRM': hRect = Utils.exampleLrmGrid(h,'rotate') - mesh = Mesh.LogicallyRectMesh(hRect) + mesh = Mesh.CurvilinearMesh(hRect) elif meshType == 'Tree': mesh = Mesh.TreeMesh(h) elif meshType == 'Tensor': diff --git a/docs/api_Mesh.rst b/docs/api_Mesh.rst index c698cf67..7bf398b1 100644 --- a/docs/api_Mesh.rst +++ b/docs/api_Mesh.rst @@ -29,7 +29,7 @@ the implementations. tM = Mesh.TensorMesh(sz) qM = Mesh.TreeMesh(sz) qM.refine(lambda X: 1 if np.sqrt(((X-0.5)**2).sum()) < 0.3 else 0) - rM = Mesh.LogicallyRectMesh(Utils.meshutils.exampleLrmGrid(sz,'rotate')) + rM = Mesh.CurvilinearMesh(Utils.meshutils.exampleLrmGrid(sz,'rotate')) fig, axes = plt.subplots(1,3,figsize=(14,5)) opts = {} @@ -38,7 +38,7 @@ the implementations. qM.plotGrid(ax=axes[1], **opts) axes[1].set_title('TreeMesh') rM.plotGrid(ax=axes[2], **opts) - axes[2].set_title('LogicallyRectMesh') + axes[2].set_title('CurvilinearMesh') plt.show() diff --git a/docs/api_MeshCode.rst b/docs/api_MeshCode.rst index 13ceffba..9fb52e53 100644 --- a/docs/api_MeshCode.rst +++ b/docs/api_MeshCode.rst @@ -21,7 +21,7 @@ Tree Mesh Logically Rectangular Mesh ========================== -.. automodule:: SimPEG.Mesh.LogicallyRectMesh +.. automodule:: SimPEG.Mesh.Curvilinear :show-inheritance: :members: :undoc-members: