@@ -0,0 +1,1386 @@
+#!/usr/bin/env python%0A#-*- coding: utf-8 -*-%0A%0Afrom __future__ import print_function%0A%0Aimport viennagrid%0A%0Aconfig = viennagrid.config.linear_1d%0A%0Adomain = viennagrid.Domain(config)%0Adomain.add_vertex(viennagrid.Point(1))%0Adomain.add_vertex(viennagrid.Point(2))%0Adomain.add_vertex(viennagrid.Point(3))%0Adomain.add_vertex(viennagrid.Point(4))%0A%0Asegmentation = viennagrid.Segmentation(domain)%0Aseg0 = segmentation.create_segment()%0Aseg1 = segmentation.create_segment()%0A%0Av0 = domain.vertices%5B0%5D%0Av1 = domain.vertices%5B1%5D%0Acell = seg0.create_cell(v0, v1)%0A%0Av0 = domain.vertices%5B0%5D%0Av1 = domain.vertices%5B2%5D%0Acell = seg0.create_cell(v0, v1)%0A%0Av0 = domain.vertices%5B1%5D%0Av1 = domain.vertices%5B2%5D%0Acell = seg1.create_cell(v0, v1)%0A%0Av0 = domain.vertices%5B1%5D%0Av1 = domain.vertices%5B3%5D%0Acell = seg1.create_cell(v0, v1)%0A%0Aprint('%5CnDomain has', len(domain.vertices), 'vertices:%5Cn')%0Afor i, vertex in enumerate(domain.vertices):%0A%09print('%5CtVertex ', i, ': ', 'coordinates', sep='') # TODO: wrap ID and coords, like examples/tutorial/domain_setup%0Aelse:%0A%09print()%0A%0Aprint('Segmentation has', len(segmentation.segments), 'segments:%5Cn')%0Afor i, segment in enumerate(segmentation.segments):%0A%09print('%5CtSegment seg', i, ' has ', len(segment.cells), ' cells:%5Cn', sep='')%0A%09for cell in segment.cells:%0A%09%09print('%5Ct%5CtCell has', len(cell.vertices), 'vertices:') # TODO: wait until coords of vertices can be read (see previous TODO)%0A%09else:%0A%09%09print()%0A

Write example code 'domain_setup_linear1d.py'.