TopDl: example2.py

File example2.py, 396 bytes (added by faber, 7 years ago)

Python topdl example

Line 
1#!/usr/bin/env python
2
3from deter import topdl
4
5subs = [ ]
6elems = [ ]
7
8subs.append(topdl.Substrate(name='link0'))
9
10for elem_name in ('a', 'b'):
11    inf = topdl.Interface(name='inf000', substrate=['link0'])
12    elem = topdl.Computer(name=elem_name, interface=[inf])
13    elems.append(elem)
14
15top = topdl.Topology(substrates=subs, elements=elems)
16
17print topdl.topology_to_xml(top, top='experiment')