Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do keyword register without macro, more clean solution and understand…
…able
- Loading branch information
Showing
4 changed files
with
65 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This file is a part of JuliaFEM. | ||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md | ||
|
||
let register=Set{String}() | ||
|
||
""" | ||
register_abaqus_keyword(keyword::String) | ||
Add ABAQUS keyword `s` to register. That is, after registration every time | ||
keyword show up in `.inp` file a new section is started | ||
""" | ||
global function register_abaqus_keyword(keyword::String) | ||
push!(register, keyword) | ||
return Type{Val{Symbol(keyword)}} | ||
end | ||
|
||
""" | ||
is_abaqus_keyword_registered(keyword::String) | ||
Return true/false is ABAQUS keyword registered. | ||
""" | ||
global function is_abaqus_keyword_registered(keyword::String) | ||
return keyword in register | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file is a part of JuliaFEM. | ||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md | ||
|
||
using Base.Test | ||
|
||
using AbaqusReader: register_abaqus_keyword, is_abaqus_keyword_registered | ||
|
||
@testset "keyword register" begin | ||
register_abaqus_keyword("HEI") | ||
@test is_abaqus_keyword_registered("HEI") | ||
@test !is_abaqus_keyword_registered("EI") | ||
end |