mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-17 17:22:10 +00:00
api now able to read abaqus files
This commit is contained in:
@@ -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
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user