types

This example is used by yggdrasil to test the serialization/deserialization of the supported types between the supported languages and should not be used outside of the types test suite (run via yggtest –test-suite=types).

R Version

Model Code:

 1import os
 2import pprint
 3from yggdrasil.examples.tests.test_types import TestExampleTypes
 4
 5
 6def src():
 7    typename = os.environ.get('TEST_TYPENAME', None)
 8    assert(typename is not None)
 9    test_data = TestExampleTypes.get_test_data(typename)
10    print('SENDING: %s' % typename)
11    pprint.pprint(test_data)
12    return test_data
 1import os
 2from yggdrasil.examples.tests.test_types import TestExampleTypes
 3
 4
 5def dst(received_data):
 6    typename = os.environ.get('TEST_TYPENAME', None)
 7    assert(typename is not None)
 8    TestExampleTypes.check_received_data(typename, received_data)
 9    print('CONFIRMED: %s' % typename)
10    return

Model YAML:

 1models:
 2  - name: source
 3    language: python
 4    args: ./src/src.py
 5    function: src
 6
 7  - name: {{TEST_LANGUAGE}}_model
 8    language: {{TEST_LANGUAGE}}
 9    args: ./src/model{{TEST_LANGUAGE_EXT}}
10    function: model
11    {{TEST_MODEL_IO}}
12
13  - name: destination
14    language: python
15    args: ./src/dst.py
16    function: dst
17
18connections:
19  - input: source:output
20    output: {{TEST_LANGUAGE}}_model:input
21  - input: {{TEST_LANGUAGE}}_model:output
22    output: destination:input

C Version

Model Code:

 1import os
 2import pprint
 3from yggdrasil.examples.tests.test_types import TestExampleTypes
 4
 5
 6def src():
 7    typename = os.environ.get('TEST_TYPENAME', None)
 8    assert(typename is not None)
 9    test_data = TestExampleTypes.get_test_data(typename)
10    print('SENDING: %s' % typename)
11    pprint.pprint(test_data)
12    return test_data
 1import os
 2from yggdrasil.examples.tests.test_types import TestExampleTypes
 3
 4
 5def dst(received_data):
 6    typename = os.environ.get('TEST_TYPENAME', None)
 7    assert(typename is not None)
 8    TestExampleTypes.check_received_data(typename, received_data)
 9    print('CONFIRMED: %s' % typename)
10    return

Model YAML:

 1models:
 2  - name: source
 3    language: python
 4    args: ./src/src.py
 5    function: src
 6
 7  - name: {{TEST_LANGUAGE}}_model
 8    language: {{TEST_LANGUAGE}}
 9    args: ./src/model{{TEST_LANGUAGE_EXT}}
10    function: model
11    {{TEST_MODEL_IO}}
12
13  - name: destination
14    language: python
15    args: ./src/dst.py
16    function: dst
17
18connections:
19  - input: source:output
20    output: {{TEST_LANGUAGE}}_model:input
21  - input: {{TEST_LANGUAGE}}_model:output
22    output: destination:input

C++ Version

Model Code:

 1import os
 2import pprint
 3from yggdrasil.examples.tests.test_types import TestExampleTypes
 4
 5
 6def src():
 7    typename = os.environ.get('TEST_TYPENAME', None)
 8    assert(typename is not None)
 9    test_data = TestExampleTypes.get_test_data(typename)
10    print('SENDING: %s' % typename)
11    pprint.pprint(test_data)
12    return test_data
 1import os
 2from yggdrasil.examples.tests.test_types import TestExampleTypes
 3
 4
 5def dst(received_data):
 6    typename = os.environ.get('TEST_TYPENAME', None)
 7    assert(typename is not None)
 8    TestExampleTypes.check_received_data(typename, received_data)
 9    print('CONFIRMED: %s' % typename)
10    return

Model YAML:

 1models:
 2  - name: source
 3    language: python
 4    args: ./src/src.py
 5    function: src
 6
 7  - name: {{TEST_LANGUAGE}}_model
 8    language: {{TEST_LANGUAGE}}
 9    args: ./src/model{{TEST_LANGUAGE_EXT}}
10    function: model
11    {{TEST_MODEL_IO}}
12
13  - name: destination
14    language: python
15    args: ./src/dst.py
16    function: dst
17
18connections:
19  - input: source:output
20    output: {{TEST_LANGUAGE}}_model:input
21  - input: {{TEST_LANGUAGE}}_model:output
22    output: destination:input

Dummy Version

Model Code:

 1import os
 2import pprint
 3from yggdrasil.examples.tests.test_types import TestExampleTypes
 4
 5
 6def src():
 7    typename = os.environ.get('TEST_TYPENAME', None)
 8    assert(typename is not None)
 9    test_data = TestExampleTypes.get_test_data(typename)
