interpolate from set of elements

This commit is contained in:
Jukka Aho
2016-07-07 18:01:37 +03:00
parent 8b85c2674c
commit 53789d160d
+12 -1
View File
@@ -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