You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add storage eltype to abstract assembler types (#1290)
* Add data storage type to assembler types
* Describe `AbstractAssembler` in devdocs
* Add test for correct number type
* Add tests for numeric types to CSR assembler
* Add type-check for block assembler
Copy file name to clipboardExpand all lines: docs/src/devdocs/assembly.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,19 @@
1
1
# [Assembly](@id devdocs-assembly)
2
2
3
-
The assembler handles the insertion of the element matrices and element vectors into the system matrix and right hand side.
3
+
An assembler handles the insertion of the element matrices and element vectors into the system matrix and vector.
4
+
and should *normally* (the exact interface is yet to be fully established) subtype `AbstractAssembler{T}`. Here `T` is the
5
+
`eltype` of the contained system matrix and vector. This allows the user to infer the eltype when preallocating the element
6
+
matrix and vector, e.g.
7
+
```julia
8
+
functiondoassemble!(assembler::Ferrite.AbstractAssembler{T}, ...) where {T}
9
+
Ke =zeros(T, n, n) # n = dofs per cell
10
+
fe =zeros(T, n)
11
+
for cell inCellIterator(...)
12
+
element_routine!(Ke, fe, cell, ...)
13
+
assemble!(assembler, celldofs(cell), Ke, fe)
14
+
end
15
+
end
16
+
```
4
17
5
18
## Custom matrix formats
6
19
While the CSC and CSR formats are the most common sparse matrix formats in practice, users might want to have optimized custom matrix formats for their specific use-case. The default assemblers [`Ferrite.CSCAssembler`](@ref) and [`Ferrite.CSRAssembler`](@ref) should be able to handle most cases in practice. To support a custom format users have to dispatch the following functions on their matrix type. There is the public interface
Assemble the square element stiffness matrix `Ke` (and optional force vector `fe`) into the global
266
266
stiffness (and force) in `A`, given the element degrees of freedom `dofs`.
267
267
268
268
This is equivalent to `K[dofs, dofs] += Ke` and `f[dofs] += fe`, where `K` is the global stiffness matrix and `f` the global force/residual vector, but more efficient.
0 commit comments