10    print('SENDING: %s' % typename)
11    pprint.pprint(test_data)
12    return test_data
 1import os
 2from yggdrasil.examples.tests.test_types import TestExampleTypes
 3
 4
 5def dst(received_data):
 6    typename = os.environ.get('TEST_TYPENAME', None)
 7    assert(typename is not None)
 8    TestExampleTypes.check_received_data(typename, received_data)
 9    print('CONFIRMED: %s' % typename)
10    return

Model YAML:

 1models:
 2  - name: source
 3    language: python
 4    args: ./src/src.py
 5    function: src
 6
 7  - name: {{TEST_LANGUAGE}}_model
 8    language: {{TEST_LANGUAGE}}
 9    args: ./src/model{{TEST_LANGUAGE_EXT}}
10    function: model
11    {{TEST_MODEL_IO}}
12
13  - name: destination
14    language: python
15    args: ./src/dst.py
16    function: dst
17
18connections:
19  - input: source:output
20    output: {{TEST_LANGUAGE}}_model:input
21  - input: {{TEST_LANGUAGE}}_model:output
22    output: destination:input

Fortran Version

Model Code:

 1import os
 2import pprint
 3from yggdrasil.examples.tests.test_types import TestExampleTypes
 4
 5
 6def src():
 7    typename = os.environ.get('TEST_TYPENAME', None)
 8    assert(typename is not None)
 9    test_data = TestExampleTypes.get_test_data(typename)
10    print('SENDING: %s' % typename)
11    pprint.pprint(test_data)
12    return test_data
 1import os
 2from yggdrasil.examples.tests.test_types import TestExampleTypes
 3
 4
 5def dst(received_data):
 6    typename = os.environ.get('TEST_TYPENAME', None)
 7    assert(typename is not None)
 8    TestExampleTypes.check_received_data(typename, received_data)
 9    print('CONFIRMED: %s' % typename)
10    return

Model YAML:

 1models:
 2  - name: source
 3    language: python
 4    args: ./src/src.py
 5    function: src
 6
 7  - name: {{TEST_LANGUAGE}}_model
 8    language: {{TEST_LANGUAGE}}
 9    args: ./src/model{{TEST_LANGUAGE_EXT}}
10    function: model
11    {{TEST_MODEL_IO}}
12
13  - name: destination
14    language: python
15    args: ./src/dst.py
16    function: dst
17
18connections:
19  - input: source:output
20    output: {{TEST_LANGUAGE}}_model:input
21  - input: {{TEST_LANGUAGE}}_model:output
22    output: destination:input

Matlab Version

Model Code:

 1import os
 2import pprint
 3from yggdrasil.examples.tests.test_types import TestExampleTypes
 4
 5
 6def src():
 7    typename = os.environ.get('TEST_TYPENAME', None)
 8    assert(typename is not None)
 9    test_data = TestExampleTypes.get_test_data(typename)
10    print('SENDING: %s' % typename)
11    pprint.pprint(test_data)
12    return test_data
 1import os
 2from yggdrasil.examples.tests.test_types import TestExampleTypes
 3
 4
 5def dst(received_data):
 6    typename = os.environ.get('TEST_TYPENAME', None)
 7    assert(typename is not None)
 8    TestExampleTypes.check_received_data(typename, received_data)
 9    print('CONFIRMED: %s' % typename)
10    return

Model YAML:

 1models:
 2  - name: source
 3    language: python
 4    args: ./src/src.py
 5    function: src
 6
 7  - name: {{TEST_LANGUAGE}}_model
 8    language: {{TEST_LANGUAGE}}
 9    args: ./src/model{{TEST_LANGUAGE_EXT}}
10    function: model
11    {{TEST_MODEL_IO}}
12
13  - name: destination
14    language: python
15    args: ./src/dst.py
16    function: dst
17
18connections:
19  - input: source:output
20    output: {{TEST_LANGUAGE}}_model:input
21  - input: {{TEST_LANGUAGE}}_model:output
22    output: destination:input

OpenSimRoot Version

Model Code:

 1import os
 2import pprint
 3from yggdrasil.examples.tests.test_types import TestExampleTypes
 4
 5
 6def src():
 7    typename = os.environ.get('TEST_TYPENAME', None)
 8    assert(typename is not None)
 9    test_data = TestExampleTypes.get_test_data(typename)
10    print('SENDING: %s' % typename)
11    pprint.pprint(test_data)
12    return test_data
 1import os
 2from yggdrasil.examples.tests.test_types import TestExampleTypes
 3
 4
 5def dst(received_data):
 6    typename = os.environ.get('TEST_TYPENAME', None)
 7    assert(typename is not None)
 8    TestExampleTypes.check_received_data(typename, received_data)
 9    print('CONFIRMED: %s' % typename)
10    return

