def test_locate_bad_point(self): surface = self._make_one(self.QUADRATIC, 2) point1 = np.asfortranarray([0.0, 1.0]) point2 = np.asfortranarray([[0.0, 1.0, 2.0]]) with self.assertRaises(ValueError): surface.locate(point1) with self.assertRaises(ValueError): surface.locate(point2)
def test_locate_no_verify(self): surface = self._make_one(self.QUADRATIC, 2) s = 0.125 t = 0.125 x_val, y_val = surface.evaluate_cartesian(s, t).flatten() point = np.asfortranarray([[x_val, np.nan], [y_val, np.nan]]) # Make sure it fails. with self.assertRaises(ValueError): surface.locate(point) # Will only use the first row if _verify=False. computed_s, computed_t = surface.locate(point, _verify=False) self.assertEqual(s, computed_s) self.assertEqual(t, computed_t)
def test_locate_bad_dimension(self): nodes = np.asfortranarray([[0.0, 1.0, 2.0]]) surface = self._make_one(nodes, 1) with self.assertRaises(NotImplementedError): surface.locate(None)
def test_locate(self): surface = self._make_one(self.QUADRATIC, 2) point = surface.evaluate_cartesian(0.5, 0.25) s, t = surface.locate(point) self.assertEqual(s, 0.5) self.assertEqual(t, 0.25)