Skip to content

Commit

Permalink
additional methods for VoronoiFVM: nnznew
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Jul 2, 2024
1 parent 8d7b216 commit 4437971
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ExtendableSparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ STExtendableSparseMatrixCSC(m,n,args...)=STExtendableSparseMatrixCSC{Float64,Int


export ExtendableSparseMatrixCSC, MTExtendableSparseMatrixCSC, STExtendableSparseMatrixCSC, GenericMTExtendableSparseMatrixCSC
export SparseMatrixLNK, ExtendableSparseMatrix,flush!, nnz, updateindex!, rawupdateindex!, colptrs, sparse, reset!
export SparseMatrixLNK, ExtendableSparseMatrix,flush!, nnz, updateindex!, rawupdateindex!, colptrs, sparse, reset!, nnznew
export partitioning!

export eliminate_dirichlet, eliminate_dirichlet!, mark_dirichlet
Expand Down
3 changes: 2 additions & 1 deletion src/matrix/extendable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ function rawupdateindex!(ext::ExtendableSparseMatrixCSC{Tv, Ti},
op,
v,
i,
j) where {Tv, Ti <: Integer}
j,
part=1) where {Tv, Ti <: Integer}
k = findindex(ext.cscmatrix, i, j)
if k > 0
ext.cscmatrix.nzval[k] = op(ext.cscmatrix.nzval[k], v)
Expand Down
2 changes: 2 additions & 0 deletions src/matrix/genericextendablesparsematrixcsc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ function GenericExtendableSparseMatrixCSC{Tm, Tv, Ti}(m::Integer,n::Integer) whe
end


nnznew(ext::GenericExtendableSparseMatrixCSC)=nnz(ext.xmatrix)

function reset!(ext::GenericExtendableSparseMatrixCSC{Tm,Tv,Ti}) where {Tm,Tv,Ti}
m,n=size(ext.cscmatrix)
ext.cscmatrix=spzeros(Tv, Ti, m, n)
Expand Down
3 changes: 3 additions & 0 deletions src/matrix/genericmtextendablesparsematrixcsc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ function Base.getindex(ext::GenericMTExtendableSparseMatrixCSC,
end
end

nnznew(ext::GenericMTExtendableSparseMatrixCSC)=sum(nnz,ext.xmatrices)


function rawupdateindex!(ext::GenericMTExtendableSparseMatrixCSC,
op,
v,
Expand Down

0 comments on commit 4437971

Please sign in to comment.