@@ -31,7 +31,7 @@ Assembly of a matrix allocating output
31
31
"""
32
32
function assemble (
33
33
:: Assembler{M,V} ,
34
- :: Vararg{Tuple{<:CellMatrix,<:CellNumber}} ):: M where {M,V}
34
+ :: Vararg{Tuple{<:CellMatrix,<:CellNumber,<:CellNumber }} ):: M where {M,V}
35
35
@abstractmethod
36
36
end
37
37
@@ -51,22 +51,34 @@ In-place assembly of a matrix (allows a LOT of optimizations)
51
51
function assemble! (
52
52
:: M ,
53
53
:: Assembler{M,V} ,
54
- :: Vararg{Tuple{<:CellMatrix,<:CellNumber}} ):: M where {M,V}
54
+ :: Vararg{Tuple{<:CellMatrix,<:CellNumber,<:CellNumber }} ):: M where {M,V}
55
55
@abstractmethod
56
56
end
57
57
58
- function assemble (a:: Assembler ,cv:: CellArray )
58
+ function assemble (a:: Assembler ,cv:: CellVector )
59
59
l = length (cv)
60
60
ide = IdentityCellNumber (Int,l)
61
61
assemble (a,(cv,ide))
62
62
end
63
63
64
- function assemble! (r,a:: Assembler ,cv:: CellArray )
64
+ function assemble (a:: Assembler ,cv:: CellMatrix )
65
+ l = length (cv)
66
+ ide = IdentityCellNumber (Int,l)
67
+ assemble (a,(cv,ide,ide))
68
+ end
69
+
70
+ function assemble! (r,a:: Assembler ,cv:: CellVector )
65
71
l = length (cv)
66
72
ide = IdentityCellNumber (Int,l)
67
73
assemble! (r,a,(cv,ide))
68
74
end
69
75
76
+ function assemble! (r,a:: Assembler ,cv:: CellMatrix )
77
+ l = length (cv)
78
+ ide = IdentityCellNumber (Int,l)
79
+ assemble! (r,a,(cv,ide,ide))
80
+ end
81
+
70
82
"""
71
83
Assembler that produces SparseMatrices from the SparseArrays package
72
84
"""
@@ -116,19 +128,19 @@ end
116
128
117
129
function assemble (
118
130
this:: SparseMatrixAssembler{E} ,
119
- allvals:: Vararg{Tuple{<:CellMatrix,<:CellNumber}} ) where E
131
+ allvals:: Vararg{Tuple{<:CellMatrix,<:CellNumber,<:CellNumber }} ) where E
120
132
121
133
I = Int
122
134
aux_row = I[]; aux_col = I[]; aux_val = E[]
123
135
124
136
_rows_m = celldofids (this. testfesp)
125
137
_cols_m = celldofids (this. trialfesp)
126
138
127
- for (vals,cellids ) in allvals
128
- _vals = apply_constraints_rows (this. testfesp, vals, cellids )
129
- rows_m = reindex (_rows_m, cellids )
130
- vals_m = apply_constraints_cols (this. trialfesp, _vals, cellids )
131
- cols_m = reindex (_cols_m, cellids )
139
+ for (vals, cellids_row, cellids_col ) in allvals
140
+ _vals = apply_constraints_rows (this. testfesp, vals, cellids_row )
141
+ rows_m = reindex (_rows_m, cellids_row )
142
+ vals_m = apply_constraints_cols (this. trialfesp, _vals, cellids_col )
143
+ cols_m = reindex (_cols_m, cellids_col )
132
144
_assemble_sparse_matrix_values! (
133
145
aux_row,aux_col,aux_val,vals_m,rows_m,cols_m)
134
146
end
154
166
function assemble! (
155
167
mat:: SparseMatrixCSC{E} ,
156
168
this:: SparseMatrixAssembler{E} ,
157
- vals:: Vararg{Tuple{<:CellMatrix,<:CellNumber}} ) where E
169
+ vals:: Vararg{Tuple{<:CellMatrix,<:CellNumber,<:CellNumber }} ) where E
158
170
# This routine can be optimized a lot taking into a count the sparsity graph of mat
159
171
# For the moment we create an intermediate matrix and then transfer the nz values
160
172
m = assemble (this,vals... )
0 commit comments