def test_elevate_linear(self): nodes = np.asfortranarray([[0.0, 2.0, -1.0], [0.0, 1.0, 2.0]]) triangle = self._make_one(nodes, 1) elevated = triangle.elevate() expected = np.asfortranarray([[0.0, 1.0, 2.0, -0.5, 0.5, -1.0], [0.0, 0.5, 1.0, 1.0, 1.5, 2.0]]) self.assertEqual(triangle._degree, 1) self.assertEqual(elevated._degree, 2) self.assertEqual(elevated._nodes, expected) main_vals = triangle.evaluate_cartesian_multi(self.REF_TRIANGLE3) sub_vals = elevated.evaluate_cartesian_multi(self.REF_TRIANGLE3) self.assertEqual(main_vals, sub_vals)
def test_elevate_quadratic(self): klass = self._get_target_class() nodes = np.asfortranarray([[0.0, 6.0, 9.0, 0.0, 6.0, -3.0]]) triangle = klass.from_nodes(nodes) elevated = triangle.elevate() expected = np.asfortranarray( [[0.0, 4.0, 7.0, 9.0, 0.0, 4.0, 7.0, -1.0, 3.0, -3.0]]) self.assertEqual(triangle._degree, 2) self.assertEqual(elevated._degree, 3) self.assertEqual(elevated._nodes, expected) main_vals = triangle.evaluate_cartesian_multi(self.REF_TRIANGLE3) sub_vals = elevated.evaluate_cartesian_multi(self.REF_TRIANGLE3) self.assertEqual(main_vals, sub_vals)