Skip to content

Commit

Permalink
test for negative discriminant
Browse files Browse the repository at this point in the history
  • Loading branch information
ahojukka5 committed Aug 2, 2017
1 parent 5a89f15 commit a27fa66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/calculate_projections.jl
Expand Up @@ -45,9 +45,8 @@ function project_from_master_to_slave{T<:Number}(::Type{Val{:Seg2}}, xm::Vector{
c = nom_c / denom_c
d = b^2 - 4*a*c
if d < 0
warn("Mortar2D.calculate_projections(): negative discriminant")
warn("Mortar2D.calculate_projections(): negative discriminant $d")
warn("xm = $xm, xs1 = $xs1, xs2 = $xs2, ns1 = $ns1, ns2 = $ns2")
error("negative discriminant d=$d when calculating projection")
end
sols = [-b + sqrt(d), -b - sqrt(d)]/(2.0*a)
return sols[indmin(abs.(sols))]
Expand Down
3 changes: 1 addition & 2 deletions test/test_calculate_projections.jl
Expand Up @@ -29,6 +29,5 @@ end
xs2 = [291.474, 359.169]
ns1 = [-0.0765221, 0.997068]
ns2 = [0.251347, 0.967897]
# FIXME: fails for unknown reason
# project_from_master_to_slave(Val{:Seg2}, xm, xs1, xs2, ns1, ns2)
@test_throws DomainError project_from_master_to_slave(Val{:Seg2}, xm, xs1, xs2, ns1, ns2)
end

0 comments on commit a27fa66

Please sign in to comment.