from numpy import *

# The geometry of the structural nodes 
geometry = array([[0, 0 ], [ 5, 0 ], [ 10, 0 ], [ 10, 5 ], [ 5, 5 ], [ 0, 5 ]])

# A connectivity matrix defines how nodes are connected with beams. a row contains ( beam - node - node )
connectivity = array([ [ 0, 0, 1 ], [ 1, 1, 2 ], [ 2, 2, 3 ], [ 3, 3, 4 ], [ 4, 4, 5 ], [ 5, 1, 5 ], [ 6, 0, 4 ], [ 7, 4, 2 ], [ 8, 1, 3 ], [9, 1, 4] ])
nbeams = connectivity.shape[0]

#--------
# MESHING
#--------

# Now subdivide each beam into a number of elements, in an element freedom table (eft)
subdivide = 10
eft = zeros((subdivide * nbeams , 3))
eft[:,0] = arange(0,subdivide * nbeams)
for i in range(0,nbeams,1):
	eft[i*subdivide,1] = subdivide*connectivity[i,1]
#elements[:,2] = elements[:,1]+1


#--------
# STIFFNESS MATRIX
#--------

nelem = eft.shape[0]
K = zeros((nelem*3, nelem*3))
