Changes LRM to Curvilinear

This commit is contained in:
Lindsey
2015-05-14 14:12:52 -07:00
parent 4bda4b6019
commit 0f703739ed
7 changed files with 18 additions and 18 deletions
@@ -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')
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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):
@@ -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])
+2 -2
View File
@@ -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':
+2 -2
View File
@@ -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()
+1 -1
View File
@@ -21,7 +21,7 @@ Tree Mesh
Logically Rectangular Mesh
==========================
.. automodule:: SimPEG.Mesh.LogicallyRectMesh
.. automodule:: SimPEG.Mesh.Curvilinear
:show-inheritance:
:members:
:undoc-members: