Skip to content

Commit 92d97f6

Browse files
Merge master
2 parents 6f0b4e7 + ed2c8a8 commit 92d97f6

51 files changed

Lines changed: 956 additions & 447 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/Check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- uses: julia-actions/setup-julia@v2
2525
with:
2626
version: '1.11'
27-
- uses: julia-actions/cache@v2
27+
- uses: julia-actions/cache@v3
2828
- uses: fredrikekre/runic-action@v1
2929
with:
3030
version: "1.4" # Keep version in sync with .pre-commit-config.yaml
@@ -37,7 +37,7 @@ jobs:
3737
# - uses: julia-actions/setup-julia@v2
3838
# with:
3939
# version: '1'
40-
- uses: julia-actions/cache@v2
40+
- uses: julia-actions/cache@v3
4141
- uses: julia-actions/julia-buildpkg@v1
4242
- name: Install dependencies
4343
shell: julia {0}

.github/workflows/Documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: julia-actions/setup-julia@v2
1515
with:
1616
version: '1.12'
17-
- uses: julia-actions/cache@v2
17+
- uses: julia-actions/cache@v3
1818
- name: Install dependencies
1919
run: julia --project=docs -e 'using Pkg; Pkg.instantiate(); Pkg.precompile()'
2020
- name: Build and deploy

.github/workflows/Downstream.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- uses: julia-actions/setup-julia@v2
3434
with:
3535
version: ${{ matrix.julia-version }}
36-
- uses: julia-actions/cache@v2
36+
- uses: julia-actions/cache@v3
3737
# - uses: julia-actions/julia-buildpkg@v1
3838
- name: Clone Downstream
3939
uses: actions/checkout@v6

.github/workflows/SpellCheck.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Spell Check
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
typos-check:
7+
name: Spell Check with Typos
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout Actions Repository
11+
uses: actions/checkout@v6
12+
- name: Check spelling
13+
uses: crate-ci/typos@v1.45.0

.github/workflows/Test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- uses: julia-actions/setup-julia@v2
2525
with:
2626
version: ${{ matrix.julia-version }}
27-
- uses: julia-actions/cache@v2
27+
- uses: julia-actions/cache@v3
2828
- uses: julia-actions/julia-buildpkg@v1
2929
- uses: julia-actions/julia-runtest@v1
3030
- name: JET tests
@@ -34,11 +34,11 @@ jobs:
3434
Pkg.add("JET")
3535
Pkg.develop(path = pwd())
3636
include(joinpath(pwd(), "test/jet.jl"))
37-
if: ${{ matrix.os == 'ubuntu-latest' && matrix.julia-version != 'nightly' }}
37+
if: ${{ matrix.os == 'ubuntu-latest' && matrix.julia-version != 'pre' }}
3838
- uses: julia-actions/julia-processcoverage@v1
3939
with:
4040
directories: 'src,ext'
41-
- uses: codecov/codecov-action@v5
41+
- uses: codecov/codecov-action@v6
4242
with:
4343
files: lcov.info
4444
plugins: noop

