COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-python-component.py
Go to the documentation of this file.
1 import coolfluid as cf
2 import sys
3 
4 cf.Core.environment().options().set('log_level', 4)
5 
6 root = cf.Core.root()
7 
8 parent = root.create_component('parent', 'cf3.common.Group')
9 
10 parent.create_component('child01', 'cf3.common.Group').mark_basic()
11 
12 child02 = parent.create_component('child02', 'cf3.common.Group')
13 child02.mark_basic()
14 
15 print parent.child01
16 print parent.child02
17 
18 parent.mark_basic()
19 
20 parent.child02.create_component('child03', 'cf3.common.Group').mark_basic()
21 
22 print parent.child02.child03
23 
24 
25 l = range(0,6)
26 # Valid child access methods
27 l[0] = parent.child02 # This only works because child02 is marked as basic
28 l[1] = parent.get_child('child02')
29 l[2] = parent.children.child02
30 l[3] = parent.children['child02']
31 l[4] = parent.children().child02
32 l[5] = parent.children()['child02']
33 
34 for child in l:
35  cf.cf_check(child == child02, "Invalid child in list")
36 
37 
38 # Iteration over children
39 l = []
40 for comp_name in parent.children.keys():
41  l.append(parent.children[comp_name])
42 
43 for child in l:
44  cf.cf_check(child == parent.get_child(child.name()), "Invalid child in list")
Send comments to:
COOLFluiD Web Admin