mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-30 13:29:22 +00:00
new style dict field, xdmf improvements
This commit is contained in:
+44
-2
@@ -13,7 +13,7 @@ using JuliaFEM.Testing
|
||||
# one timestep in field "temperature"
|
||||
@test length(el["temperature"]) == 1
|
||||
# this way we access to field at default time t=0.0, it's different than ^!
|
||||
@test length(el("temperature")) == 2
|
||||
@test length(el("temperature")) == 2
|
||||
# length of single increment
|
||||
@test length(el("temperature", 0.0)) == 2
|
||||
@test length(last(el, "temperature").data) == 2
|
||||
@@ -27,7 +27,7 @@ end
|
||||
@test haskey(el, "displacement")
|
||||
@test length(el["displacement"]) == 1
|
||||
# this way we access to field at default time t=0.0, it's different than ^!
|
||||
@test length(el("displacement")) == 2
|
||||
@test length(el("displacement")) == 2
|
||||
# length of single increment
|
||||
@test length(el("displacement", 0.0)) == 2
|
||||
@test length(last(el, "displacement").data) == 2
|
||||
@@ -41,3 +41,45 @@ end
|
||||
@test haskey(el, "reaction force")
|
||||
@test haskey(el, "temperature")
|
||||
end
|
||||
|
||||
#=
|
||||
@testset "dict field depending from problems" begin
|
||||
p1 = Problem(Elasticity, "Body 1", 2)
|
||||
p2 = Problem(Elasticity, "Body 2", 2)
|
||||
X = Dict{Int64, Vector{Float64}}(
|
||||
1 => [0.0, 0.0],
|
||||
2 => [1.0, 0.0],
|
||||
3 => [1.0, 1.0],
|
||||
4 => [0.0, 1.0])
|
||||
update!([p1, p2], "geometry", 0.0 => X)
|
||||
@test isapprox(p1("geometry", 0.0)[1], [0.0, 0.0])
|
||||
@test isapprox(p2("geometry", 0.0)[1], [0.0, 0.0])
|
||||
p1("geometry", 0.0)[1] = [1.0, 2.0]
|
||||
@test isapprox(p2("geometry", 0.0)[1], [1.0, 2.0])
|
||||
end
|
||||
=#
|
||||
|
||||
@testset "dict field depending from problems" begin
|
||||
X = Dict{Int64, Vector{Float64}}(
|
||||
1 => [0.0, 0.0],
|
||||
2 => [1.0, 0.0],
|
||||
3 => [1.0, 1.0],
|
||||
4 => [0.0, 1.0],
|
||||
5 => [0.0, 2.0],
|
||||
6 => [1.0, 2.0],
|
||||
7 => [1.0, 3.0],
|
||||
8 => [0.0, 3.0])
|
||||
p1 = Problem(Elasticity, "Body 1", 2)
|
||||
p2 = Problem(Elasticity, "Body 2", 2)
|
||||
e1 = Element(Quad4, 1, [1, 2, 3, 4])
|
||||
e2 = Element(Quad4, 2, [5, 6, 7, 8])
|
||||
push!(p1, e1)
|
||||
push!(p2, e2)
|
||||
update!(p1, "geometry", 0.0 => X)
|
||||
update!(p2, "geometry", 0.0 => X)
|
||||
@test isapprox(p1("geometry", 0.0)[1], [0.0, 0.0])
|
||||
@test isapprox(p2("geometry", 0.0)[1], [0.0, 0.0])
|
||||
p1("geometry", 0.0)[1] = [1.0, 2.0]
|
||||
@test isapprox(p2("geometry", 0.0)[1], [1.0, 2.0])
|
||||
@test isapprox(e1("geometry", 0.0)[1], [1.0, 2.0])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user