def test_probe(self): with pvt.dsopen(self.casefile) as ds: self.assertAlmostEqual(ds.probe("p", (0.0, 0.5, 0.5)), 1.0) self.assertAlmostEqual(ds.probe("p", (1.0, 0.5, 0.5)), 1.5) self.assertAlmostEqual(ds.probe("p", (2.0, 0.5, 0.5)), 2.0) self.assertAlmostEqual(ds.probe("U Z", (0.0, 0.5, 0.5)), 4.0) self.assertAlmostEqual(ds.probe("U", (0.0, 0.5, 0.5)), 5.0) self.assertAlmostEqual(ds.probe("Missing", (1.0, 0.5, 0.5)), None) self.assertAlmostEqual(ds.probe("p", (0, 0, -1)), None) self.assertAlmostEqual(ds.probe("Y", (1, 0.5, 0.5)), 0.5)
def test_probe(self): with pvt.dsopen(self.file2) as ds: self.assertAlmostEqual(ds.probe("PPressure", (1, 0.5, 0.5)), 20.0) self.assertAlmostEqual(ds.probe("PVelocity X", (1, 0.5, 0.5)), 0.0) self.assertAlmostEqual(ds.probe("PVelocity Z", (1, 0.5, 0.5)), 2.0) self.assertAlmostEqual(ds.probe("PVelocity", (1, 0.5, 0.5)), 2.0) self.assertAlmostEqual(ds.probe("Non existent", (1, 0.5, 0.5)), None) self.assertAlmostEqual(ds.probe("PPressure", (0, 0, -1)), None) self.assertAlmostEqual(ds.probe("Y", (1, 0.5, 0.5)), 0.5)
def test_line(self): with pvt.dsopen(self.file2) as ds: arr = ds.line("PPressure", ((0.0, 0.5, 0.5), (2.0, 0.5, 0.5)), 3) self.assertEqual(len(arr), 3) self.assertAlmostEqual(arr[0], 10.0) self.assertAlmostEqual(arr[1], 20.0) self.assertAlmostEqual(arr[2], 30.0) arr = ds.line("X", ((0.0, 0.5, 0.5), (2.0, 0.5, 0.5)), 3) self.assertEqual(len(arr), 3) self.assertAlmostEqual(arr[0], 0.0) self.assertAlmostEqual(arr[1], 1.0) self.assertAlmostEqual(arr[2], 2.0)
def test_boundary_line(self): with pvt.dsopen(self.file2) as ds: point = (0.5, 0.5, 0.5) normal = (0, 0, 1) bbox = (0.5, None, None, 1.5, 0.5, None) arr = ds.boundary_line("X", point, normal, bbox) for xa, xb in zip(arr, [0.5, 1.0, 1.5]): self.assertAlmostEqual(xa, xb) arr = ds.boundary_line("Y", point, normal, bbox) for ya, yb in zip(arr, [0.0, 0.0, 0.0]): self.assertAlmostEqual(ya, yb) arr = ds.boundary_line("Z", point, normal, bbox) for za, zb in zip(arr, [0.5, 0.5, 0.5]): self.assertAlmostEqual(za, zb)
def test_get_variables(self): with pvt.dsopen(self.file2) as ds: self.assertEqual(ds.get_variables('cell'), []) self.assertEqual(sorted(ds.get_variables('point')), ["PPressure", "PVelocity"])
def test_get_variables(self): with pvt.dsopen(self.casefile) as ds: self.assertEqual(sorted(ds.get_variables('cell')), ["U", "p"]) self.assertEqual(sorted(ds.get_variables('point')), ["U", "p"])