Model YAML:

 1models:
 2  - name: source
 3    language: python
 4    args: ./src/src.py
 5    function: src
 6
 7  - name: {{TEST_LANGUAGE}}_model
 8    language: {{TEST_LANGUAGE}}
 9    args: ./src/model{{TEST_LANGUAGE_EXT}}
10    function: model
11    {{TEST_MODEL_IO}}
12
13  - name: destination
14    language: python
15    args: ./src/dst.py
16    function: dst
17
18connections:
19  - input: source:output
20    output: {{TEST_LANGUAGE}}_model:input
21  - input: {{TEST_LANGUAGE}}_model:output
22    output: destination:input

Python Version

Model Code:

 1import os
 2import pprint
 3from yggdrasil.examples.tests.test_types import TestExampleTypes
 4
 5
 6def src():
 7    typename = os.environ.get('TEST_TYPENAME', None)
 8    assert(typename is not None)
 9    test_data = TestExampleTypes.get_test_data(typename)
10    print('SENDING: %s' % typename)
11    pprint.pprint(test_data)
12    return test_data
 1import os
 2from yggdrasil.examples.tests.test_types import TestExampleTypes
 3
 4
 5def dst(received_data):
 6    typename = os.environ.get('TEST_TYPENAME', None)
 7    assert(typename is not None)
 8    TestExampleTypes.check_received_data(typename, received_data)
 9    print('CONFIRMED: %s' % typename)
10    return

Model YAML:

 1models:
 2  - name: source
 3    language: python
 4    args: ./src/src.py
 5    function: src
 6
 7  - name: {{TEST_LANGUAGE}}_model
 8    language: {{TEST_LANGUAGE}}
 9    args: ./src/model{{TEST_LANGUAGE_EXT}}
10    function: model
11    {{TEST_MODEL_IO}}
12
13  - name: destination
14    language: python
15    args: ./src/dst.py
16    function: dst
17
18connections:
19  - input: source:output
20    output: {{TEST_LANGUAGE}}_model:input
21  - input: {{TEST_LANGUAGE}}_model:output
22    output: destination:input

SBML Version

Model Code:

 1import os
 2import pprint
 3from yggdrasil.examples.tests.test_types import TestExampleTypes
 4
 5
 6def src():
 7    typename = os.environ.get('TEST_TYPENAME', None)
 8    assert(typename is not None)
 9    test_data = TestExampleTypes.get_test_data(typename)
10    print('SENDING: %s' % typename)
11    pprint.pprint(test_data)
12    return test_data
 1import os
 2from yggdrasil.examples.tests.test_types import TestExampleTypes
 3
 4
 5def dst(received_data):
 6    typename = os.environ.get('TEST_TYPENAME', None)
 7    assert(typename is not None)
 8    TestExampleTypes.check_received_data(typename, received_data)
 9    print('CONFIRMED: %s' % typename)
10    return

Model YAML:

 1models:
 2  - name: source
 3    language: python
 4    args: ./src/src.py
 5    function: src
 6
 7  - name: {{TEST_LANGUAGE}}_model
 8    language: {{TEST_LANGUAGE}}
 9    args: ./src/model{{TEST_LANGUAGE_EXT}}
10    function: model
11    {{TEST_MODEL_IO}}
12
13  - name: destination
14    language: python
15    args: ./src/dst.py
16    function: dst
17
18connections:
19  - input: source:output
20    output: {{TEST_LANGUAGE}}_model:input
21  - input: {{TEST_LANGUAGE}}_model:output
22    output: destination:input

Timesync Version

Model Code:

 1import os
 2import pprint
 3from yggdrasil.examples.tests.test_types import TestExampleTypes
 4
 5
 6def src():
 7    typename = os.environ.get('TEST_TYPENAME', None)
 8    assert(typename is not None)
 9    test_data = TestExampleTypes.get_test_data(typename)
10    print('SENDING: %s' % typename)
11    pprint.pprint(test_data)
12    return test_data
 1import os
 2from yggdrasil.examples.tests.test_types import TestExampleTypes
 3
 4
 5def dst(received_data):
 6    typename = os.environ.get('TEST_TYPENAME', None)
 7    assert(typename is not None)
 8    TestExampleTypes.check_received_data(typename, received_data)
 9    print('CONFIRMED: %s' % typename)
10    return

Model YAML:

 1models:
 2  - name: source
 3    language: python
 4    args: ./src/src.py
 5    function: src
 6
 7  - name: {{TEST_LANGUAGE}}_model
 8    language: {{TEST_LANGUAGE}}
 9    args: ./src/model{{TEST_LANGUAGE_EXT}}
10    function: model
11    {{TEST_MODEL_IO}}
12
13  - name: destination
14    language: python
15    args: ./src/dst.py
16    function: dst
17
18connections:
19  - input: source:output
20    output: {{TEST_LANGUAGE}}_model:input
21  - input: {{TEST_LANGUAGE}}_model:output
22    output: destination:input