mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-17 17:22:10 +00:00
added functions to add and remove nodes from model
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using JuliaFEM
|
||||
using Base.Test
|
||||
|
||||
|
||||
function test_create_model()
|
||||
m = new_model()
|
||||
fn = fieldnames(m)
|
||||
@@ -11,12 +12,14 @@ function test_create_model()
|
||||
@assert :element_gauss_points in fn
|
||||
end
|
||||
|
||||
|
||||
function test_add_field()
|
||||
m = new_model()
|
||||
field = new_field(m.elements, "color")
|
||||
@assert "color" in keys(m.elements)
|
||||
end
|
||||
|
||||
|
||||
function test_get_field()
|
||||
m = new_model()
|
||||
field = new_field(m.elements, "color")
|
||||
@@ -25,6 +28,7 @@ function test_get_field()
|
||||
@assert field2[1] == "red"
|
||||
end
|
||||
|
||||
|
||||
function test_get_field_if_it_doesnt_exist()
|
||||
m = new_model()
|
||||
# FIXME: how to test exception?
|
||||
@@ -36,6 +40,19 @@ function test_get_field_if_it_doesnt_exist()
|
||||
end
|
||||
|
||||
|
||||
function test_add_and_get_nodes()
|
||||
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)
|
||||
subset = get_nodes(m, [2, 3])
|
||||
@assert length(subset) == 2
|
||||
@assert subset[2] == [1.0, 0.0, 0.0]
|
||||
@assert subset[3] == [0.0, 1.0, 0.0]
|
||||
end
|
||||
|
||||
# write your own tests here
|
||||
# @test 1 == JuliaFEM.test()
|
||||
# @test_approx_eq 1.0 1.0
|
||||
|
||||
Reference in New Issue
Block a user