Ejemplo n.º 1
0
def qmc():
    """qMC implementation.
    """
    instance = Instance({Operator.O_F: ['settings_out[]']})

    while instance.reuse_instance():
        # o_f
        settings0 = Settings({'test2': 14.4})

        assert instance.is_connected('settings_out')
        assert instance.is_vector_port('settings_out')
        assert not instance.is_resizable('settings_out')
        length = instance.get_port_length('settings_out')
        assert length == 10
        for slot in range(length):
            instance.send('settings_out',
                          Message(0.0, None, settings0), slot)
Ejemplo n.º 2
0
def macro():
    """Macro model implementation.
    """
    instance = Instance({Operator.O_I: ['out[]'], Operator.S: ['in[]']})

    while instance.reuse_instance():
        # f_init
        assert instance.get_setting('test1') == 13

        # o_i
        assert instance.is_vector_port('out')
        for slot in range(10):
            instance.send('out', Message(0.0, 10.0, 'testing'), slot)

        # s/b
        for slot in range(10):
            msg = instance.receive('in', slot)
            assert msg.data == 'testing back'
Ejemplo n.º 3
0
def macro():
    """Macro model implementation.
    """
    instance = Instance({Operator.O_I: ['out[]'], Operator.S: ['in[]']})

    while instance.reuse_instance():
        # f_init
        assert instance.get_setting('test1') == 13

        # o_i
        assert instance.is_vector_port('out')
        for slot in range(10):
            instance.send('out', Message(0.0, 10.0, 'testing'), slot)

        # s/b
        for slot in range(10):
            msg = instance.receive('in', slot)
            assert msg.data['string'] == 'testing back'
            assert msg.data['int'] == 42
            assert msg.data['float'] == 3.1416
            assert msg.data['grid'].array.dtype == np.float64
            assert msg.data['grid'].array[0, 1] == 34.0