def testAddVectorData(self):
        ps = pyjet.ParticleSystemData2()
        ps.resize(12)

        a0 = ps.addVectorData((2.0, 4.0))
        a1 = ps.addVectorData((9.0, -2.0))
        self.assertEqual(ps.numberOfParticles, 12)
        self.assertEqual(a0, 3)
        self.assertEqual(a1, 4)

        as0 = np.array(ps.vectorDataAt(a0))
        for val in as0:
            self.assertEqual(val.tolist(), [2.0, 4.0])

        as1 = np.array(ps.vectorDataAt(a1))
        for val in as1:
            self.assertEqual(val.tolist(), [9.0, -2.0])
예제 #2
0
def test_add_vector_data2():
    ps = pyjet.ParticleSystemData2()
    ps.resize(12)

    a0 = ps.addVectorData((2.0, 4.0))
    a1 = ps.addVectorData((9.0, -2.0))
    assert ps.numberOfParticles == 12
    assert a0 == 3
    assert a1 == 4

    as0 = np.array(ps.vectorDataAt(a0))
    for val in as0:
        assert val.tolist() == [2.0, 4.0]

    as1 = np.array(ps.vectorDataAt(a1))
    for val in as1:
        assert val.tolist() == [9.0, -2.0]
    def testAddScalarData(self):
        ps = pyjet.ParticleSystemData2()
        ps.resize(12)

        a0 = ps.addScalarData(2.0)
        a1 = ps.addScalarData(9.0)
        self.assertEqual(ps.numberOfParticles, 12)
        self.assertEqual(a0, 0)
        self.assertEqual(a1, 1)

        as0 = np.array(ps.scalarDataAt(a0))
        for val in as0:
            self.assertEqual(val, 2.0)

        as1 = np.array(ps.scalarDataAt(a1))
        for val in as1:
            self.assertEqual(val, 9.0)
예제 #4
0
def test_add_scalar_data2():
    ps = pyjet.ParticleSystemData2()
    ps.resize(12)

    a0 = ps.addScalarData(2.0)
    a1 = ps.addScalarData(9.0)
    assert ps.numberOfParticles == 12
    assert a0 == 0
    assert a1 == 1

    as0 = np.array(ps.scalarDataAt(a0))
    for val in as0:
        assert val == 2.0

    as1 = np.array(ps.scalarDataAt(a1))
    for val in as1:
        assert val == 9.0
예제 #5
0
def test_add_particles2():
    ps = pyjet.ParticleSystemData2()
    ps.resize(12)

    ps.addParticles([(1.0, 2.0), (4.0, 5.0)], [(7.0, 8.0), (8.0, 7.0)],
                    [(5.0, 4.0), (2.0, 1.0)])

    assert ps.numberOfParticles == 14
    p = np.array(ps.positions)
    v = np.array(ps.velocities)
    f = np.array(ps.forces)

    assert [1.0, 2.0] == p[12].tolist()
    assert [4.0, 5.0] == p[13].tolist()
    assert [7.0, 8.0] == v[12].tolist()
    assert [8.0, 7.0] == v[13].tolist()
    assert [5.0, 4.0] == f[12].tolist()
    assert [2.0, 1.0] == f[13].tolist()
    def testAddParticles(self):
        ps = pyjet.ParticleSystemData2()
        ps.resize(12)

        ps.addParticles([(1.0, 2.0), (4.0, 5.0)], [(7.0, 8.0), (8.0, 7.0)],
                        [(5.0, 4.0), (2.0, 1.0)])

        self.assertEqual(ps.numberOfParticles, 14)
        p = np.array(ps.positions)
        v = np.array(ps.velocities)
        f = np.array(ps.forces)

        self.assertEqual([1.0, 2.0], p[12].tolist())
        self.assertEqual([4.0, 5.0], p[13].tolist())
        self.assertEqual([7.0, 8.0], v[12].tolist())
        self.assertEqual([8.0, 7.0], v[13].tolist())
        self.assertEqual([5.0, 4.0], f[12].tolist())
        self.assertEqual([2.0, 1.0], f[13].tolist())
 def testResize(self):
     ps = pyjet.ParticleSystemData2()
     ps.resize(12)
     self.assertEqual(ps.numberOfParticles, 12)
    def testInit(self):
        ps = pyjet.ParticleSystemData2()
        self.assertEqual(ps.numberOfParticles, 0)

        ps2 = pyjet.ParticleSystemData2(100)
        self.assertEqual(ps2.numberOfParticles, 100)
예제 #9
0
def test_resize2():
    ps = pyjet.ParticleSystemData2()
    ps.resize(12)
    assert ps.numberOfParticles == 12
예제 #10
0
def test_init2():
    ps = pyjet.ParticleSystemData2()
    assert ps.numberOfParticles == 0

    ps2 = pyjet.ParticleSystemData2(100)
    assert ps2.numberOfParticles == 100