Skip to content

Commit

Permalink
Merge pull request #94 from bowenszhu/nw-EmptyQuad
Browse files Browse the repository at this point in the history
Avoid construction of `EmptyQuad`
  • Loading branch information
ChrisRackauckas committed Nov 13, 2022
2 parents 5a94c97 + 5d9eedb commit 2a4c89f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/auxfuns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ nw(mop::MultiOrthoPoly)
```
returns nodes and weights in matrix form
"""
nw(quad::typeof(EmptyQuad())) = Array{Float64}(undef, 0, 2)
nw(::EmptyQuad) = Array{Float64}(undef, 0, 2)

function nw(quad::AbstractQuad)
[quad.nodes quad.weights]
Expand Down Expand Up @@ -89,7 +89,7 @@ function integrate(f::Function, nodes::AbstractVector{<:Real},
end

function integrate(f::Function, quad::AbstractQuad)
typeof(quad) == typeof(EmptyQuad()) &&
quad isa EmptyQuad &&
throw(DomainError(quad, "supplied an empty quadrature"))
integrate(f, quad.nodes, quad.weights)
end
Expand Down
4 changes: 2 additions & 2 deletions src/tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ function computeTensorizedSP(m::Integer, op::AbstractVector, ind::AbstractMatrix
end

function computeTensorizedSP(m::Integer, mop::MultiOrthoPoly)
any([typeof(op.quad) == typeof(EmptyQuad()) for op in mop.uni]) &&
any(op.quad isa EmptyQuad for op in mop.uni) &&
throw(InconsistencyError("at least one quadrature rule missing"))
computeTensorizedSP(m, mop.uni, mop.ind)
end

function computeTensorizedSP(m::Integer, op::AbstractOrthoPoly)
typeof(op.quad) == typeof(EmptyQuad()) &&
op.quad isa EmptyQuad &&
throw(InconsistencyError("no quadrature rule provided"))
computeTensorizedSP(m, [op], calculateMultiIndices(1, deg(op)))
end

0 comments on commit 2a4c89f

Please sign in to comment.