diff --git a/src/postprocess_utils.jl b/src/postprocess_utils.jl index 3f91da1..b88c9c6 100644 --- a/src/postprocess_utils.jl +++ b/src/postprocess_utils.jl @@ -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 +