mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-08-06 04:21:33 +00:00
Added type template to interpolate function and added test for interpolate
This commit is contained in:
@@ -25,11 +25,11 @@ basis :: Function
|
||||
ip :: Array{Number, 1}
|
||||
Point to interpolate
|
||||
""" ->
|
||||
function interpolate(field::Array{Float64,1}, basis::Function, ip)
|
||||
function interpolate{T<:Real}(field::Array{T,1}, basis::Function, ip)
|
||||
result = dot(field, basis(ip))
|
||||
return result
|
||||
end
|
||||
function interpolate(field::Array{Float64,2}, basis::Function, ip)
|
||||
function interpolate{T<:Real}(field::Array{T,2}, basis::Function, ip)
|
||||
m, n = size(field)
|
||||
bip = basis(ip)
|
||||
tmp = size(bip)
|
||||
|
||||
@@ -154,6 +154,7 @@ facts("test interpolation of different field variables") do
|
||||
F3 = F2'
|
||||
F4 = [0.0 0.0; 10.0 0.0; 10.0 1.0; 0.0 1.0]'
|
||||
F5 = F4'
|
||||
F6 = [36, 36, 36, 36]
|
||||
|
||||
@fact interpolate(F1, N, [0.0, 0.0]) => 36.0
|
||||
@fact interpolate(F2, N, [0.0, 0.0]) => 36.0
|
||||
|
||||
Reference in New Issue
Block a user