0

I have information of element connectivity in problem of finite element method. For example, 1, 5, 6, 8, 7, 1, 2, 4, 3 The first column is the index of element, and the last 8 columns are the node index which composed entries for element 1.

The goal what I want is node array like as below. It is an array with all the node indices associated with each node.

node_arr[1] = [2 3 4 5 6 7 8]
node_arr[2] = [1 3 4 5 6 7 8]
node_arr[3] = [1 2 4 5 6 7 8]
node_arr[4] = [1 2 3 5 6 7 8]
node_arr[5] = [1 2 3 4 6 7 8]
node_arr[6] = [1 2 3 4 5 7 8]
node_arr[7] = [1 2 3 4 5 6 8]
node_arr[8] = [1 2 3 4 5 6 7]

So the current state of my code is as below . 1-count the number about how many elements contain that node index

for loop i  (entire node){
   for loop j  (entire element){
     if (element j has node i is true){
         node_count[i] = node_count[i] + 1;
      }
    }
}     

2-Allocate node_node_arr to contain target information by using the results of step 1

node_node_arr = malloc(by using node_count)

3-Again, it searches the entire element node index and append the node index related with current node index for composing node_node_array.

for loop i  (entire node){
   for loop j  (entire element){
     if (element j has node i is true){
        node_node_arr[i] append node indices;
     }
   }
}

However this approach is so slow . If both the number of elements and the number of nodes increase, the calculation time increases tremendously. I need speed up. Please help me.

Song
  • 13
  • 3

0 Answers0