mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-08-16 18:44:05 +00:00
ca7e2904cf
* Fix deprecation warnings from tests * Refactor tests so that ´@testset` is usually called in master file `runtests.jl`, not inside test file. Later on we can convert tests to examples. * Syntax of tests now follow more closely syntax used currently in JuliaFEM. We have had earlier studies with different kind of syntaxes, now we have kind of explicit way to do things.
24 lines
929 B
Julia
24 lines
929 B
Julia
# This file is a part of JuliaFEM.
|
|
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
|
|
|
|
using JuliaFEM, Test
|
|
|
|
## interpolate from a set of elements
|
|
|
|
element1 = Element(Seg2, (1, 2))
|
|
element2 = Element(Seg2, (2, 3))
|
|
X = Dict(1 => [0.0], 2 => [1.0], 3 => [2.0])
|
|
T = Dict(1 => [0.0], 2 => [1.0], 3 => [0.0])
|
|
problem = Problem(Heat, "foo", 1)
|
|
add_elements!(problem, element1, element2)
|
|
problem_elements = get_elements(problem)
|
|
update!(problem_elements, "geometry", X)
|
|
update!(problem_elements, "temperature", T)
|
|
@test isnan(problem("temperature", [-0.1], 0.0))
|
|
@test isapprox(problem("temperature", [0.0], 0.0), [0.0])
|
|
@test isapprox(problem("temperature", [0.5], 0.0), [0.5])
|
|
@test isapprox(problem("temperature", [1.0], 0.0), [1.0])
|
|
@test isapprox(problem("temperature", [1.5], 0.0), [0.5])
|
|
@test isapprox(problem("temperature", [2.0], 0.0), [0.0])
|
|
@test isnan(problem("temperature", [ 2.1], 0.0))
|