mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-08-12 07:13:19 +00:00
34 lines
814 B
Julia
34 lines
814 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
|
|
using JuliaFEM.Test
|
|
|
|
@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
|
|
end
|
|
|
|
@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
|
|
end
|
|
|
|
@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
|