Skip to content

Commit

Permalink
Fix deprecations (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
femtocleaner[bot] authored and ahojukka5 committed Jul 4, 2018
1 parent 5c70195 commit 1ce8963
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ begin
function FEMBasis.get_reference_element_coordinates(::Type{Tet10})
return ((0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0), (0.5, 0.0, 0.0), (0.5, 0.5, 0.0), (0.0, 0.5, 0.0), (0.0, 0.0, 0.5), (0.5, 0.0, 0.5), (0.0, 0.5, 0.5))
end
function FEMBasis.eval_basis!{T}(::Type{Tet10}, N::Matrix{T}, xi::Tuple{T, T, T})
function FEMBasis.eval_basis!(::Type{Tet10}, N::Matrix{T}, xi::Tuple{T, T, T}) where T
(u, v, w) = xi
begin
N[1] = 1.0 + -3.0u + -3.0v + -3.0w + 4.0 * (u * v) + 4.0 * (v * w) + 4.0 * (w * u) + 2.0 * u ^ 2 + 2.0 * v ^ 2 + 2.0 * w ^ 2
Expand All @@ -60,7 +60,7 @@ begin
end
return N
end
function FEMBasis.eval_dbasis!{T}(::Type{Tet10}, dN::Matrix{T}, xi::Tuple{T, T, T})
function FEMBasis.eval_dbasis!(::Type{Tet10}, dN::Matrix{T}, xi::Tuple{T, T, T}) where T
(u, v, w) = xi
begin
dN[1, 1] = -3.0 + 4.0v + 4.0w + 2.0 * (2u)
Expand Down
16 changes: 8 additions & 8 deletions src/create_basis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function calculate_interpolation_polynomial_derivatives(basis, dim)
return equations
end

function create_basis{nbasis,dim}(name::Symbol, description::String, X::NTuple{nbasis, NTuple{dim, Float64}}, basis, dbasis)
function create_basis(name::Symbol, description::String, X::NTuple{nbasis, NTuple{dim, Float64}}, basis, dbasis) where {nbasis,dim}

Q = Expr(:block)
for i=1:nbasis
Expand All @@ -125,7 +125,7 @@ function create_basis{nbasis,dim}(name::Symbol, description::String, X::NTuple{n
end

code = quote
type $name <: FEMBasis.AbstractBasis
mutable struct $name <: FEMBasis.AbstractBasis
end

function Base.size(::Type{$name})
Expand All @@ -145,13 +145,13 @@ function create_basis{nbasis,dim}(name::Symbol, description::String, X::NTuple{n
return $X
end

function FEMBasis.eval_basis!{T}(::Type{$name}, N::Matrix{T}, xi)
function FEMBasis.eval_basis!(::Type{$name}, N::Matrix{T}, xi) where T
$unpack
$Q
return N
end

function FEMBasis.eval_dbasis!{T}(::Type{$name}, dN::Matrix{T}, xi)
function FEMBasis.eval_dbasis!(::Type{$name}, dN::Matrix{T}, xi) where T
$unpack
$V
return dN
Expand All @@ -161,24 +161,24 @@ function create_basis{nbasis,dim}(name::Symbol, description::String, X::NTuple{n
return code
end

function create_basis{nbasis,dim}(name::Symbol, description::String, X::NTuple{nbasis, NTuple{dim, Float64}}, p::Expr)
function create_basis(name::Symbol, description::String, X::NTuple{nbasis, NTuple{dim, Float64}}, p::Expr) where {nbasis,dim}
A = calculate_basis_coefficients(p, X)
basis = calculate_interpolation_polynomials(p, A)
dbasis = calculate_interpolation_polynomial_derivatives(basis, dim)
return create_basis(name, description, X, basis, dbasis)
end

function create_basis{nbasis,dim}(name::Symbol, description::String, X::NTuple{nbasis, NTuple{dim, Float64}}, p::String)
function create_basis(name::Symbol, description::String, X::NTuple{nbasis, NTuple{dim, Float64}}, p::String) where {nbasis,dim}
create_basis(name, description, X, parse(p))
end

function create_basis{nbasis,dim}(name::Symbol, description::String, X::NTuple{nbasis, NTuple{dim, Float64}}, basis_::NTuple{nbasis, String})
function create_basis(name::Symbol, description::String, X::NTuple{nbasis, NTuple{dim, Float64}}, basis_::NTuple{nbasis, String}) where {nbasis,dim}
basis = [parse(b) for b in basis_]
dbasis = calculate_interpolation_polynomial_derivatives(basis, dim)
return create_basis(name, description, X, basis, dbasis)
end

function create_basis{nbasis,dim}(name::Symbol, description::String, X::NTuple{nbasis, NTuple{dim, Float64}}, basis::NTuple{nbasis, Expr})
function create_basis(name::Symbol, description::String, X::NTuple{nbasis, NTuple{dim, Float64}}, basis::NTuple{nbasis, Expr}) where {nbasis,dim}
dbasis = calculate_interpolation_polynomial_derivatives(basis, dim)
return create_basis(name, description, X, basis, dbasis)
end
20 changes: 10 additions & 10 deletions src/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@

import Base: length, size

function length{T<:AbstractBasis}(B::T)
function length(B::T) where T<:AbstractBasis
return length(T)
end

function size{T<:AbstractBasis}(B::T)
function size(B::T) where T<:AbstractBasis
return size(T)
end

function eval_basis!{T<:AbstractBasis}(B::T, N, xi)
function eval_basis!(B::T, N, xi) where T<:AbstractBasis
return eval_basis!(T, N, xi)
end

function eval_dbasis!{T<:AbstractBasis}(B::T, dN, xi)
function eval_dbasis!(B::T, dN, xi) where T<:AbstractBasis
return eval_dbasis!(T, dN, xi)
end

Expand Down Expand Up @@ -145,7 +145,7 @@ end
"""
Data type for fast FEM.
"""
type BasisInfo{B<:AbstractBasis,T}
mutable struct BasisInfo{B<:AbstractBasis,T}
N::Matrix{T}
dN::Matrix{T}
grad::Matrix{T}
Expand All @@ -154,11 +154,11 @@ type BasisInfo{B<:AbstractBasis,T}
detJ::T
end

function length{T<:AbstractBasis}(B::BasisInfo{T})
function length(B::BasisInfo{T}) where T<:AbstractBasis
return length(T)
end

function size{T<:AbstractBasis}(B::BasisInfo{T})
function size(B::BasisInfo{T}) where T<:AbstractBasis
return size(T)
end

Expand All @@ -178,7 +178,7 @@ FEMBasis.BasisInfo{FEMBasis.Tri3,Float64}([0.0 0.0 0.0], [0.0 0.0 0.0; 0.0 0.0 0
```
"""
function BasisInfo{B<:AbstractBasis}(::Type{B}, T=Float64)
function BasisInfo(::Type{B}, T=Float64) where B<:AbstractBasis
dim, nbasis = size(B)
N = zeros(T, 1, nbasis)
dN = zeros(T, dim, nbasis)
Expand Down Expand Up @@ -207,7 +207,7 @@ FEMBasis.BasisInfo{FEMBasis.Quad4,Float64}([0.25 0.25 0.25 0.25], [-0.25 0.25 0.
```
"""
function eval_basis!{B}(bi::BasisInfo{B}, X, xi)
function eval_basis!(bi::BasisInfo{B}, X, xi) where B

# evaluate basis and derivatives
eval_basis!(B, bi.N, xi)
Expand Down Expand Up @@ -303,7 +303,7 @@ grad!(B, gradu, u)
1.0 2.0
```
"""
function grad!{B}(bi::BasisInfo{B}, gradu, u)
function grad!(bi::BasisInfo{B}, gradu, u) where B
dim, nbasis = size(B)
fill!(gradu, 0.0)
for i=1:dim
Expand Down
2 changes: 1 addition & 1 deletion src/nurbs_segment.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License is MIT: see https://github.com/JuliaFEM/FEMBasis.jl/blob/master/LICENSE

""" NURBS segment. """
type NSeg <: AbstractBasis
mutable struct NSeg <: AbstractBasis
order :: Int
knots :: Vector{Float64}
weights :: Vector{Float64}
Expand Down
2 changes: 1 addition & 1 deletion src/nurbs_solid.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/FEMBasis.jl/blob/master/LICENSE

type NSolid <: AbstractBasis
mutable struct NSolid <: AbstractBasis
order_u :: Int
order_v :: Int
order_w :: Int
Expand Down
2 changes: 1 addition & 1 deletion src/nurbs_surface.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/FEMBasis.jl/blob/master/LICENSE

type NSurf <: AbstractBasis
mutable struct NSurf <: AbstractBasis
order_u :: Int
order_v :: Int
knots_u :: Vector{Float64}
Expand Down

0 comments on commit 1ce8963

Please sign in to comment.