Skip to content

Commit

Permalink
fix quadrature example
Browse files Browse the repository at this point in the history
  • Loading branch information
hverhelst committed Dec 19, 2024
1 parent 5ac4b45 commit 8b54584
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/QuadRule_example.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using Gismo

# Gauss quadrature rule (1D)
rule1D = GaussRule(2)
rule1D = GaussRule(Cint(2))
nodes,weights = mapTo(rule1D,0.0,1.0)
println("Gauss nodes: ",asMatrix(nodes))
println("Gauss nodes: ",asVector(weights))

# Lobatto quadrature rule (2D)
rule2D = LobattoRule(2,Array{Int}([2,2]))
rule2D = LobattoRule(Cint(2),Array{Cint}([3,3]))
low = Vector{Float64}([0.0,0.0])
upp = Vector{Float64}([1.0,1.0])
nodes,weights = mapTo(rule2D,low,upp)
Expand Down
14 changes: 6 additions & 8 deletions src/gsAssembler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ mutable struct QuadRule
end
end

Base.show(io::IO, obj::QuadRule) = ccall((:gsQuadRule_print,libgismo),Cvoid,(Ptr{gsCQuadRule},),obj.ptr)

"""
Returns a Gauss rule for numerical integration
Expand All @@ -50,7 +48,7 @@ Returns a Gauss rule for numerical integration
- `digits::Int`: the number of digits of precision for the rule (optionals)
"""
function GaussRule(d::Int, numNodes::Array{Int}, digits::Int=Int(0))::QuadRule
function GaussRule(d::Cint, numNodes::Array{Cint}, digits::Cint=Cint(0))::QuadRule
@assert d == length(numNodes) "GaussRule: numNodes must have the same size as the dimension"
qr = ccall((:gsGaussRule_create,libgismo),Ptr{gsCQuadRule},(Cint,Ptr{Cint},Cint),d,numNodes,digits)
return QuadRule(qr)
Expand All @@ -64,9 +62,9 @@ Returns a Gauss rule for numerical integration
- `digits::Int`: the number of digits of precision for the rule (optionals)
"""
function GaussRule(numNodes::Int, digits::Int=Int(0))::QuadRule
d::Int = 1;
numNodesVec::Array{Int} = [numNodes]
function GaussRule(numNodes::Cint, digits::Cint=Cint(0))::QuadRule
d::Cint = 1;
numNodesVec::Array{Cint} = [numNodes]
qr = ccall((:gsGaussRule_create,libgismo),Ptr{gsCQuadRule},(Cint,Ptr{Cint},Cint),d,numNodesVec,digits)
return QuadRule(qr)
end
Expand All @@ -80,7 +78,7 @@ Returns a Lobatto rule for numerical integration
- `digits::Int`: the number of digits of precision for the rule (optionals)
"""
function LobattoRule(d::Int, numNodes::Array{Int}, digits::Int=Int(0))::QuadRule
function LobattoRule(d::Cint, numNodes::Array{Cint}, digits::Cint=Cint(0))::QuadRule
@assert d == length(numNodes) "LobattoRule: numNodes must have the same size as the dimension"
qr = ccall((:gsLobattoRule_create,libgismo),Ptr{gsCQuadRule},(Cint,Ptr{Cint},Cint),d,numNodes,digits)
return QuadRule(qr)
Expand All @@ -94,7 +92,7 @@ Returns a Lobatto rule for numerical integration
- `digits::Int`: the number of digits of precision for the rule (optionals)
"""
function LobattoRule(numNodes::Int, digits::Int=Int(0))::QuadRule
function LobattoRule(numNodes::Int, digits::Int=Cint(0))::QuadRule
d::Int = 1;
numNodesVec::Array{Int} = [numNodes]
qr = ccall((:LobattoRule_create,libgismo),Ptr{gsCQuadRule},(Cint,Ptr{Cint},Cint),d,numNodesVec,digits)
Expand Down

0 comments on commit 8b54584

Please sign in to comment.