Skip to content

Commit

Permalink
fix INP set parser (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamed82008 authored Mar 8, 2024
1 parent d39d88e commit a50f52a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TopOpt"
uuid = "53a1e1a5-51bb-58a9-8a02-02056cc81109"
authors = ["mohamed82008 <[email protected]>", "yijiangh <[email protected]>"]
version = "0.9.0"
version = "0.9.1"

[deps]
AbstractDifferentiation = "c29ec348-61ec-40c8-8164-b8c60e9d9f3d"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ function extract_set!(
line = readline(file)
m = match(stopping_pattern, line)
while m isa Nothing
m = match(pattern_single, line)
if m != nothing
push!(vector, parse(TI, m[1]) - offset)
if match(pattern_single, line) !== nothing
m = eachmatch(r"(\d+)", line)
for _m in m
push!(vector, parse(TI, _m.match) - offset)
end
else
m = match(pattern_subset, line)
if m != nothing
if m !== nothing
subsetname = String(m[1])
if haskey(sets, subsetname)
append!(vector, sets[subsetname])
Expand Down
1 change: 1 addition & 0 deletions test/inp_parser/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ force_node = collect(keys(raw_inp.cloads))[1]
@test raw_inp.dloads["DLOAD_SET_1"] == 1

@test raw_inp.nodedbcs["FemConstraintDisplacement"] == [(1, 0), (2, 0), (3, 0)]
@test raw_inp.nodesets["FemConstraintDisplacement"] == [1, 3, 5, 7, 13, 14, 15, 16, 22]
for n in raw_inp.nodesets["FemConstraintDisplacement"]
@test raw_inp.node_coords[n][3] == 0
end
Expand Down
4 changes: 1 addition & 3 deletions test/inp_parser/testcube.inp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ Evolumes
** written by write_node_sets_constraints_displacement function
** FemConstraintDisplacement
*NSET,NSET=FemConstraintDisplacement
1,
3,
5,
1,3, 5,
7,
13,
14,
Expand Down

2 comments on commit a50f52a

@mohamed82008
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/102501

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.1 -m "<description of version>" a50f52a50e499bd98e6be71f3e5895a4a7ff6c3a
git push origin v0.9.1

Please sign in to comment.