Skip to content

Commit

Permalink
Remove obsolete code
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeingold authored Nov 11, 2024
1 parent fadd7a7 commit 6ae40fc
Showing 1 changed file with 0 additions and 99 deletions.
99 changes: 0 additions & 99 deletions src/specializations/Plane.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,102 +28,3 @@ function _parametric(plane::Meshes.Plane, t1, t2)
f = f1 f2
return plane(f(t1), f(t2))
end


#=
function integral(
f::F,
plane::Meshes.Plane,
rule::GaussLegendre;
diff_method::DM = Analytical(),
FP::Type{T} = Float64
) where {F <: Function, DM <: DifferentiationMethod, T <: AbstractFloat}
_guarantee_analytical(Meshes.Plane, diff_method)
# Get Gauss-Legendre nodes and weights for a 2D region [-1,1]²
xs, ws = _gausslegendre(FP, rule.n)
wws = Iterators.product(ws, ws)
xxs = Iterators.product(xs, xs)
# Normalize the Plane's orthogonal vectors
uu = Meshes.unormalize(plane.u)
uv = Meshes.unormalize(plane.v)
uplane = Meshes.Plane(plane.p, uu, uv)
# Domain transformation: x ∈ [-1,1] ↦ t ∈ (-∞,∞)
t(x) = x / (1 - x^2)
t′(x) = (1 + x^2) / (1 - x^2)^2
# Integrate f over the Plane
domainunits = _units(uplane(0, 0))
function integrand(((wi, wj), (xi, xj)))
wi * wj * f(uplane(t(xi), t(xj))) * t′(xi) * t′(xj) * domainunits^2
end
return sum(integrand, zip(wws, xxs))
end
function integral(
f::F,
plane::Meshes.Plane,
rule::GaussKronrod;
diff_method::DM = Analytical(),
FP::Type{T} = Float64
) where {F <: Function, DM <: DifferentiationMethod, T <: AbstractFloat}
_guarantee_analytical(Meshes.Plane, diff_method)
# Normalize the Plane's orthogonal vectors
uu = Meshes.unormalize(plane.u)
uv = Meshes.unormalize(plane.v)
uplane = Meshes.Plane(plane.p, uu, uv)
# Integrate f over the Plane
domainunits = _units(uplane(0, 0))^2
integrand(u, v) = f(uplane(u, v)) * domainunits
inner∫(v) = QuadGK.quadgk(u -> integrand(u, v), FP(-Inf), FP(Inf); rule.kwargs...)[1]
return QuadGK.quadgk(inner∫, FP(-Inf), FP(Inf); rule.kwargs...)[1]
end
function integral(
f::F,
plane::Meshes.Plane,
rule::HAdaptiveCubature;
diff_method::DM = Analytical(),
FP::Type{T} = Float64
) where {F <: Function, DM <: DifferentiationMethod, T <: AbstractFloat}
_guarantee_analytical(Meshes.Plane, diff_method)
# Normalize the Plane's orthogonal vectors
uu = Meshes.unormalize(plane.u)
uv = Meshes.unormalize(plane.v)
uplane = Meshes.Plane(plane.p, uu, uv)
# Domain transformation: x ∈ [-1,1] ↦ t ∈ (-∞,∞)
t(x) = x / (1 - x^2)
t′(x) = (1 + x^2) / (1 - x^2)^2
# Integrate f over the Plane
domainunits = _units(uplane(0, 0))
function integrand(x::AbstractVector)
f(uplane(t(x[1]), t(x[2]))) * t′(x[1]) * t′(x[2]) * domainunits^2
end
# HCubature doesn't support functions that output Unitful Quantity types
# Establish the units that are output by f
testpoint_parametriccoord = zeros(FP, 2)
integrandunits = Unitful.unit.(integrand(testpoint_parametriccoord))
# Create a wrapper that returns only the value component in those units
uintegrand(uv) = Unitful.ustrip.(integrandunits, integrand(uv))
# Integrate only the unitless values
value = HCubature.hcubature(uintegrand, -ones(FP, 2), ones(FP, 2); rule.kwargs...)[1]
# Reapply units
return value .* integrandunits
end
################################################################################
# jacobian
################################################################################
_has_analytical(::Type{T}) where {T <: Meshes.Plane} = true
=#

0 comments on commit 6ae40fc

Please sign in to comment.