From 2b0124041c19f9aa1b1b58b757773b511a4651b2 Mon Sep 17 00:00:00 2001 From: Tero Frondelius Date: Wed, 26 Oct 2016 22:28:49 +0300 Subject: [PATCH] parse_section() fixed to ignore parameters order --- src/preprocess_abaqus_reader.jl | 7 ++++--- test/test_preprocess_abaqus_reader.jl | 1 + test/testdata/cube_tet4.inp | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/preprocess_abaqus_reader.jl b/src/preprocess_abaqus_reader.jl index 9261b6c..c48b8cf 100644 --- a/src/preprocess_abaqus_reader.jl +++ b/src/preprocess_abaqus_reader.jl @@ -161,10 +161,11 @@ function parse_section(model, lines, key, idx_start, idx_end, ::Type{Val{:SURFAC info("Parsing surface") #definition = uppercase(lines[idx_start]) definition = lines[idx_start] - has_set_def = match(r"TYPE=([\w\_\-]+),.*NAME=([\w\_\-]+)", definition) + #has_set_def = match(r"TYPE=([\w\_\-]+),.*NAME=([\w\_\-]+)", definition) + has_set_def = Dict(map(y -> lowercase(y[1]) => y[2], map(x -> split(x, "="), matchall(r"([\w\_\-]+[ ]*=[ ]*[\w\_\-]+)", definition)))) has_set_def != nothing || return - set_type = Symbol(has_set_def[1]) - set_name = Symbol(has_set_def[2]) + set_type = Symbol(has_set_def["type"]) + set_name = Symbol(has_set_def["name"]) data = Vector{Tuple{Int64, Symbol}}() for line in lines[idx_start + 1: idx_end] empty_or_comment_line(line) && continue diff --git a/test/test_preprocess_abaqus_reader.jl b/test/test_preprocess_abaqus_reader.jl index a08662b..6e94e2a 100644 --- a/test/test_preprocess_abaqus_reader.jl +++ b/test/test_preprocess_abaqus_reader.jl @@ -46,6 +46,7 @@ end @test haskey(mesh.node_sets, :SYM12) @test haskey(mesh.element_sets, :CUBE) @test haskey(mesh.surfaces, :LOAD) + @test haskey(mesh.surfaces, :ORDER) @test length(mesh.surfaces[:LOAD]) == 2 @test mesh.surfaces[:LOAD][1] == (16, :S1) @test mesh.surface_types[:LOAD] == :ELEMENT diff --git a/test/testdata/cube_tet4.inp b/test/testdata/cube_tet4.inp index 228d030..8204138 100644 --- a/test/testdata/cube_tet4.inp +++ b/test/testdata/cube_tet4.inp @@ -40,6 +40,9 @@ *SURFACE, TYPE=ELEMENT, NAME=LOAD 16, S1 8, S1 +*SURFACE, NAME=ORDER , TYPE=ELEMENT + 16, S1 + 8, S1 *STEP *STATIC *BOUNDARY