Skip to content

Commit a50f52a

Browse files
authored
fix INP set parser (#172)
1 parent d39d88e commit a50f52a

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TopOpt"
22
uuid = "53a1e1a5-51bb-58a9-8a02-02056cc81109"
33
authors = ["mohamed82008 <[email protected]>", "yijiangh <[email protected]>"]
4-
version = "0.9.0"
4+
version = "0.9.1"
55

66
[deps]
77
AbstractDifferentiation = "c29ec348-61ec-40c8-8164-b8c60e9d9f3d"

src/TopOptProblems/IO/INP/Parser/FeatureExtractors/extract_set.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ function extract_set!(
99
line = readline(file)
1010
m = match(stopping_pattern, line)
1111
while m isa Nothing
12-
m = match(pattern_single, line)
13-
if m != nothing
14-
push!(vector, parse(TI, m[1]) - offset)
12+
if match(pattern_single, line) !== nothing
13+
m = eachmatch(r"(\d+)", line)
14+
for _m in m
15+
push!(vector, parse(TI, _m.match) - offset)
16+
end
1517
else
1618
m = match(pattern_subset, line)
17-
if m != nothing
19+
if m !== nothing
1820
subsetname = String(m[1])
1921
if haskey(sets, subsetname)
2022
append!(vector, sets[subsetname])

test/inp_parser/parser.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ force_node = collect(keys(raw_inp.cloads))[1]
3030
@test raw_inp.dloads["DLOAD_SET_1"] == 1
3131

3232
@test raw_inp.nodedbcs["FemConstraintDisplacement"] == [(1, 0), (2, 0), (3, 0)]
33+
@test raw_inp.nodesets["FemConstraintDisplacement"] == [1, 3, 5, 7, 13, 14, 15, 16, 22]
3334
for n in raw_inp.nodesets["FemConstraintDisplacement"]
3435
@test raw_inp.node_coords[n][3] == 0
3536
end

test/inp_parser/testcube.inp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ Evolumes
5656
** written by write_node_sets_constraints_displacement function
5757
** FemConstraintDisplacement
5858
*NSET,NSET=FemConstraintDisplacement
59-
1,
60-
3,
61-
5,
59+
1,3, 5,
6260
7,
6361
13,
6462
14,

0 commit comments

Comments
 (0)