Added backward compatibility

This commit is contained in:
Jukka Aho
2017-02-27 08:27:08 +02:00
parent 3fafcf243e
commit 93b520fa2c
4 changed files with 12 additions and 6 deletions
+2 -1
View File
@@ -128,7 +128,8 @@ module Preprocess
include("preprocess.jl")
export create_elements, Mesh, add_node!, add_nodes!, add_element!,
add_elements!, add_element_to_element_set!, add_node_to_node_set!,
find_nearest_nodes, reorder_element_connectivity!, create_node_set_from_element_set!
find_nearest_nodes, find_nearest_node, reorder_element_connectivity!,
create_node_set_from_element_set!
include("preprocess_abaqus_reader.jl")
export parse_abaqus, parse_section, parse_element_section,
abaqus_read_mesh, abaqus_read_model
+8 -3
View File
@@ -63,6 +63,10 @@ function create_node_set_from_element_set!(mesh::Mesh, set_names::String...)
return
end
function create_node_set_from_element_set!(mesh::Mesh, set_name::Symbol)
create_node_set_from_element_set!(mesh, string(set_name))
end
function add_element!(mesh::Mesh, elid::Int, eltype::Symbol, connectivity::Vector{Int})
mesh.elements[elid] = connectivity
mesh.element_types[elid] = eltype
@@ -160,12 +164,13 @@ function find_nearest_nodes(mesh::Mesh, coords::Vector{Float64}, npts::Int=1; no
s = sort(collect(dist), by=x->x[2])
nd = s[1:npts] # [(id1, dist1), (id2, dist2), ..., (id_npts, dist_npts)]
node_ids = [n[1] for n in nd]
if length(node_ids) == 1
return first(node_ids)
end
return node_ids
end
function find_nearest_node(mesh::Mesh, coords::Vector{Float64}; node_set=nothing)
return first(find_nearest_nodes(mesh, coords, 1; node_set=node_set))
end
"""
Apply new node ordering to elements. In JuliaFEM same node ordering is used
than in ABAQUS and if mesh is parsed from FEM format with other node ordering
+2 -2
View File
@@ -39,8 +39,8 @@ end
mesh = aster_read_mesh(meshfile)
create_node_set_from_element_set!(mesh, "LOWER_LEFT", "UPPER_BOTTOM")
# nid 1 coords = (0.0, 0.5), nid 13 coords = (0.0, 0.5)
nid = find_nearest_nodes(mesh, [0.0, 0.5]; node_set="LOWER_LEFT")
nid = find_nearest_node(mesh, [0.0, 0.5]; node_set="LOWER_LEFT")
@test first(nid) == 1
nid = find_nearest_nodes(mesh, [0.0, 0.5]; node_set="UPPER_BOTTOM")
nid = find_nearest_node(mesh, [0.0, 0.5]; node_set="UPPER_BOTTOM")
@test first(nid) == 13
end
Binary file not shown.