mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-04 14:48:49 +08:00
Raise exceptions when trying to interpolate fields that don't exist in the CylMesh
This commit is contained in:
@@ -229,6 +229,8 @@ class BaseTensorMesh(BaseRectangularMesh):
|
||||
'N' -> scalar field defined on nodes
|
||||
'CC' -> scalar field defined on cell centers
|
||||
"""
|
||||
if self._meshType == 'CYL' and self.isSymmetric and locType in ['Ex','Ez','Fy']:
|
||||
raise Exception('Symmetric CylMesh does not support %s interpolation, as this variable does not exist.' % locType)
|
||||
|
||||
loc = Utils.asArray_N_x_Dim(loc, self.dim)
|
||||
|
||||
|
||||
@@ -144,6 +144,12 @@ class TestInterpolation2dCyl_Simple(unittest.TestCase):
|
||||
fz = np.array([[ 0., 0., 0., 0., 0.5, 0., 0., 0., 0.5, 0., 0., 0.]])
|
||||
self.assertTrue( np.all(fz == M.getInterpolationMat(locs, 'Fz').todense()) )
|
||||
|
||||
def test_exceptions(self):
|
||||
M = Mesh.CylMesh([4,1,1])
|
||||
locs = np.r_[0,0,0.5]
|
||||
self.assertRaises(Exception,lambda:M.getInterpolationMat(locs, 'Fy'))
|
||||
self.assertRaises(Exception,lambda:M.getInterpolationMat(locs, 'Ex'))
|
||||
self.assertRaises(Exception,lambda:M.getInterpolationMat(locs, 'Ez'))
|
||||
|
||||
|
||||
class TestInterpolation2dCyl(OrderTest):
|
||||
|
||||
Reference in New Issue
Block a user