|
1 | 1 | module QuadratureRulesDotOrg |
2 | 2 |
|
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 |
4 | 64 |
|
5 | 65 | end |
0 commit comments