mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-19 17:58:53 +00:00
interpolate from set of elements
This commit is contained in:
@@ -129,7 +129,7 @@ function copy_field!(src_problem::Problem, dst_problem::Problem, field_name, tim
|
||||
end
|
||||
|
||||
""" Return field calculated to nodal points for elements in problem p. """
|
||||
function call(problem::Problem, field_name, time=0.0)
|
||||
function call(problem::Problem, field_name::String, time::Float64=0.0)
|
||||
f = Dict()
|
||||
for element in get_elements(problem)
|
||||
for (c, v) in zip(get_connectivity(element), element(field_name, time))
|
||||
@@ -142,3 +142,14 @@ function call(problem::Problem, field_name, time=0.0)
|
||||
return f
|
||||
end
|
||||
|
||||
""" Interpolate field from a set of elements. """
|
||||
function call(problem::Problem, field_name::String, X::Vector, time::Float64=0.0; fillna=NaN)
|
||||
for element in get_elements(problem)
|
||||
if inside(element, X, time)
|
||||
xi = get_local_coordinates(element, X, time)
|
||||
return element(field_name, xi, time)
|
||||
end
|
||||
end
|
||||
return fillna
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user