Skip to content

Commit c3d3f15

Browse files
committed
readme
1 parent 4c16ed3 commit c3d3f15

File tree

3 files changed

+69
-3
lines changed

3 files changed

+69
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# QuadratureRulesDotOrg
22

3-
[![Build Status](https://github.com/mscroggs/QuadratureRulesDotOrg.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/mscroggs/QuadratureRulesDotOrg.jl/actions/workflows/CI.yml?query=branch%3Amain)
3+
The code in this repo is generated by [the quadraturerules repo](https://github.com/quadraturerules/quadraturerules).
4+
If you want to open an issue, please open it [on the quadrature rules repo](https://github.com/quadraturerules/quadraturerules/issues).

src/QuadratureRulesDotOrg.jl

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,65 @@
11
module QuadratureRulesDotOrg
22

3-
# Write your package code here.
3+
include("domains.jl")
4+
include("gauss_legendre.jl")
5+
include("gauss_lobatto_legendre.jl")
6+
include("hammer_marlowe_stroud.jl")
7+
include("sauter_schwab.jl")
8+
include("xiao_gimbutas.jl")
9+
include("centroid_quadrature.jl")
10+
include("vertex_quadrature.jl")
11+
12+
@enum QuadratureRule begin
13+
QR_GaussLegendre = 1
14+
QR_GaussLobattoLegendre = 3
15+
QR_HammerMarloweStroud = 6
16+
QR_SauterSchwab = 7
17+
QR_XiaoGimbutas = 2
18+
QR_CentroidQuadrature = 5
19+
QR_VertexQuadrature = 4
20+
end
21+
22+
"Get a quadrature rule for a single integral."
23+
function single_integral_quadrature(
24+
rtype::QuadratureRule,
25+
domain::Domain,
26+
order::Integer,
27+
)
28+
if rtype == QR_GaussLegendre
29+
return gauss_legendre(domain, order)
30+
end
31+
if rtype == QR_GaussLobattoLegendre
32+
return gauss_lobatto_legendre(domain, order)
33+
end
34+
if rtype == QR_HammerMarloweStroud
35+
return hammer_marlowe_stroud(domain, order)
36+
end
37+
if rtype == QR_XiaoGimbutas
38+
return xiao_gimbutas(domain, order)
39+
end
40+
if rtype == QR_CentroidQuadrature
41+
return centroid_quadrature(domain, order)
42+
end
43+
if rtype == QR_VertexQuadrature
44+
return vertex_quadrature(domain, order)
45+
end
46+
throw("Unsupported rule for single integral: $rtype")
47+
end
48+
49+
"Get a quadrature rule for a double integral."
50+
function double_integral_quadrature(
51+
rtype::QuadratureRule,
52+
domain::Domain,
53+
order::Integer,
54+
)
55+
if rtype == QR_SauterSchwab
56+
return sauter_schwab(domain, order)
57+
end
58+
throw("Unsupported rule for single integral: $rtype")
59+
end
60+
61+
export QuadratureRule
62+
export Domain
63+
export single_integral_quadrature
464

565
end

test/runtests.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@ using QuadratureRulesDotOrg
22
using Test
33

44
@testset "QuadratureRulesDotOrg.jl" begin
5-
# Write your tests here.
5+
points, weights = QuadratureRulesDotOrg.single_integral_quadrature(
6+
QuadratureRulesDotOrg.QR_GaussLobattoLegendre,
7+
QuadratureRulesDotOrg.Domain_Interval,
8+
4
9+
)
10+
@test isapprox(sum(weights), 1.0)
611
end

0 commit comments

Comments
 (0)