mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-10-01 05:49:22 +00:00
interpolation routines to separate file.
This commit is contained in:
@@ -47,54 +47,6 @@ function dummy(a)
|
||||
end
|
||||
|
||||
|
||||
"""
|
||||
Interpolate field variable using basis functions f for point ip.
|
||||
This function tries to be as general as possible and allows interpolating
|
||||
lot of different fields.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
field :: Array{Number, dim}
|
||||
Field variable
|
||||
basis :: Function
|
||||
Basis functions
|
||||
ip :: Array{Number, 1}
|
||||
Point to interpolate
|
||||
"""
|
||||
function interpolate{T<:Real}(field::Array{T,1}, basis::Function, ip)
|
||||
result = dot(field, basis(ip))
|
||||
return result
|
||||
end
|
||||
function interpolate{T<:Real}(field::Array{T,2}, basis::Function, ip)
|
||||
m, n = size(field)
|
||||
bip = basis(ip)
|
||||
tmp = size(bip)
|
||||
if length(tmp) == 1
|
||||
ndim = 1
|
||||
nnodes = tmp[1]
|
||||
else
|
||||
ndim, nnodes = size(bip)
|
||||
end
|
||||
if ndim == 1
|
||||
if n == nnodes
|
||||
result = field * bip
|
||||
elseif m == nnodes
|
||||
result = field' * bip
|
||||
end
|
||||
else
|
||||
if n == nnodes
|
||||
result = bip' * field
|
||||
elseif m == nnodes
|
||||
result = bip' * field'
|
||||
end
|
||||
end
|
||||
if length(result) == 1
|
||||
result = result[1]
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
"""
|
||||
Calculate local tangent stiffness matrix and residual force vector
|
||||
R = T - F for elasticity problem.
|
||||
|
||||
Reference in New Issue
Block a user