1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 """All the built-in objects for working with MBDyn.
23
24 The two mains objects are C{NULL} and C{EYE}, there is also C{MATRIX_NULL}
25 in use.
26 C{NULL} is the vector null of size 3x1
27 C{EYE} is the identity matrix of size 3x3
28
29 The class L{Real} and L{Int} were started at the beginning but are not in use,
30 all the pre processing is done from Python.
31 """
32 import numpy as N
33
35 """A MBDyn real for the input file
36 """
37
38 - def __init__(self, name=None, value=None, comment=None):
39 self.name = name
40 if not isinstance(value, float):
41 value = float(value)
42 self.value = value
43 self.comment = comment
44
47
49 return "real %s = %f " % (self.name, self.value)
50
51
53 """A MBDyn integer for the input file
54 """
55
56 - def __init__(self, name=None, value=None, comment=None):
57 self.name = name
58 if not isinstance(value, int):
59 value = int(value)
60 self.value = value
61 self.comment = comment
62
65
67 return "integer %s = %f " % (self.name, self.value)
68
69
71 """The vector Null
72 """
73
75 self.value = N.array([0., 0., 0.])
76 self.name = "null"
77
78
80 """The matrix Null
81 """
83 self.value = N.array([[0., 0., 0.],
84 [0., 0., 0.],
85 [0., 0., 0.]])
86 self.name = "null"
87
88
90 """The eye matrix
91 """
92
94 self.value = N.eye(3)
95 self.name = "eye"
96
97
98
99 NULL = Null()
100 MAT_NULL = MatrixNull()
101 EYE = Eye()
102
103
104 EYE_NAME = "Eye"
105 VECTOR_NAMES = ["Null"]
106 MATRIX_NAMES = ["Eye", "MatrixNull"]
107