@@ -16,27 +16,11 @@ function destroy(M::AbstractMat{PetscLib}) where {PetscLib}
1616 return nothing
1717end
1818
19- """
20- MatSeqAIJ{PetscLib, PetscScalar}
21-
22- PETSc sparse array using AIJ format (also known as a compressed sparse row or
23- CSR format).
24-
25- Memory allocation is handled by PETSc.
26-
27- # External Links
28- $(_doc_external (" Mat/MatCreateSeqAIJ" ))
29- """
30- mutable struct MatSeqAIJ{PetscLib, PetscScalar} < :
31- AbstractMat{PetscLib, PetscScalar}
32- ptr:: CMat
33- end
34-
3519"""
3620 MatSeqAIJ(petsclib, num_rows, num_cols, nonzeros)
3721
38- Create a PETSc sparse array using AIJ format (also known as a compressed sparse
39- row or CSR format) of size `num_rows X num_cols` with `nonzeros` per row
22+ Create a PETSc serial sparse array using AIJ format (also known as a compressed
23+ sparse row or CSR format) of size `num_rows X num_cols` with `nonzeros` per row
4024
4125If `nonzeros` is an `Integer` the same number of non-zeros will be used for each
4226row, if `nonzeros` is a `Vector{PetscInt}` then one value must be specified for
@@ -47,6 +31,11 @@ Memory allocation is handled by PETSc and garbage collection can be used.
4731# External Links
4832$(_doc_external (" Mat/MatCreateSeqAIJ" ))
4933"""
34+ mutable struct MatSeqAIJ{PetscLib, PetscScalar} < :
35+ AbstractMat{PetscLib, PetscScalar}
36+ ptr:: CMat
37+ end
38+
5039function MatSeqAIJ (
5140 petsclib:: PetscLib ,
5241 num_rows:: Integer ,
@@ -112,53 +101,54 @@ function MatSeqDense(
112101end
113102
114103"""
115- assemble(M::AbstractMat[, t::MatAssemblyType = MAT_FINAL_ASSEMBLY)
104+ assemble! (M::AbstractMat[, t::MatAssemblyType = MAT_FINAL_ASSEMBLY)
116105
117106Assemble the matrix `M` with assembly type `t`.
118107
119- For overlapping assembly see [`assemblybegin`](@ref) and [`assemblyend`](@ref)
108+ For overlapping assembly see [`assemblybegin! `](@ref) and [`assemblyend! `](@ref)
120109
121110# External Links
122111$(_doc_external (" Mat/MatAssemblyBegin" ))
123112$(_doc_external (" Mat/MatAssemblyEnd" ))
124113"""
125- function assemble (M:: AbstractMat , t:: MatAssemblyType = MAT_FINAL_ASSEMBLY)
126- assemblybegin (M, t)
127- assemblyend (M, t)
114+ function assemble! (M:: AbstractMat , t:: MatAssemblyType = MAT_FINAL_ASSEMBLY)
115+ assemblybegin! (M, t)
116+ assemblyend! (M, t)
117+ return M
128118end
129119
130120"""
131- assemblybegin(M::AbstractMat[, t::MatAssemblyType = MAT_FINAL_ASSEMBLY)
121+ assemblybegin! (M::AbstractMat[, t::MatAssemblyType = MAT_FINAL_ASSEMBLY)
132122
133123Begin assembly of the matrix `M` with assembly type `t`; finished with
134- [`assemblyend`](@ref).
124+ [`assemblyend! `](@ref).
135125
136126# External Links
137127$(_doc_external (" Mat/MatAssemblyBegin" ))
138128"""
139- function assemblybegin (
129+ function assemblybegin! (
140130 M:: AbstractMat{PetscLib} ,
141131 t:: MatAssemblyType = MAT_FINAL_ASSEMBLY,
142132) where {PetscLib}
143133 LibPETSc. MatAssemblyBegin (PetscLib, M, t)
144- return nothing
134+ return M
145135end
146136
147137"""
148- assemblyend(M::AbstractMat[, t::MatAssemblyType = MAT_FINAL_ASSEMBLY)
138+ assemblyend! (M::AbstractMat[, t::MatAssemblyType = MAT_FINAL_ASSEMBLY)
149139
150140Finish assembly of the matrix `M` with assembly type `t`; start assembly with
151- [`assemblybegin`](@ref).
141+ [`assemblybegin! `](@ref).
152142
153143# External Links
154144$(_doc_external (" Mat/MatAssemblyEnd" ))
155145"""
156- function assemblyend (
146+ function assemblyend! (
157147 M:: AbstractMat{PetscLib} ,
158148 t:: MatAssemblyType = MAT_FINAL_ASSEMBLY,
159149) where {PetscLib}
160150 LibPETSc. MatAssemblyEnd (PetscLib, M, t)
161- return nothing
151+ return M
162152end
163153
164154function Base. size (A:: AbstractMat{PetscLib} ) where {PetscLib}
@@ -193,7 +183,7 @@ Base.show(io::IO, ::MIME"text/plain", mat::AbstractMat) = _show(io, mat)
193183 row0idxs::Vector{PetscInt},
194184 col0idxs::Vector{PetscInt},
195185 rowvals::Array{PetscScalar},
196- insertmode::InsertMode;
186+ insertmode::InsertMode = INSERT_VALUES ;
197187 num_rows = length(row0idxs),
198188 num_cols = length(col0idxs)
199189 )
@@ -212,7 +202,7 @@ function setvalues!(
212202 row0idxs:: Vector{PetscInt} ,
213203 col0idxs:: Vector{PetscInt} ,
214204 rowvals:: Array{PetscScalar} ,
215- insertmode:: InsertMode ;
205+ insertmode:: InsertMode = INSERT_VALUES ;
216206 num_rows = length (row0idxs),
217207 num_cols = length (col0idxs),
218208) where {PetscLib, PetscScalar, PetscInt}
0 commit comments