Skip to content

Commit

Permalink
Update to Runic version 1.1 (#1118)
Browse files Browse the repository at this point in the history
This patch updates Runic to version 1.1 and enables (partial) formatting
to some more files which were previously excluded completely.
fredrikekre authored Dec 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 12d7259 commit a97aa88
Showing 8 changed files with 1,379 additions and 1,290 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Check.yml
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ jobs:
- uses: julia-actions/cache@v2
- uses: fredrikekre/runic-action@v1
with:
version: "d9a27b9d6279a103fedc7202258207a7b7afe18c"
version: "1.1"

explicit-imports:
runs-on: ubuntu-latest
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@

![Build Status](https://github.com/Ferrite-FEM/Ferrite.jl/workflows/CI/badge.svg?event=push)
[![codecov.io](https://codecov.io/github/Ferrite-FEM/Ferrite.jl/coverage.svg?branch=master)](https://codecov.io/github/Ferrite-FEM/Ferrite.jl?branch=master)
[![code style: runic](https://img.shields.io/badge/code_style-%E1%9A%B1%E1%9A%A2%E1%9A%BE%E1%9B%81%E1%9A%B2-black)](https://github.com/fredrikekre/Runic.jl)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13862652.svg)](https://doi.org/10.5281/zenodo.13862652)

A finite element toolbox written in Julia.
8 changes: 4 additions & 4 deletions benchmark/benchmarks-dofs.jl
Original file line number Diff line number Diff line change
@@ -36,30 +36,30 @@ for spatial_dim in [3] # 1:3

LAGRANGE_SUITE["DofHandler"] = BenchmarkGroup()

close_helper = function(grid, ip)
close_helper = function (grid, ip)
dh = DofHandler(grid)
push!(dh, :u, field_dim, ip)
return close!(dh)
end
LAGRANGE_SUITE["DofHandler"]["one-field"] = @benchmarkable $close_helper($grid, $ip)

close_helper = function(grid, ip, ip2)
close_helper = function (grid, ip, ip2)
dh = DofHandler(grid)
push!(dh, :u, field_dim, ip)
push!(dh, :p, 1, ip2)
return close!(dh)
end
LAGRANGE_SUITE["DofHandler"]["two-fields"] = @benchmarkable $close_helper($grid, $ip, $ip2)

close_helper = function(grid)
close_helper = function (grid)
dh = DofHandler(grid)
sdh = SubDofHandler(dh, Set(1:Int(round(getncells(grid) / 2))))
add!(sdh, :u, ip^field_dim)
return close!(dh)
end
LAGRANGE_SUITE["DofHandler"]["one-field-subdomain"] = @benchmarkable $close_helper($grid)

close_helper = function(grid)
close_helper = function (grid)
dh = DofHandler(grid)
sdh = SubDofHandler(dh, Set(1:Int(round(getncells(grid) / 2))))
add!(sdh, :u, ip^field_dim)
623 changes: 320 additions & 303 deletions src/Quadrature/gaussquad_prism_table.jl

Large diffs are not rendered by default.

187 changes: 98 additions & 89 deletions src/Quadrature/gaussquad_pyramid_table.jl

Large diffs are not rendered by default.

159 changes: 84 additions & 75 deletions src/Quadrature/gaussquad_tet_table.jl
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
# runic: off
# Yu, Jinyun. Symmetric Gaussian Quadrature Formulae for Tetrahedronal Regions. 1984. CMAME.
function _get_jinyun_tet_quadrature_data(n::Int)
if n == 1
a = 1. / 4.
w = 1. / 6.
a = 1.0 / 4.0
w = 1.0 / 6.0
xw = [a a a w]
elseif n == 2
a = ( 5. + 3. * (5.) ) / 20.
b = ( 5. - (5.) ) / 20.
w = 1. / 24.
xw = [a b b w
b a b w
b b a w
b b b w]
a = (5.0 + 3.0 * (5.0)) / 20.0
b = (5.0 - (5.0)) / 20.0
w = 1.0 / 24.0
xw = [
a b b w
b a b w
b b a w
b b b w
]
elseif n == 3
a1 = 1. / 4.
a2 = 1. / 2.
b2 = 1. / 6.
w1 = -2. / 15.
w2 = 3. / 40.
xw = [a1 a1 a1 w1
a2 b2 b2 w2
b2 a2 b2 w2
b2 b2 a2 w2
b2 b2 b2 w2]
a1 = 1.0 / 4.0
a2 = 1.0 / 2.0
b2 = 1.0 / 6.0
w1 = -2.0 / 15.0
w2 = 3.0 / 40.0
xw = [
a1 a1 a1 w1
a2 b2 b2 w2
b2 a2 b2 w2
b2 b2 a2 w2
b2 b2 b2 w2
]
elseif 4 n 6
throw(ArgumentError("Jinyun's Gauss quadrature rule (RefTetrahedron) is not implemented for orders 4 and 6"))
else
@@ -39,59 +42,63 @@ function _get_keast_a_tet_quadrature_data(n::Int)
# The rules of Jinyin and Keast are identical for order 1 to 3, as stated in the Keast paper.
xw = _get_jinyun_tet_quadrature_data(n)
elseif n == 4
a1 = 1. / 4.;
w1 = -74. / 5625.;
a1 = 1.0 / 4.0
w1 = -74.0 / 5625.0

a2 = 5. / 70.;
b2 = 11. / 14.;
w2 = 343. / 45000.;
a2 = 5.0 / 70.0
b2 = 11.0 / 14.0
w2 = 343.0 / 45000.0

a3 = ( 1. + (5. / 14.) ) / 4.;
b3 = ( 1. - (5. / 14.) ) / 4.;
w3 = 28. / 1125.;
a3 = (1.0 + (5.0 / 14.0)) / 4.0
b3 = (1.0 - (5.0 / 14.0)) / 4.0
w3 = 28.0 / 1125.0

xw = [a1 a1 a1 w1
b2 a2 a2 w2
a2 b2 a2 w2
a2 a2 b2 w2
a2 a2 a2 w2
a3 a3 b3 w3
a3 b3 a3 w3
a3 b3 b3 w3
b3 a3 a3 w3
b3 a3 b3 w3
b3 b3 a3 w3]
xw = [
a1 a1 a1 w1
b2 a2 a2 w2
a2 b2 a2 w2
a2 a2 b2 w2
a2 a2 a2 w2
a3 a3 b3 w3
a3 b3 a3 w3
a3 b3 b3 w3
b3 a3 a3 w3
b3 a3 b3 w3
b3 b3 a3 w3
]
elseif n == 5
w1 = 0.602678571428571597e-2
a1 = 1. / 3.
b1 = 0.
a1 = 1.0 / 3.0
b1 = 0.0

w2 = 0.302836780970891856e-1
a2 = 1. / 4.
a2 = 1.0 / 4.0

w3 = 0.116452490860289742e-1
a3 = 1. / 11.
b3 = 8. / 11.
a3 = 1.0 / 11.0
b3 = 8.0 / 11.0

w4 = 0.109491415613864534e-1
a4 = 0.665501535736642813e-1
b4 = 0.433449846426335728e-0

xw = [a1 a1 a1 w1
a1 a1 b1 w1
a1 b1 a1 w1
b1 a1 a1 w1
a2 a2 a2 w2
a3 a3 a3 w3
a3 a3 b3 w3
a3 b3 a3 w3
b3 a3 a3 w3
a4 a4 b4 w4
a4 b4 a4 w4
a4 b4 b4 w4
b4 a4 a4 w4
b4 a4 b4 w4
b4 b4 a4 w4]
xw = [
a1 a1 a1 w1
a1 a1 b1 w1
a1 b1 a1 w1
b1 a1 a1 w1
a2 a2 a2 w2
a3 a3 a3 w3
a3 a3 b3 w3
a3 b3 a3 w3
b3 a3 a3 w3
a4 a4 b4 w4
a4 b4 a4 w4
a4 b4 b4 w4
b4 a4 a4 w4
b4 a4 b4 w4
b4 b4 a4 w4
]
elseif 6 n 8
throw(ArgumentError("Keast's Gauss quadrature rule (RefTetrahedron) not implement for order 6 to 8"))
else
@@ -103,8 +110,8 @@ end
# Positive points
function _get_keast_b_tet_quadrature_data(n::Int)
if n == 4
w1 = 0.317460317460317450e-2
a1 = 1. / 2.
w1 = 0.31746031746031745e-2
a1 = 1.0 / 2.0
b1 = 0.0

w2 = 0.147649707904967828e-1
@@ -115,20 +122,22 @@ function _get_keast_b_tet_quadrature_data(n::Int)
a3 = 0.314372873493192195e-0
b3 = 0.568813795204234229e-1

xw = [a1 a1 b1 w1
a1 b1 a1 w1
a1 b1 b1 w1
b1 a1 a1 w1
b1 a1 b1 w1
b1 b1 a1 w1
a2 a2 a2 w2
a2 a2 b2 w2
a2 b2 a2 w2
b2 a2 a2 w2
a3 a3 a3 w3
a3 a3 b3 w3
a3 b3 a3 w3
b3 a3 a3 w3]
xw = [
a1 a1 b1 w1
a1 b1 a1 w1
a1 b1 b1 w1
b1 a1 a1 w1
b1 a1 b1 w1
b1 b1 a1 w1
a2 a2 a2 w2
a2 a2 b2 w2
a2 b2 a2 w2
b2 a2 a2 w2
a3 a3 a3 w3
a3 a3 b3 w3
a3 b3 a3 w3
b3 a3 a3 w3
]
else
xw = _get_keast_a_tet_quadrature_data(n)
end
1,681 changes: 867 additions & 814 deletions src/Quadrature/gaussquad_tri_table.jl

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions test/test_l2_projection.jl
Original file line number Diff line number Diff line change
@@ -365,7 +365,7 @@ function test_export(; subset::Bool)
nindex = isnan.(fnodes)
findex = (!isnan).(fnodes)
let r = evaluate_at_grid_nodes(p, p_scalar),
rv = Ferrite._evaluate_at_grid_nodes(p, p_scalar, Val(true))
rv = Ferrite._evaluate_at_grid_nodes(p, p_scalar, Val(true))
@test size(r) == (6,)
@test all(isnan, r[nindex])
@test all(isnan, rv[nindex])
@@ -375,7 +375,7 @@ function test_export(; subset::Bool)
@test r[findex] == vec(rv)[findex]
end
let r = evaluate_at_grid_nodes(p, p_vec),
rv = Ferrite._evaluate_at_grid_nodes(p, p_vec, Val(true))
rv = Ferrite._evaluate_at_grid_nodes(p, p_vec, Val(true))
@test size(r) == (6,)
@test getindex.(r[findex], 1) fnodes[findex]
@test getindex.(r[findex], 2) 2fnodes[findex]
@@ -385,7 +385,7 @@ function test_export(; subset::Bool)
@test all(isnan, rv[:, nindex])
end
let r = evaluate_at_grid_nodes(p, p_tens),
rv = Ferrite._evaluate_at_grid_nodes(p, p_tens, Val(true))
rv = Ferrite._evaluate_at_grid_nodes(p, p_tens, Val(true))
@test size(r) == (6,)
@test getindex.(r[findex], 1) fnodes[findex] # 11-components
@test getindex.(r[findex], 2) 2fnodes[findex] # 12-components
@@ -397,7 +397,7 @@ function test_export(; subset::Bool)
@test all(isnan, rv[:, nindex])
end
let r = evaluate_at_grid_nodes(p, p_stens),
rv = Ferrite._evaluate_at_grid_nodes(p, p_stens, Val(true))
rv = Ferrite._evaluate_at_grid_nodes(p, p_stens, Val(true))
@test size(r) == (6,)
@test getindex.(r[findex], 1) fnodes[findex] # 11-components
@test getindex.(r[findex], 2) 2fnodes[findex] # 21-components

0 comments on commit a97aa88

Please sign in to comment.