def test_sort_u1(self): K, u, f = self.kuf_set1() solver = KUFSolver(K, u, f, auto=False) solver._sort() expected = np.array([[1.], [None], [None]]) self.compare(expected, solver._u)
def test_sort_K1(self): K, u, f = self.kuf_set1() solver = KUFSolver(K, u, f, auto=False) solver._sort() expected = np.array([[5, 4, 6], [2, 1, 3], [8, 7, 9]]) self.compare(expected, solver._K)
def test_sort_indices1(self): K, u, f = self.kuf_set1() solver = KUFSolver(K, u, f, auto=False) solver._sort() expected = [1, 0, 2] self.compare(expected, solver._u_indices)
def test_solve_u2(self): K, u, f = self.kuf_set2() solver = KUFSolver(K, u, f) expected = np.array([-10., 0, -20.]) self.compare(expected, solver.u)
def test_solve_f2(self): K, u, f = self.kuf_set2() solver = KUFSolver(K, u, f) expected = np.array([10., 0., -10]) self.compare(expected, solver.f)
def test_unsort_u1(self): K, u, f = self.kuf_set1() solver = KUFSolver(K, u, f, auto=False) solver._sort() solver._u[1] = 10 solver._u[2] = 99 solver._unsort() expected = np.array([10, 1, 99]) self.compare(expected, solver.u)
def solve(self): """ Solve the truss system of equations and store the resulting displacement and load data. The Truss instance's 'displacement' and 'loads' attributes are updated in place. """ K = self.K u = self.u f = self.f solver = KUFSolver(K, u, f) self.displacements = self._vector_to_node_dict(solver.u) self.loads = self._vector_to_node_dict(solver.f)
def test_unsort_f1(self): K, u, f = self.kuf_set1() solver = KUFSolver(K, u, f, auto=False) solver._sort() solver._f[0] = 99 solver._unsort() expected = np.array([2, 99, 3]) self.compare(expected, solver.f)