@@ -107,29 +107,27 @@ function build_assembler!(CD::CombineDofs{UT, CT}, FE::Array{<:FEVectorBlock, 1}
107107
108108 function assemble! (A:: AbstractSparseArray{T} , b:: AbstractVector{T} , assemble_matrix:: Bool , assemble_rhs:: Bool , kwargs... ) where {T}
109109 if assemble_matrix
110+
111+ @views AT = sparse (A. cscmatrix[fixed_dofs .+ offsetX, :]' )
112+
110113 # go through each constrained dof and update the FE adjacency info
111114 # of the coupled dofs
112- for dof_i in fixed_dofs
115+ for (i, dof_i) in enumerate ( fixed_dofs)
113116 # this col-view is efficient
114117 coupling_i = @views coupling_matrix[:, dof_i]
115118
116- # write the FE adjacency of the constrained dofs into this row
117- sourcerow = dof_i + offsetX
118-
119119 # extract the constrained dofs and the weights
120120 coupled_dofs_i, weights_i = findnz (coupling_i)
121121
122122 # parse through sourcerow and add the contents to the coupled dofs
123- for col in 1 : size (A, 2 )
124- r = findindex (A. cscmatrix, sourcerow, col)
125- if r > 0
126- val = A. cscmatrix. nzval[r]
127- if abs (val) > 1.0e-15
128- for (dof_k, weight_ik) in zip (coupled_dofs_i, weights_i)
129- targetrow = dof_k + offsetX
130- _addnz (A, targetrow, col, val, weight_ik)
131- end
132- end
123+ A_row = @views AT[:, i]
124+ cols_i, vals_i = findnz (A_row)
125+
126+ # copy values of sourcerow to the coupled targetrow
127+ for (col, val) in zip (cols_i, vals_i)
128+ for (dof_k, weight_ik) in zip (coupled_dofs_i, weights_i)
129+ targetrow = dof_k + offsetX
130+ _addnz (A, targetrow, col, val, weight_ik)
133131 end
134132 end
135133 end
0 commit comments