api now able to read abaqus files

This commit is contained in:
Olli Väinölä
2015-12-03 15:39:02 +02:00
parent 565f371432
commit 47802eb876
3 changed files with 41 additions and 8 deletions
+5
View File
@@ -47,6 +47,11 @@ function add_element_set!(model::Model, name::ASCIIString, ids::Vector{Int64})
model.elsets[name] = elset
end
function add_node_set!(model::Model, name::ASCIIString, ids::Vector{Int64})
nset = NodeSet(name, ids)
model.nsets[name] = nset
end
function add_element_set!(model::Model, name::ASCIIString,
elements::Vector{Element})
elset = ElementSet(name, elements)
+30 -7
View File
@@ -96,13 +96,36 @@ type Model
#settings :: Dict{AbstractString, Real}
end
Model(name::ASCIIString, abq_input::Dict) = Model(
name,
abq_input["nodes"],
abq_input["elements"],
abq_input["elsets"],
abq_input["nsets"],
Dict{ASCIIString, LoadCase}())
function Model(name::ASCIIString, abq_input::Dict)
model = Model(name)
nodes = abq_input["nodes"]
elements = abq_input["elements"]
element_sets = abq_input["elsets"]
node_sets = abq_input["nsets"]
for id in keys(nodes)
coords = nodes[id]
add_node!(model, id, coords)
end
for id in keys(elements)
data = elements[id]
eltype = data["type"]
conn = data["connectivity"]
# println(eltype, " ", conn)
add_element!(model, id, eltype, conn)
end
for name in keys(node_sets)
ids = node_sets[name]
add_node_set!(model, name, ids)
end
for name in keys(element_sets)
ids = element_sets[name]
add_element_set!(model, name, ids)
end
model
end
Model(name::ASCIIString) = Model(
name,
+6 -1
View File
@@ -74,9 +74,14 @@ function test_basic()
end
function test_piston_8789()
abaqus_input = open(parse_abaqus, "../geometry/piston/piston_8789_P1.inp")
abaqus_input = open(parse_abaqus, "./geometry/piston/piston_8789_P1.inp")
model = Model("Piston Calculation", abaqus_input)
@test length(keys(model.elsets)) == 4
@test length(keys(model.nsets)) == 1
@test length(keys(model.elements)) == 37331
@test length(keys(model.nodes)) == 8789
end
# test_basic()
test_piston_8789()
end