COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-python-math.py
Go to the documentation of this file.
1 import coolfluid as cf
2 
3 a = 0.2345678901234567890
4 b = 1.2345678901234567890
5 
6 test = cf.Core.root().create_component('Test', 'cf3.python.TestSignals')
7 
8 # test setting and reading a property
9 test.real = a
10 if not abs(cf.math.float_distance(a, test.real)) < 1:
11  raise Exception('test.real ({r}) differs from expected value {a}'.format(r = test.real, a = a))
12 else:
13  print 'distance between {a} and {r} is {d}'.format(a = repr(a), r = repr(test.real), d = cf.math.float_distance(a, test.real))
14 
15 # test setting through a signal
16 test.set_real(b)
17 if not abs(cf.math.float_distance(b, test.real)) < 1:
18  raise Exception('test.real ({r}) differs from expected value {b}'.format(r = test.real, b = b))
19 else:
20  print 'distance between {a} and {r} is {d}'.format(a = repr(b), r = repr(test.real), d = cf.math.float_distance(b, test.real))
boost::python::object create_component(ComponentWrapper &self, const std::string &name, const std::string &builder_name)
Send comments to:
COOLFluiD Web Admin