FEMSparse.add!
— Methodadd!(A, i, j, v)
Add new value to sparse matrix A
to location (i
,j
).
FEMSparse.assemble_local_matrix!
— Methodassemble!(A::AssemblerSparsityPattern, dofs2, Ke)
Assemble a local dense element matrix Ke
into the sparse matrix wrapped by the assembler A
. location given by lists of indices dofs1
and dofs2
.
Example
using SparseArrays
sparsity_pattern = sparse([1. 0 1; 1 0 1; 1 1 1])
fill!(sparsity_pattern, 0)
assembler = FEMSparse.start_assemble(sparsity_pattern)
dofs = [1, 3]
Ke = [1.0 2.0; 3.0 4.0]
FEMSparse.FEMSparse.assemble_local_matrix!(assembler, dofs, Ke)
Matrix(sparsity_pattern)
# output
julia> Matrix(sparsity_pattern)
3×3 Array{Float64,2}:
1.0 0.0 2.0
0.0 0.0 0.0
3.0 0.0 4.0
FEMSparse.assemble_local_matrix!
— Methodassemble!(K, dofs1, dofs2, Ke)
Assemble a local dense element matrix Ke
to a global sparse matrix K
, to the location given by lists of indices dofs1
and dofs2
.
Example
dofs1 = [3, 4]
dofs2 = [6, 7, 8]
Ke = [5.0 6.0 7.0; 8.0 9.0 10.0]
K = SparseMatrixCOO()
assemble!(K, dofs1, dofs2, Ke)
Matrix(K)
# output
4x8 Array{Float64,2}:
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 5.0 6.0 7.0
0.0 0.0 0.0 0.0 0.0 8.0 9.0 10.0
FEMSparse.assemble_local_vector!
— Methodassemble_local_vector!(f, dofs, fe)
Assembles the element residual fe
into the global residual vector f
.
FEMSparse.start_assemble
— Functionstart_assemble(K::SparseMatrixCSC, [f::Vector])
Create an AssemblerSparsityPattern
from the sparsity pattern in K
and optionally a "force" vector.