MCPcopy Create free account
hub / github.com/Apress/python-for-matlab-development / add_element

Method add_element

pythran/fem/FE_model.py:94–122  ·  view source on GitHub ↗
(self, eid, kV, I, J, M)

Source from the content-addressed store, hash-verified

92 # }}}
93 #pythran export add_element(str, int, float list, int list, int list)
94 def add_element(self, eid, kV, I, J, M): # {{{
95 E = self.elem[eid]
96 nAx = 2*E.node_a.id; nAy = nAx + 1
97 nBx = 2*E.node_b.id; nBy = nBx + 1
98
99 I.append(nAx); J.append(nAx)
100 I.append(nAx); J.append(nAy)
101 I.append(nAx); J.append(nBx)
102 I.append(nAx); J.append(nBy)
103
104 I.append(nAy); J.append(nAx)
105 I.append(nAy); J.append(nAy)
106 I.append(nAy); J.append(nBx)
107 I.append(nAy); J.append(nBy)
108
109 I.append(nBx); J.append(nAx)
110 I.append(nBx); J.append(nAy)
111 I.append(nBx); J.append(nBx)
112 I.append(nBx); J.append(nBy)
113
114 I.append(nBy); J.append(nAx)
115 I.append(nBy); J.append(nAy)
116 I.append(nBy); J.append(nBx)
117 I.append(nBy); J.append(nBy)
118
119 kV.extend(E.stiffness_matrix().ravel())
120 dof = np.array([2*E.node_a.id, 2*E.node_a.id+1,
121 2*E.node_b.id, 2*E.node_b.id+1,])
122 M[np.ix_(dof)] += E.mass_matrix()
123 # }}}
124 def __str__(self): # {{{
125 S = self.print_summary(str=True)

Callers 1

KMMethod · 0.95

Calls 2

stiffness_matrixMethod · 0.45
mass_matrixMethod · 0.45

Tested by

no test coverage detected