Files
JuliaFEM.jl/test/test_fields.jl
T

34 lines
814 B
Julia
Raw Normal View History

2015-10-30 12:40:56 +02:00
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
2016-05-25 22:33:47 +03:00
using JuliaFEM
2015-11-01 18:44:50 +02:00
using JuliaFEM.Test
2015-10-30 12:40:56 +02:00
2016-05-25 22:33:47 +03:00
@testset "test updating time dependent fields" begin
f = Field(0.0 => 1.0)
@test last(f).time == 0.0
@test last(f).data == 1.0
update!(f, 0.0 => 2.0)
@test last(f).time == 0.0
@test last(f).data == 2.0
@test length(f) == 1
update!(f, 1.0 => 3.0)
@test last(f).time == 1.0
@test last(f).data == 3.0
@test length(f) == 2
2015-10-30 12:40:56 +02:00
end
2016-05-25 22:33:47 +03:00
@testset "test updating time invariant fields" begin
f = Field(1.0)
@test f.data == 1.0
update!(f, 2.0)
@test f.data == 2.0
2015-10-30 12:40:56 +02:00
end
2016-06-02 22:58:54 +03:00
2016-06-27 16:11:33 +03:00
@testset "test field defined using function" begin
g(xi, t) = xi[1]*t
f = Field(g)
v = f([1.0], 2.0)
@test isapprox(v, 2.0)
end