.typos.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[files]
2+
extend-exclude = ["*.svg", "*.toml"]
3+
4+
[default.extend-words]
5+
ue = "ue"
6+
ba = "ba"
7+
nd = "nd"
8+
9+
[type.qrtables]
10+
extend-glob = ["**/gaussquad_*_table.jl", "**/generate_quadrature.jl"]
11+
12+
[type.qrtables.extend-words]
13+
Methode = "Methode"
14+
Numer = "Numer"
15+
Secrest = "Secrest"
16+
17+
[type.feintro]
18+
extend-glob = ["**/fe_intro.md"]
19+
20+
[type.feintro.extend-words]
21+
Strang = "Strang"

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
### Added
2222
- Support for directly assembling to `SparseMatrixCSR` (from `SparseMatricesCSR.jl`). ([#864])
2323
- Enhance `generate_grid` to support outputting line meshes embedded in two and three
24-
spatial dimentions. ([#1122], [#1214])
24+
spatial dimensions. ([#1122], [#1214])
2525

2626
### Fixes
2727
- Fix L2 projection of tensor fields on discontinuous interpolations. ([#1197], [#1198])
@@ -32,11 +32,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232
[#1235])
3333
- Relax vector input type from `Vector` to `AbstractVector` in `evaluate_at_points!`.
3434
([#1183])
35+
- The result of grid coloring is now not dependent on iteration order of dictionaries and sets. This may change the coloring obtained from `create_coloring`
36+
compared to previous Ferrite versions.
3537

3638
### Documentation updates
3739
- Extended assembly docs with information on how to support direct assembly into new matrix
3840
types. ([#864])
39-
- Add a list of reserach papers where Ferrite was used for numbeir simulations. Please add
41+
- Add a list of research papers where Ferrite was used for simulations. Please add
4042
your paper! ([#1221])
4143
- Add section on global and local DoF numbering. ([#1089])
4244
- Fix some typos and grammar ([#1210], [#1224], [#1228])
@@ -685,7 +687,7 @@ poking into Ferrite internals:
685687
- Fix grid coloring for cell sets with 0 or 1 cells. ([#600])
686688
### Other improvements
687689
- Documentation improvements:
688-
- Simplications and clarifications to hyperelasticity example. ([#591])
690+
- Simplifications and clarifications to hyperelasticity example. ([#591])
689691
- Remove duplicate docstring entry for `vtk_point_data`. ([#602])
690692
- Update documentation about initial conditions. ([#601], [#604])
691693

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ configure pre-commit to run before each commit:
8585
pre-commit install
8686
```
8787

88+
### Spell-checking
89+
Ferrite uses [typos] for spell checking. If you have that installed,
90+
you run it locally with by running `typos` from the top level directory.
91+
To fix mistakes automatically, run `typos -w`, but be careful as e.g. names
92+
and words from other languages might be incorrectly corrected (which is why
93+
it is not included as a [pre-commit] hook). Exceptions should be added to
94+
`.typos.toml`.
95+
8896
[documenter]: https://juliadocs.github.io/Documenter.jl/
8997
[first-contributions]: https://github.com/firstcontributions/first-contributions
9098
[gh-edit-files]: https://docs.github.com/en/repositories/working-with-files/managing-files/editing-files#editing-files-in-another-users-repository
@@ -101,3 +109,4 @@ pre-commit install
101109
[so-mre]: https://stackoverflow.com/help/minimal-reproducible-example
102110
[tim-doc]: https://youtu.be/ZpH1ry8qqfw
103111
[tim-git]: https://youtu.be/cquJ9kPkwR8
112+
[typos]: https://github.com/crate-ci/typos

benchmark/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[deps]
22
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
3+
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
34
Ferrite = "c061ca5d-56c9-439f-9c0e-210fe06d3992"
45
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"
6+
SparseMatricesCSR = "a0a7dd2c-ebf4-11e9-1f05-cf50bc540ca1"
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
using Ferrite
2+
using SparseMatricesCSR: SparseMatrixCSR
3+
using SparseArrays: SparseMatrixCSC
4+
using DataFrames
5+
using Ferrite: FastSparsityPattern
6+
7+
function dh_scalar(grid)
8+
CT = getcelltype(grid)
9+
RS = getrefshape(CT)
10+
return close!(add!(DofHandler(grid), :u, Lagrange{RS, 1}()))
11+
end
12+
13+
function dh_complex(grid::Grid{sdim}) where {sdim}
14+
CT = getcelltype(grid)
15+
RS = getrefshape(CT)
16+
dh = DofHandler(grid)
17+
add!(dh, :u, Lagrange{RS, 2}())
18+
add!(dh, :v, Lagrange{RS, 1}()^sdim)
19+
return close!(dh)
20+
end
21+
22+
create_sp(dh) = add_sparsity_entries!(init_sparsity_pattern(dh), dh)
23+
create_fsp(dh) = FastSparsityPattern(dh)
24+
25+
grid_2d = generate_grid(Triangle, 1000 .* (1, 1))
26+
grid_3d = generate_grid(Hexahedron, 80 .* (1, 1, 1))
27+
28+
dofhandlers = [
29+
"dh_2d_scalar" => dh_scalar(grid_2d),
30+
"dh_3d_scalar" => dh_scalar(grid_3d),
31+
"dh_2d_complex" => dh_complex(grid_2d),
32+
"dh_3d_complex" => dh_complex(grid_3d),
33+
]
34+
35+
function timef(f::F, ::Type{MatrixType}, args...; kwargs...) where {F, MatrixType}
36+
sp0 = f(args...; kwargs...) # Compile
37+
allocate_matrix(MatrixType, sp0) # Compile
38+
GC.gc()
39+
sp_allocs = @allocations (sp_runtime = @elapsed (sp = f(args...; kwargs...)))
40+
m_allocs = @allocations (m_runtime = @elapsed allocate_matrix(MatrixType, sp))
41+
return (; sp_t = sp_runtime, sp_a = sp_allocs, m_t = m_runtime, m_a = m_allocs)
42+
end
43+
44+
function fmt_time(t::Number; digits = 2)
45+
units = ["ns", "μs", "ms", "s", "min", "h"]
46+
values = [1.0e-9, 1.0e-6, 1.0e-3, 1.0, 60.0, 3600]
47+
idx = findfirst(v -> v > t, values)
48+
i = max(idx === nothing ? length(values) : idx - 1, 1)
49+
return string(round(t / values[i]; digits)) * " " * units[i]
50+
end
51+
52+
function fmt_count(n::Integer; digits = 2)
53+
units = ["k", "M", "G"]
54+
values = [1.0e3, 1.0e6, 1.0e9]
55+
n < 1000 && return string(n)
56+
i = findlast(v -> v n, values)
57+
return string(round(n / values[i]; digits)) * units[i]
58+
end
59+
60+
function make_timings(MatrixType)
61+
return map([create_sp, create_fsp]) do f
62+
[key => timef(f, MatrixType, dh) for (key, dh) in dofhandlers]
63+
end
64+
end
65+
66+
function make_df(timings)
67+
_getdata(v, k) = getindex.(last.(v), k)
68+
return DataFrame(
69+
"case" => first.(dofhandlers),
70+
"t (sp) [s]" => fmt_time.(_getdata(timings[1], :sp_t)),
71+
"t (fsp) [s]" => fmt_time.(_getdata(timings[2], :sp_t)),
72+
"allocs (sp)" => fmt_count.(_getdata(timings[1], :sp_a)),
73+
"allocs (fsp)" => fmt_count.(_getdata(timings[2], :sp_a)),
74+
"t (K,sp) [s]" => fmt_time.(_getdata(timings[1], :m_t)),
75+
"t (K,fsp) [s]" => fmt_time.(_getdata(timings[2], :m_t)),
76+
"allocs (K,sp)" => fmt_count.(_getdata(timings[1], :m_a)),
77+
"allocs (K,fsp)" => fmt_count.(_getdata(timings[2], :m_a))
78+
)
79+
end
80+
81+
display(make_df(make_timings(SparseMatrixCSC{Float64, Int})))
82+
# display(make_df(make_timings(SparseMatrixCSR)))

0 commit comments

Comments
 (0)