@@ -27,8 +27,6 @@ Memory-optimized with pre-allocated mapping structure:
2727- mapping[i][k_idx+1] → start index in V for block (i, nlist[i][k_idx])
2828"""
2929
30- kronecker_delta (x:: Int64 , y:: Int64 ) = == (x, y)
31-
3230function contraction! (C:: Array{Float64,4} , B:: Array{Float64,3} , dof:: Int64 ,
3331 CB:: AbstractArray{Float64,3} )
3432 fill! (CB, 0.0 )
@@ -257,24 +255,6 @@ function create_mapping_structure(nodes::AbstractVector{Int64},
257255 return mapping, I, J, V, n_total
258256end
259257
260- """
261- add_block_direct!(V, start_idx, block, dof)
262-
263- Add dof×dof block directly to V at start_idx.
264- """
265- @inline function add_block_direct! (V:: Vector{Float64} ,
266- start_idx:: Int64 ,
267- block:: AbstractMatrix{Float64} ,
268- dof:: Int64 )
269- idx = start_idx
270- @inbounds for n in 1 : dof
271- for m in 1 : dof
272- V[idx] += block[m, n]
273- idx += 1
274- end
275- end
276- end
277-
278258"""
279259 assemble_stiffness(...)
280260
@@ -445,7 +425,7 @@ function add_zero_energy_stiff!(K::SparseMatrixCSC{Float64,Int64},
445425 # TODO : not very memory efficient
446426 S_matrices = Vector {Matrix{Float64}} (undef, maximum (active_nodes))
447427 D_inv_X = Vector {Vector{Vector{Float64}}} (undef, maximum (active_nodes))
448- 1
428+
449429 for i in active_nodes
450430 neighbors = nlist[i]
451431 n_neighbors = length (neighbors)
@@ -472,10 +452,6 @@ function add_zero_energy_stiff!(K::SparseMatrixCSC{Float64,Int64},
472452 V_i = volume[i]
473453
474454 for (idx_j, j) in enumerate (neighbors)
475- if i == j
476- continue
477- end
478-
479455 scalar_sum_j = 0.0
480456 for idx_k in eachindex (neighbors)
481457 k = neighbors[idx_k]
@@ -487,7 +463,7 @@ function add_zero_energy_stiff!(K::SparseMatrixCSC{Float64,Int64},
487463 add_block_to_coo! (I_indices, J_indices, values, K_ji, j, i, dof)
488464
489465 for (idx_k, k) in enumerate (neighbors)
490- if k == i || k == j
466+ if k == j
491467 continue
492468 end
493469
@@ -505,17 +481,9 @@ function add_zero_energy_stiff!(K::SparseMatrixCSC{Float64,Int64},
505481 V_i = volume[i]
506482
507483 for (idx_j, j) in enumerate (neighbors)
508- if i == j
509- continue
510- end
511-
512484 K_ij_total = zeros (dof, dof)
513485
514486 for (idx_bond, bond_node) in enumerate (neighbors)
515- if bond_node == i
516- continue
517- end
518-
519487 if idx_bond == idx_j
520488 s_jj = S_matrices[i][idx_j, idx_j]
521489 K_ij_total .- = V_i *
@@ -590,10 +558,6 @@ function compute_bond_force(bond_force::Vector{Vector{Vector{Float64}}},
590558 i_offset = (i- 1 )* dof
591559
592560 for (j_idx, j) in enumerate (ni)
593- if i == j
594- continue
595- end
596-
597561 j_offset = (j- 1 )* dof
598562 f_ij = zeros (dof)
599563
0 commit comments