From 8d4ea4120aa2382982016a16ab100f34641515e7 Mon Sep 17 00:00:00 2001
From: Ernesto Oquelis <ernesto.oquelis@gmail.com>
Date: Mon, 24 Sep 2018 22:47:40 +0200
Subject: [PATCH] update

---
 TEST.py   |  1 -
 TEST_2.py | 15 +++++----------
 fem_2d.py | 17 +++++++++--------
 3 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/TEST.py b/TEST.py
index c92540f..09255f9 100644
--- a/TEST.py
+++ b/TEST.py
@@ -14,7 +14,6 @@ def refine_grid(vertices, area):
 
 points = [(0,0),
           (1,0),
-          (1.5, 0.5),
           (1,1),
           (0,1)]
 
diff --git a/TEST_2.py b/TEST_2.py
index 4a84f99..8ce51b4 100644
--- a/TEST_2.py
+++ b/TEST_2.py
@@ -1,15 +1,13 @@
 import numpy as np
 from fem_2d import Structure2DPlaneStress, Force2D
 
-mesh_elements = np.array([[1, 3, 5],
-                          [4, 0, 5],
-                          [1, 2, 3],
-                          [5, 3, 4],
-                          [0, 1, 5]], dtype='int32')
+mesh_elements = np.array([[1, 2, 4],
+                          [3, 0, 4],
+                          [4, 2, 3],
+                          [0, 1, 4]], dtype='int32')
 
 mesh_points = np.array([[0. , 0. ],
                         [1. , 0. ],
-                        [1.5, 0.5],
                         [1. , 1. ],
                         [0. , 1. ],
                         [0.5, 0.5]], dtype='float64')
@@ -22,9 +20,6 @@ STR = Structure2DPlaneStress(mesh_elements, mesh_points,
 
 STRUCT = list()
 STRUCT.append(STR)
-NODES = STR.nodes_list
-ELEMENTS = STR.elements_list
-
 
 STR.nodes_list[2].force_2d = Force2D([1,1])
-STR.solve()
+k_global, k_e, node_ids, k_g_ix, k_g_indexes = STR.solve()
diff --git a/fem_2d.py b/fem_2d.py
index f1e1c50..7091f86 100644
--- a/fem_2d.py
+++ b/fem_2d.py
@@ -174,18 +174,19 @@ class Structure2DPlaneStress:
 
         # Assembles stiffness matrix
         for element_id in range(self.num_elements):
-            k_e_indexes = list()
+            k_g_ix = list()
             node_ids = self.elements_list[element_id].node_ids
             k_e = self.elements_list[element_id].get_k_mat(self.thickness,
-                                                      self.c_mat)
-            for ix in node_ids:
-                k_e_indexes.append(ix * 2)
-                k_e_indexes.append(ix * 2 + 1)
+                                                           self.c_mat)
+            for i_x in node_ids:
+                k_g_ix.append(i_x * 2)
+                k_g_ix.append(i_x * 2 + 1)
 
-            
-
-        
+        return k_global, k_e, node_ids, k_g_ix
 '''
+
+
+
             for (i, j) in [(i,j) for i in node_ids for j in node_ids]:
                 
 
-- 
GitLab