Skip to content

Commit

Permalink
FEValues: Move throw in reinit! to a separate no-inlined function.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Feb 24, 2022
1 parent ace90e0 commit 692d45f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/FEValues/cell_values.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function reinit!(cv::CellValues{dim}, x::AbstractVector{Vec{dim,T}}) where {dim,
fecv_J += x[j] cv.dMdξ[j, i]
end
detJ = det(fecv_J)
detJ > 0.0 || throw(ArgumentError("det(J) is not positive: det(J) = $(detJ)"))
detJ > 0.0 || throw_detJ_not_pos(detJ)
cv.detJdV[i] = detJ * w
Jinv = inv(fecv_J)
for j in 1:n_func_basefuncs
Expand Down
1 change: 1 addition & 0 deletions src/FEValues/common_values.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ FieldTrait(::Type{<:PointScalarValues}) = ScalarValued()
FieldTrait(::Type{<:CellVectorValues}) = VectorValued()
FieldTrait(::Type{<:FaceVectorValues}) = VectorValued()

@noinline throw_detJ_not_pos(detJ) = throw(ArgumentError("det(J) is not positive: det(J) = $(detJ)"))

getnbasefunctions(cv::Values) = size(cv.N, 1)
getngeobasefunctions(cv::Values) = size(cv.M, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/FEValues/face_values.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function reinit!(fv::FaceValues{dim}, x::AbstractVector{Vec{dim,T}}, face::Int)
fv.normals[i] = weight_norm / norm(weight_norm)
detJ = norm(weight_norm)

detJ > 0.0 || throw(ArgumentError("det(J) is not positive: det(J) = $(detJ)"))
detJ > 0.0 || throw_detJ_not_pos(detJ)
fv.detJdV[i, cb] = detJ * w
Jinv = inv(fefv_J)
for j in 1:n_func_basefuncs
Expand Down

0 comments on commit 692d45f

Please sign in to comment.