Skip to content

Commit

Permalink
CLEANUP: Minor optimization in calculation of PP sharp.
Browse files Browse the repository at this point in the history
Also, further clarification to the docstring.
  • Loading branch information
epatters committed May 28, 2021
1 parent 9c5a1ee commit b3bc00f
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/DualSimplicialSets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,12 @@ function ♯(s::AbstractDeltaDualComplex2D, α::AbstractVector, ::PPSharp)
e2_vec = point(s, v₀) - point(s, src(s, e₀))
out_vec = e2_vec - dot(e2_vec, e_vec)*e_vec
h = norm(out_vec)
out_vec /= norm(out_vec)
out_vec /= h^2 # length == 1/h
for e in deleteat(tri_edges, i)
v, sgn = src(s,e) == v₀ ? (tgt(s,e), -1) : (src(s,e), +1)
dual_area = sum(dual_volume(2,s,d) for d in elementary_duals(0,s,v)
if s[s[d, :D_∂e0], :D_∂v0] == tri_center)
α♯[v] += sgn * sign(1,s,e) * α[e] * (dual_area / area) * out_vec / h
α♯[v] += sgn * sign(1,s,e) * α[e] * (dual_area / area) * out_vec
end
end
end
Expand Down Expand Up @@ -731,19 +731,21 @@ const flat = ♭

""" Sharp operator for converting 1-forms to vector fields.
A generic function for discrete sharp operators. Currently only the PP-flat from
(Hirani 2003, Definition 5.8.1) is implemented, subject to the caveat:
- Although (Desbrun et al 2005, Definition 7.4) is supposed to be the same
definition, it differs in two ways: Desbrun et al's notation suggests a *unit*
normal vector, whereas the gradient of Hirani's primal-primal interpolation
function is not necessarily a unit vector (Hirani, Remark 2.7.2). More
importantly, Hirani's vector is a normal to a different face than Desbrun et
al's. Adding further confusion, Hirani's Figure 5.7 agrees with Desbrun et
al's textual description rather than his own. In our implementation, we
calculate and use the vector defined by Hirani's primal-primal interpolation
function. This vector is not necessarily the unit normal, as its magnitude
is determined by the distance from the relevant edge to its opposite point.
A generic function for discrete sharp operators. Currently only the
primal-primal flat from (Hirani 2003, Definition 5.8.1 and Remark 2.7.2) is
implemented.
!!! note
A PP-flat is also defined in (Desbrun et al 2005, Definition 7.4) but
differs in two ways: Desbrun et al's notation suggests a *unit* normal
vector, whereas the gradient of Hirani's primal-primal interpolation
function is not necessarily a unit vector. More importantly, Hirani's vector
is a normal to a different face than Desbrun et al's, with further confusion
created by the fact that Hirani's Figure 5.7 agrees with Desbrun et al's
description rather than his own. That being said, to the best of our
knowledge, our implementation is the correct one and agrees with Hirani's
description, if not his figure.
See also: the flat operator [`♭`](@ref).
"""
Expand Down

0 comments on commit b3bc00f

Please sign in to comment.