Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new features, preparing v.25.1.0 #5

Merged
merged 20 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmake/Gismo.jl.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ include("Declarations.jl")
# Load gsCore
include("gsCore.jl")

# Load gsMatrix
include("gsMatrix.jl")

# Load gsAssembler
include("gsAssembler.jl")

Expand All @@ -17,9 +20,6 @@ include("gsHSplines.jl")
# Load gsIO
include("gsIO.jl")

# Load gsMatrix
include("gsMatrix.jl")

# Load gsMatrix
include("gsModeling.jl")

Expand Down
2 changes: 1 addition & 1 deletion examples/OptionList_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ println(options)
gsOptionList = OptionList(options)
println(gsOptionList)

Gismo.setInt(gsOptionList,"a",Int32(2))
Gismo.setInt(gsOptionList,"a",2)
Gismo.setReal(gsOptionList,"b",2.0)
Gismo.setSwitch(gsOptionList,"c",false)
Gismo.setString(gsOptionList,"d","two")
Expand Down
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(Int32(2))
rule1D = GaussRule(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(Int32(2),Array{Int32}([2,2]))
rule2D = LobattoRule(2,Array{Int}([2,2]))
hverhelst marked this conversation as resolved.
Show resolved Hide resolved
low = Vector{Float64}([0.0,0.0])
upp = Vector{Float64}([1.0,1.0])
nodes,weights = mapTo(rule2D,low,upp)
Expand Down
2 changes: 1 addition & 1 deletion examples/THBSpline_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ print("The size of the basis is: ",size(TBB),"\n")
uniformRefine!(TBB)
print("The size of the basis is: ",size(TBB),"\n")
THB = THBSplineBasis(TBB)
boxes = Vector{Int32}([1,0,0,2,2])
boxes = Vector{Int}([1,0,0,2,2])
refineElements!(THB,boxes)

print("The size of the basis is: ",size(THB),"\n")
Expand Down
6 changes: 3 additions & 3 deletions src/Gismo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ include("Declarations.jl")
# Load gsCore
include("gsCore.jl")

# Load gsMatrix
include("gsMatrix.jl")

# Load gsAssembler
include("gsAssembler.jl")

Expand All @@ -17,9 +20,6 @@ include("gsHSplines.jl")
# Load gsIO
include("gsIO.jl")

# Load gsMatrix
include("gsMatrix.jl")

# Load gsMatrix
include("gsModeling.jl")

Expand Down
36 changes: 18 additions & 18 deletions src/gsAssembler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ Base.show(io::IO, obj::QuadRule) = ccall((:gsQuadRule_print,libgismo),Cvoid,(Ptr
Returns a Gauss rule for numerical integration

# Arguments
- `d::Cint`: the dimension of the rule
- `numNodes::Array{Cint}`: a vector of length `d` with the number of points in each direction
- `digits::Cint`: the number of digits of precision for the rule (optionals)
- `d::Int`: the dimension of the rule
- `numNodes::Array{Int}`: a vector of length `d` with the number of points in each direction
- `digits::Int`: the number of digits of precision for the rule (optionals)

"""
function GaussRule(d::Cint, numNodes::Array{Cint}, digits::Cint=Cint(0))::QuadRule
function GaussRule(d::Int, numNodes::Array{Int}, digits::Int=Int(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 @@ -60,13 +60,13 @@ end
Returns a Gauss rule for numerical integration

# Arguments
- `numNodes::Cint`: the number of points in each direction
- `digits::Cint`: the number of digits of precision for the rule (optionals)
- `numNodes::Int`: the number of points in each direction
- `digits::Int`: the number of digits of precision for the rule (optionals)

"""
function GaussRule(numNodes::Cint, digits::Cint=Cint(0))::QuadRule
d::Cint = 1;
numNodesVec::Array{Cint} = [numNodes]
function GaussRule(numNodes::Int, digits::Int=Int(0))::QuadRule
d::Int = 1;
numNodesVec::Array{Int} = [numNodes]
qr = ccall((:gsGaussRule_create,libgismo),Ptr{gsCQuadRule},(Cint,Ptr{Cint},Cint),d,numNodesVec,digits)
return QuadRule(qr)
end
Expand All @@ -75,12 +75,12 @@ end
Returns a Lobatto rule for numerical integration

# Arguments
- `d::Cint`: the dimension of the rule
- `numNodes::Array{Cint}`: a vector of length `d` with the number of points in each direction
- `digits::Cint`: the number of digits of precision for the rule (optionals)
- `d::Int`: the dimension of the rule
- `numNodes::Array{Int}`: a vector of length `d` with the number of points in each direction
- `digits::Int`: the number of digits of precision for the rule (optionals)

"""
function LobattoRule(d::Cint, numNodes::Array{Cint}, digits::Cint=Cint(0))::QuadRule
function LobattoRule(d::Int, numNodes::Array{Int}, digits::Int=Int(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 @@ -90,13 +90,13 @@ end
Returns a Lobatto rule for numerical integration

# Arguments
- `numNodes::Cint`: the number of points in each direction
- `digits::Cint`: the number of digits of precision for the rule (optionals)
- `numNodes::Int`: the number of points in each direction
- `digits::Int`: the number of digits of precision for the rule (optionals)

"""
function LobattoRule(numNodes::Cint, digits::Cint=Cint(0))::QuadRule
d::Cint = 1;
numNodesVec::Array{Cint} = [numNodes]
function LobattoRule(numNodes::Int, digits::Int=Int(0))::QuadRule
d::Int = 1;
numNodesVec::Array{Int} = [numNodes]
qr = ccall((:LobattoRule_create,libgismo),Ptr{gsCQuadRule},(Cint,Ptr{Cint},Cint),d,numNodesVec,digits)
return QuadRule(qr)
end
Expand Down
52 changes: 26 additions & 26 deletions src/gsCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Returns the domain dimension of a basis
- `object::Basis`: a Gismo Basis

"""
function domainDim(object::Basis)::Cint
function domainDim(object::Basis)::Int
return ccall((:gsFunctionSet_domainDim,libgismo),Cint,(Ptr{gsCFunctionSet},),object.ptr)
end

Expand All @@ -98,7 +98,7 @@ Returns the target dimension of a basis
- `object::Basis`: a Gismo Basis

"""
function targetDim(object::Basis)::Cint
function targetDim(object::Basis)::Int
return ccall((:gsFunctionSet_targetDim,libgismo),Cint,(Ptr{gsCFunctionSet},),object.ptr)
end

Expand All @@ -109,10 +109,10 @@ Returns the component of a basis

# Arguments
- `obj::Basis`: a Gismo Basis
- `i::Cint`: the index of the component
- `i::Int`: the index of the component

"""
function component(obj::Basis,i::Cint)::Basis
function component(obj::Basis,i::Int)::Basis
b = ccall((:gsBasis_component,libgismo),Ptr{gsCBasis},(Ptr{gsCBasis},Cint),obj.ptr,i)
return Basis(b)
end
Expand All @@ -122,10 +122,10 @@ Returns the degree of a basis

# Arguments
- `obj::Basis`: a Gismo Basis
- `i::Cint`: the index of the component
- `i::Int`: the index of the component

"""
function degree(obj::Basis,i::Cint)::Cint
function degree(obj::Basis,i::Int)::Int
return ccall((:gsBasis_degree,libgismo),Cint,(Ptr{gsCBasis},Cint),obj.ptr,i)
end

Expand All @@ -136,7 +136,7 @@ Returns the number of elements of a basis
- `obj::Basis`: a Gismo Basis

"""
function numElements(obj::Basis)::Cint
function numElements(obj::Basis)::Int
return ccall((:gsBasis_numElements,libgismo),Cint,(Ptr{gsCBasis},),obj.ptr)
end

Expand All @@ -147,10 +147,10 @@ Returns the size of a basis
- `obj::Basis`: a Gismo Basis

"""
function size(obj::Basis)::Cint
function size(obj::Basis)::Int
return ccall((:gsBasis_size,libgismo),Cint,(Ptr{gsCBasis},),obj.ptr)
end
function Base.size(obj::Basis)::Cint
function Base.size(obj::Basis)::Int
return Gismo.size(obj)
end

Expand All @@ -159,12 +159,12 @@ Refines a basis

# Arguments
- `obj::Basis`: a Gismo Basis
- `numKnots::Cint=Int32(1)`: the number of knots to add
- `mul::Cint=Int32(1)`: the multiplicity of the knots
- `dir::Cint=Int32(-1)`: the direction of the refinement
- `numKnots::Int=Int(1)`: the number of knots to add
- `mul::Int=Int(1)`: the multiplicity of the knots
- `dir::Int=Int(-1)`: the direction of the refinement

"""
function uniformRefine!(obj::Basis,numKnots::Cint=Int32(1),mul::Cint=Int32(1),dir::Cint=Int32(-1))::Nothing
function uniformRefine!(obj::Basis,numKnots::Int=Int(1),mul::Int=Int(1),dir::Int=Int(-1))::Nothing
ccall((:gsBasis_uniformRefine,libgismo),Cvoid,
(Ptr{gsCBasis},Cint,Cint,Cint),obj.ptr,numKnots,mul,dir)
end
Expand All @@ -177,7 +177,7 @@ Refines a basis
- `boxes::Vector{Cint}`: the boxes to refine (in index format)

"""
function refineElements!(obj::Basis,boxes::Vector{Cint})::Nothing
function refineElements!(obj::Basis,boxes::Vector{Int})::Nothing
@assert mod(length(boxes),2*domainDim(obj)+1)==0 "Boxes should have size 2*domainDim+1"
ccall((:gsBasis_refineElements,libgismo),Cvoid,
(Ptr{gsCBasis},Ptr{Cint},Cint),
Expand All @@ -190,10 +190,10 @@ Refines a basis
# Arguments
- `obj::Basis`: a Gismo Basis
- `boxes::Matrix{Cdouble}`: the boxes to refine (first column is the lower bound, second column is the upper bound)
- `refExt::Cint=Int32(0)`: the refinement extension
- `refExt::Int=Int(0)`: the refinement extension

"""
function refine!(obj::Basis,boxes::Matrix{Cdouble},refExt::Cint=Int32(0))::Nothing
function refine!(obj::Basis,boxes::Matrix{Cdouble},refExt::Int=Int(0))::Nothing
@assert Base.size(boxes,1)==domainDim(obj) "The boxes should have the same number of rows as the domain dimension"
@assert Base.size(boxes,2)==2 "The boxes should have two columns"
bb = EigenMatrix(Base.size(boxes,1), Base.size(boxes,2), pointer(boxes) )
Expand Down Expand Up @@ -280,11 +280,11 @@ Returns the evaluation of a single basis function

# Arguments
- `obj::Basis`: a Gismo Basis
- `i::Cint`: the index of the basis function
- `i::Int`: the index of the basis function
- `u::Matrix{Cdouble}`: a matrix of points
hverhelst marked this conversation as resolved.
Show resolved Hide resolved

"""
function evalSingle(obj::Basis,i::Cint,u::Matrix{Cdouble})::EigenMatrix
function evalSingle(obj::Basis,i::Int,u::Matrix{Cdouble})::EigenMatrix
@assert Base.size(u,1)==domainDim(obj) "Domain dimension should be equal to the number of rows of the points"
uu = EigenMatrix(Base.size(u,1), Base.size(u,2), pointer(u) )
result = EigenMatrix()
Expand All @@ -299,11 +299,11 @@ Returns the derivative of a single basis function

# Arguments
- `obj::Basis`: a Gismo Basis
- `i::Cint`: the index of the basis function
- `i::Int`: the index of the basis function
- `u::Matrix{Cdouble}`: a matrix of points

"""
function derivSingle(obj::Basis,i::Cint,u::Matrix{Cdouble})::EigenMatrix
function derivSingle(obj::Basis,i::Int,u::Matrix{Cdouble})::EigenMatrix
@assert Base.size(u,1)==domainDim(obj) "Domain dimension should be equal to the number of rows of the points"
uu = EigenMatrix(Base.size(u,1), Base.size(u,2), pointer(u) )
result = EigenMatrix()
Expand All @@ -318,11 +318,11 @@ Returns the second derivative of a single basis function

# Arguments
- `obj::Basis`: a Gismo Basis
- `i::Cint`: the index of the basis function
- `i::Int`: the index of the basis function
- `u::Matrix{Cdouble}`: a matrix of points

"""
function deriv2Single(obj::Basis,i::Cint,u::Matrix{Cdouble})::EigenMatrix
function deriv2Single(obj::Basis,i::Int,u::Matrix{Cdouble})::EigenMatrix
@assert Base.size(u,1)==domainDim(obj) "Domain dimension should be equal to the number of rows of the points"
uu = EigenMatrix(Base.size(u,1), Base.size(u,2), pointer(u) )
result = EigenMatrix()
Expand Down Expand Up @@ -379,7 +379,7 @@ Return the domain dimension of a geometry
- `object::Geometry`: a Gismo Geometry

"""
function domainDim(object::Geometry)::Cint
function domainDim(object::Geometry)::Int
return ccall((:gsFunctionSet_domainDim,libgismo),Cint,(Ptr{gsCFunctionSet},),object.ptr)
end

Expand All @@ -390,7 +390,7 @@ Returns the target dimension of a geometry
- `object::Geometry`: a Gismo Geometry

"""
function targetDim(object::Geometry)::Cint
function targetDim(object::Geometry)::Int
return ccall((:gsFunctionSet_targetDim,libgismo),Cint,(Ptr{gsCFunctionSet},),object.ptr)
end

Expand Down Expand Up @@ -572,7 +572,7 @@ Adds a patch to a MultiPatch
- `geom::Geometry`: a Gismo Geometry

"""
function domainDim(object::MultiPatch)::Cint
function domainDim(object::MultiPatch)::Int
return ccall((:gsFunctionSet_domainDim,libgismo),Cint,(Ptr{gsCFunctionSet},),object.ptr)
end

Expand All @@ -583,7 +583,7 @@ Returns the target dimension of a MultiPatch
- `object::MultiPatch`: a Gismo MultiPatch

"""
function targetDim(object::MultiPatch)::Cint
function targetDim(object::MultiPatch)::Int
return ccall((:gsFunctionSet_targetDim,libgismo),Cint,(Ptr{gsCFunctionSet},),object.ptr)
end

Expand Down
Loading
Loading