mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-12 14:23:20 +00:00
xdmf test
This commit is contained in:
@@ -125,6 +125,8 @@ test_get_element()
|
||||
|
||||
|
||||
|
||||
include("test_xdfm.jl")
|
||||
|
||||
# write your own tests here
|
||||
# @test 1 == JuliaFEM.test()
|
||||
# @test_approx_eq 1.0 1.0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using JuliaFEM
|
||||
using Base.Test
|
||||
|
||||
|
||||
function test_write_to_xdfm()
|
||||
m = new_model()
|
||||
nodes = Dict(1 => [0.0, 0.0, 0.0],
|
||||
2 => [1.0, 0.0, 0.0],
|
||||
3 => [0.0, 1.0, 0.0],
|
||||
4 => [0.0, 0.0, 1.0])
|
||||
add_nodes(m, nodes)
|
||||
el1 = Dict("element_type" => 0x6, "node_ids" => [1, 2, 3, 4])
|
||||
elements = [el1]
|
||||
add_elements(elements)
|
||||
|
||||
# create new field "temperature" for nodal points
|
||||
f = new_field(m.nodes, "temperature")
|
||||
f[1] = 0.1
|
||||
f[2] = 0.2
|
||||
f[3] = 0.3
|
||||
# do NOT write to fourth node.
|
||||
|
||||
# export model to xdmf
|
||||
fn = tempname()
|
||||
println("temp file: ", fn)
|
||||
time = 123
|
||||
write_xdmf(m, fn, time; fields = ["temperature"])
|
||||
|
||||
d = h5open(fn)
|
||||
@test d[123]["temperature"][:] = [0.1, 0.2, 0.3]
|
||||
|
||||
end
|
||||
test_write_to_xdfm()
|
||||
Reference in New Issue
Block a user