Skip to content

Commit

Permalink
quadrature over triangles
Browse files Browse the repository at this point in the history
  • Loading branch information
daanhb committed Jan 26, 2023
1 parent 1ff912c commit 81dfa18
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DomainIntegrals"
uuid = "cc6bae93-f070-4015-88fd-838f9505a86c"
authors = ["Daan Huybrechs <[email protected]>"]
version = "0.4.0"
version = "0.4.1"

[deps]
CompositeTypes = "b152e2b5-7a66-4b01-a709-34e65c35f657"
Expand Down
17 changes: 17 additions & 0 deletions src/functional/measure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,23 @@ function unsafe_weight(μ::DiscreteWeight, i)
end


####################
## Generic weights
####################

"A generic continuous weight function."
struct GenericWeight{T,F,S} <: Weight{T}
fun :: F
support :: S
end

GenericWeight(fun, support = ChebyshevInterval()) =
GenericWeight{eltype(support)}(fun, support)
GenericWeight{T}(fun::F, support::S) where {T,F,S} =
GenericWeight{T,F,S}(fun, support)

support::GenericWeight) = μ.support
unsafe_weightfun::GenericWeight, x) = μ.fun(x)

"A generic discrete weight that stores points and weights."
struct GenericDiscreteWeight{T,P,W} <: DiscreteWeight{T}
Expand Down
9 changes: 8 additions & 1 deletion src/processing/domain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ function process_domain(qs, integrand, domain::Domain, measure::Lebesgue, proper
if has_integration_domain(domain)
paramdomain = integration_domain(domain)
fmap = mapfrom_integration_domain(domain)
(DomainSets.diffvolume(fmap) * (integrand fmap), paramdomain, Lebesgue{eltype(paramdomain)}(), properties...)
process_domain(qs, diffvolume(fmap) * (integrand fmap), paramdomain, Lebesgue{eltype(paramdomain)}(), properties...)
# (diffvolume(fmap) * (integrand ∘ fmap), paramdomain, Lebesgue{eltype(paramdomain)}(), properties...)
else
(integrand, domain, measure, properties...)
end
Expand All @@ -82,6 +83,12 @@ integrate_domain(qs, integrand, domain::Point, measure, properties...) =
# process_domain(qs, (t->jacdet(m,t)) * (integrand ∘ m), superdomain(domain), measure, properties...)
# end

# TODO: implement triangles in terms of UnitSimplex, rather than the other way around
function process_domain(qs, integrand, domain::EuclideanUnitSimplex{2,T}, measure::Lebesgue, properties...) where {T}
m = AffineMap(SA[-1 zero(T); 0 1], SA[one(T); 0])
process_domain(qs, diffvolume(m) * (integrand m), LowerRightTriangle(zero(T),one(T)), measure, properties...)
end

function process_domain(qs, integrand, domain::LowerRightTriangle{T}, measure::Lebesgue, properties...) where {T}
a = domain.a
b = domain.b
Expand Down

2 comments on commit 81dfa18

@daanhb
Copy link
Member Author

@daanhb daanhb commented on 81dfa18 Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/76416

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.1 -m "<description of version>" 81dfa18efcad716550a6357b032161c612d3318a
git push origin v0.4.1

Please sign in to comment.