Skip to content

Commit

Permalink
Add sparsity pattern generator for CSR.
Browse files Browse the repository at this point in the history
  • Loading branch information
termi-official committed Dec 28, 2023
1 parent 4a47a3f commit d227ef7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ext/FerriteSparseMatrixCSR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,11 @@ function Ferrite.zero_out_columns!(K::SparseMatrixCSR, ch::ConstraintHandler)
end
end

function Ferrite.create_sparsity_pattern(::Type{<:SparseMatrixCSR}, dh, ch; kwargs...)
# create SparseMatrixCSC
K = create_sparsity_pattern(dh, ch; kwargs...)
# transform to SparseMatrixCSR
return SparseMatrixCSR(transpose(sparse(transpose(K))))
end

end
4 changes: 2 additions & 2 deletions src/assembler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Assembles the element residual `ge` into the global residual vector `g`.
end
end

abstract type AbstractSparseAssembler{MT <: AbstractSparseMatrix} end
abstract type AbstractSparseAssembler end

"""
matrix_handle(a::AbstractSparseAssembler)
Expand All @@ -99,7 +99,7 @@ Return a reference to the underlying matrix/vector of the assembler.
"""
matrix_handle, vector_handle

struct AssemblerSparsityPattern{Tv, MT <: Union{AbstractSparseMatrix{Tv}, Symmetric{Tv,<:AbstractSparseMatrix{Tv}}}} <: AbstractSparseAssembler{MT}
struct AssemblerSparsityPattern{Tv, MT <: Union{AbstractSparseMatrix{Tv}, Symmetric{Tv,<:AbstractSparseMatrix{Tv}}}} <: AbstractSparseAssembler
K::MT
f::Vector{Tv}
permutation::Vector{Int}
Expand Down

0 comments on commit d227ef7

Please sign in to comment.